ranuts 0.1.0-alpha.1 → 0.1.0-alpha.3

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.
Files changed (123) hide show
  1. package/package.json +1 -1
  2. package/assets/img/sort/bubble.gif +0 -0
  3. package/assets/img/sort/complexity.png +0 -0
  4. package/assets/img/sort/select.gif +0 -0
  5. package/assets/img/sort/sort.png +0 -0
  6. package/assets/img/tree/balanceTree.png +0 -0
  7. package/dist/index.js.map +0 -1
  8. package/dist/index.umd.cjs.map +0 -1
  9. package/dist/src/file/fileInfo.d.ts +0 -7
  10. package/dist/src/file/fs.d.ts +0 -2
  11. package/dist/src/file/readDir.d.ts +0 -6
  12. package/dist/src/file/readFile.d.ts +0 -8
  13. package/dist/src/file/watchFile.d.ts +0 -8
  14. package/dist/src/file/writeFile.d.ts +0 -8
  15. package/dist/src/mode/subscribe.d.ts +0 -16
  16. package/dist/src/ranlog/behavior.d.ts +0 -1
  17. package/dist/src/ranlog/env.d.ts +0 -5
  18. package/dist/src/ranlog/error.d.ts +0 -2
  19. package/dist/src/ranlog/index.d.ts +0 -26
  20. package/dist/src/ranlog/performance.d.ts +0 -21
  21. package/dist/src/ranlog/report.d.ts +0 -7
  22. package/dist/src/ranlog/request.d.ts +0 -18
  23. package/dist/src/ranlog/utils.d.ts +0 -19
  24. package/dist/src/utils/filterObj.d.ts +0 -8
  25. package/dist/src/utils/str2Xml.d.ts +0 -8
  26. package/dist/src/vnode/h.d.ts +0 -6
  27. package/dist/src/vnode/hooks.d.ts +0 -23
  28. package/dist/src/vnode/htmlDomApi.d.ts +0 -33
  29. package/dist/src/vnode/init.d.ts +0 -2
  30. package/dist/src/vnode/is.d.ts +0 -5
  31. package/dist/src/vnode/modules/attributes.d.ts +0 -8
  32. package/dist/src/vnode/modules/class.d.ts +0 -8
  33. package/dist/src/vnode/modules/index.d.ts +0 -7
  34. package/dist/src/vnode/modules/listeners.d.ts +0 -14
  35. package/dist/src/vnode/modules/props.d.ts +0 -8
  36. package/dist/src/vnode/modules/style.d.ts +0 -14
  37. package/dist/src/vnode/vnode.d.ts +0 -31
  38. package/src/astParser/Parser.ts +0 -654
  39. package/src/astParser/Tokenizer.ts +0 -447
  40. package/src/astParser/nodeTypes.ts +0 -194
  41. package/src/astParser/utils.ts +0 -27
  42. package/src/babel/parser.ts +0 -10
  43. package/src/colors/fmt.ts +0 -29
  44. package/src/colors/isColorSupported.ts +0 -13
  45. package/src/file/appendFile.ts +0 -29
  46. package/src/file/fileInfo.ts +0 -22
  47. package/src/file/fs.ts +0 -9
  48. package/src/file/readDir.ts +0 -18
  49. package/src/file/readFile.ts +0 -26
  50. package/src/file/watchFile.ts +0 -31
  51. package/src/file/writeFile.ts +0 -38
  52. package/src/mode/subscribe.ts +0 -89
  53. package/src/ran/commit.ts +0 -0
  54. package/src/ran/dom.ts +0 -0
  55. package/src/ran/hooks.ts +0 -0
  56. package/src/ran/reconcile.ts +0 -0
  57. package/src/ran/schedule.ts +0 -0
  58. package/src/ranlog/behavior.ts +0 -5
  59. package/src/ranlog/console.ts +0 -16
  60. package/src/ranlog/env.ts +0 -29
  61. package/src/ranlog/error.ts +0 -11
  62. package/src/ranlog/performance.ts +0 -65
  63. package/src/ranlog/report.ts +0 -33
  64. package/src/ranlog/request.ts +0 -60
  65. package/src/ranlog/utils.ts +0 -92
  66. package/src/ranpack/ast/Declaration.ts +0 -120
  67. package/src/ranpack/ast/Node.ts +0 -7
  68. package/src/ranpack/ast/Reference.ts +0 -32
  69. package/src/ranpack/ast/Scope.ts +0 -80
  70. package/src/ranpack/bundle.ts +0 -50
  71. package/src/ranpack/graph.ts +0 -143
  72. package/src/ranpack/module.ts +0 -431
  73. package/src/ranpack/moduleLoader.ts +0 -73
  74. package/src/ranpack/plugins.ts +0 -70
  75. package/src/ranpack/statement.ts +0 -66
  76. package/src/ranpack/utils/buildScope.ts +0 -77
  77. package/src/ranpack/utils/findReference.ts +0 -36
  78. package/src/ranpack/utils/isFunctionDeclaration.ts +0 -41
  79. package/src/ranpack/utils/makeLegalIdentifier.ts +0 -18
  80. package/src/ranpack/utils/object.ts +0 -8
  81. package/src/ranpack/utils/resolve.ts +0 -32
  82. package/src/ranpack/utils/walk.ts +0 -66
  83. package/src/ranpack/ws.ts +0 -269
  84. package/src/server/connectType.ts +0 -9
  85. package/src/server/encodeUrl.ts +0 -46
  86. package/src/server/escapeHtml.ts +0 -46
  87. package/src/server/get.ts +0 -36
  88. package/src/server/jitter.ts +0 -77
  89. package/src/server/mimeType.ts +0 -858
  90. package/src/server/paresUrl.ts +0 -40
  91. package/src/server/send.ts +0 -89
  92. package/src/server/server.ts +0 -67
  93. package/src/server/status.ts +0 -191
  94. package/src/server/traverse.ts +0 -54
  95. package/src/server/websocket.ts +0 -200
  96. package/src/sort/bubble.ts +0 -21
  97. package/src/sort/bucket.ts +0 -11
  98. package/src/sort/count.ts +0 -10
  99. package/src/sort/heap.ts +0 -10
  100. package/src/sort/insert.ts +0 -20
  101. package/src/sort/merge.ts +0 -35
  102. package/src/sort/quick.ts +0 -50
  103. package/src/sort/radix.ts +0 -11
  104. package/src/sort/randomArray.ts +0 -21
  105. package/src/sort/select.ts +0 -23
  106. package/src/sort/shell.ts +0 -22
  107. package/src/utils/compose.ts +0 -37
  108. package/src/utils/filterObj.ts +0 -21
  109. package/src/utils/mergeObj.ts +0 -12
  110. package/src/utils/startTask.ts +0 -15
  111. package/src/utils/str2Xml.ts +0 -26
  112. package/src/utils/taskEnd.ts +0 -14
  113. package/src/vnode/h.ts +0 -108
  114. package/src/vnode/hooks.ts +0 -25
  115. package/src/vnode/htmlDomApi.ts +0 -199
  116. package/src/vnode/init.ts +0 -429
  117. package/src/vnode/is.ts +0 -17
  118. package/src/vnode/modules/attributes.ts +0 -70
  119. package/src/vnode/modules/class.ts +0 -46
  120. package/src/vnode/modules/listeners.ts +0 -123
  121. package/src/vnode/modules/props.ts +0 -41
  122. package/src/vnode/modules/style.ts +0 -118
  123. package/src/vnode/vnode.ts +0 -65
@@ -1,7 +0,0 @@
1
- interface BeaconPayload {
2
- url?: string;
3
- type?: string;
4
- payload: Record<string, unknown>;
5
- }
6
- export declare const report: ({ url, type, payload }: BeaconPayload) => boolean | undefined | void;
7
- export {};
@@ -1,18 +0,0 @@
1
- import type { Hooks } from './utils';
2
- interface Options {
3
- requestHook: Hooks;
4
- responseHook: Hooks;
5
- errorHook: Hooks;
6
- }
7
- /**
8
- * @description: fetch
9
- * @param {Partial} options
10
- */
11
- export declare const handleFetchHook: (options?: Partial<Options>) => void;
12
- /**
13
- * @description: xhr
14
- * @param {Partial} options
15
- * @return {*}
16
- */
17
- export declare const handleXhrHook: (options?: Partial<Options>) => void;
18
- export {};
@@ -1,19 +0,0 @@
1
- export declare function querystring(data?: {}): string;
2
- export declare function randomString(len?: number): string;
3
- export declare function getCookie(name: string): string;
4
- export declare function createData(params?: Record<string, unknown>): Record<string, unknown>;
5
- export declare const throttle: (fn: Function, wait?: number) => Function;
6
- export declare const Noop: () => void;
7
- export declare function changeHumpToLowerCase(str: string): string;
8
- /**
9
- * 重写对象上面的某个属性
10
- *
11
- * @export
12
- * @param {IAnyObject} source 需要被重写的对象
13
- * @param {string} name 需要被重写对象的key
14
- * @param {(...args: any[]) => any} replacement 以原有的函数作为参数,执行并重写原有函数
15
- * @param {boolean} isForced 是否强制重写(可能原先没有该属性)
16
- */
17
- export declare function replaceOld(source: any, name: string, replacement: (...args: unknown[]) => unknown, isForced?: boolean): void;
18
- export declare const isString: (obj: unknown) => boolean;
19
- export declare type Hooks = (...args: unknown[]) => void;
@@ -1,8 +0,0 @@
1
- /**
2
- * @description: 过滤对象的属性,去除对象中在list数组里面有的属性,返回一个新对象,一般是用于去除空字符和null
3
- * @param {Object} obj 传入对象
4
- * @param {Array} list 传入数组
5
- * @return {Object}
6
- */
7
- declare const filterObj: (obj: Record<string | symbol, any>, list: Array<string | symbol>) => Record<string | symbol, any>;
8
- export default filterObj;
@@ -1,8 +0,0 @@
1
- /**
2
- * @description: 传入字符串和指定的格式,将字符串转成xml
3
- * @param {string} xmlStr
4
- * @param {DOMParserSupportedType} format
5
- * @return {Document}
6
- */
7
- declare const str2Xml: (xmlStr: string, format?: DOMParserSupportedType) => HTMLElement | undefined;
8
- export default str2Xml;
@@ -1,6 +0,0 @@
1
- import type { VNode, VNodeChildren, VNodeData } from './vnode';
2
- export declare function addNS(data: VNodeData, children: Array<VNode | string | number> | undefined, sel: string | undefined): void;
3
- export declare function h(sel: string): VNode;
4
- export declare function h(sel: string, data: VNodeData | null): VNode;
5
- export declare function h(sel: string, children: VNodeChildren): VNode;
6
- export declare function h(sel: string, data: VNodeData | null, children: VNodeChildren): VNode;
@@ -1,23 +0,0 @@
1
- import type { VNode } from "./vnode";
2
- export declare type PreHook = () => any;
3
- export declare type InitHook = (vNode: VNode) => any;
4
- export declare type CreateHook = (emptyVNode: VNode, vNode: VNode) => any;
5
- export declare type InsertHook = (vNode: VNode) => any;
6
- export declare type PrePatchHook = (oldVNode: VNode, vNode: VNode) => any;
7
- export declare type UpdateHook = (oldVNode: VNode, vNode: VNode) => any;
8
- export declare type PostPatchHook = (oldVNode: VNode, vNode: VNode) => any;
9
- export declare type DestroyHook = (vNode: VNode) => any;
10
- export declare type RemoveHook = (vNode: VNode, removeCallback: () => void) => any;
11
- export declare type PostHook = () => any;
12
- export interface Hooks {
13
- pre?: PreHook;
14
- init?: InitHook;
15
- create?: CreateHook;
16
- insert?: InsertHook;
17
- prepatch?: PrePatchHook;
18
- update?: UpdateHook;
19
- postpatch?: PostPatchHook;
20
- destroy?: DestroyHook;
21
- remove?: RemoveHook;
22
- post?: PostHook;
23
- }
@@ -1,33 +0,0 @@
1
- export interface Fragment extends DocumentFragment {
2
- parent: Node | null;
3
- firstChildNode: ChildNode | null;
4
- lastChildNode: ChildNode | null;
5
- }
6
- export interface DOMAPI {
7
- createElement: (tagName: any, options?: ElementCreationOptions) => HTMLElement;
8
- createElementNS: (namespaceURI: string, qualifiedName: string, options?: ElementCreationOptions) => Element;
9
- /**
10
- * @experimental
11
- * @todo Make it required when the fragment is considered stable.
12
- */
13
- createDocumentFragment?: () => Fragment;
14
- createTextNode: (text: string) => Text;
15
- createComment: (text: string) => Comment;
16
- insertBefore: (parentNode: Node, newNode: Node, referenceNode: Node | null) => void;
17
- removeChild: (node: Node, child: Node) => void;
18
- appendChild: (node: Node, child: Node) => void;
19
- parentNode: (node: Node) => Node | null;
20
- nextSibling: (node: Node) => Node | null;
21
- tagName: (elm: Element) => string;
22
- setTextContent: (node: Node, text: string | null) => void;
23
- getTextContent: (node: Node) => string | null;
24
- isElement: (node: Node) => node is Element;
25
- isText: (node: Node) => node is Text;
26
- isComment: (node: Node) => node is Comment;
27
- /**
28
- * @experimental
29
- * @todo Make it required when the fragment is considered stable.
30
- */
31
- isDocumentFragment?: (node: Node) => node is DocumentFragment;
32
- }
33
- export declare const htmlDomApi: DOMAPI;
@@ -1,2 +0,0 @@
1
- import type { VNode } from './vnode';
2
- export declare function init(): (oldVnode: VNode | Element, vnode: VNode) => VNode;
@@ -1,5 +0,0 @@
1
- import type { VNode } from './vnode';
2
- export declare const array: (arg: any) => arg is any[];
3
- export declare const isStr: (str: unknown) => str is string;
4
- export declare function primitive(s: unknown): s is string | number;
5
- export declare function isVnode(s: any): s is VNode;
@@ -1,8 +0,0 @@
1
- import type { VNode } from '../vnode';
2
- export declare type Attrs = Record<string, string | number | boolean>;
3
- declare function updateAttrs(oldVnode: VNode, vnode: VNode): void;
4
- export declare const attributesModule: {
5
- create: typeof updateAttrs;
6
- update: typeof updateAttrs;
7
- };
8
- export {};
@@ -1,8 +0,0 @@
1
- import type { VNode } from '../vnode';
2
- export declare type Classes = Record<string, boolean>;
3
- declare function updateClass(oldVnode: VNode, vnode: VNode): void;
4
- export declare const classModule: {
5
- create: typeof updateClass;
6
- update: typeof updateClass;
7
- };
8
- export {};
@@ -1,7 +0,0 @@
1
- export declare type ModuleHook = any;
2
- export declare type Modules = {
3
- [key: string]: {
4
- [key: string]: ModuleHook;
5
- };
6
- };
7
- export declare const modules: Modules;
@@ -1,14 +0,0 @@
1
- import type { VNode } from '../vnode';
2
- declare type Listener<T> = (this: VNode, ev: T, vnode: VNode) => void;
3
- export declare type On = {
4
- [N in keyof HTMLElementEventMap]?: Listener<HTMLElementEventMap[N]> | Array<Listener<HTMLElementEventMap[N]>>;
5
- } & {
6
- [event: string]: Listener<any> | Array<Listener<any>>;
7
- };
8
- declare function updateEventListeners(oldVnode: VNode, vnode?: VNode): void;
9
- export declare const eventListenersModule: {
10
- create: typeof updateEventListeners;
11
- update: typeof updateEventListeners;
12
- destroy: typeof updateEventListeners;
13
- };
14
- export {};
@@ -1,8 +0,0 @@
1
- import type { VNode } from '../vnode';
2
- export declare type Props = Record<string, any>;
3
- declare function updateProps(oldVnode: VNode, vnode: VNode): void;
4
- export declare const propsModule: {
5
- create: typeof updateProps;
6
- update: typeof updateProps;
7
- };
8
- export {};
@@ -1,14 +0,0 @@
1
- import type { VNode } from '../vnode';
2
- export declare type VNodeStyle = Record<string, any>;
3
- declare function updateStyle(oldVnode: VNode, vnode: VNode): void;
4
- declare function forceReflow(): void;
5
- declare function applyDestroyStyle(vnode: VNode): void;
6
- declare function applyRemoveStyle(vnode: VNode, rm: () => void): void;
7
- export declare const styleModule: {
8
- pre: typeof forceReflow;
9
- create: typeof updateStyle;
10
- update: typeof updateStyle;
11
- destroy: typeof applyDestroyStyle;
12
- remove: typeof applyRemoveStyle;
13
- };
14
- export {};
@@ -1,31 +0,0 @@
1
- import type { On } from './modules/listeners';
2
- import type { Attrs } from './modules/attributes';
3
- import type { Classes } from './modules/class';
4
- import type { Props } from './modules/props';
5
- import type { VNodeStyle } from './modules/style';
6
- import type { Hooks } from "./hooks";
7
- export declare type VNodes = VNode[];
8
- export declare type VNodeChildElement = VNode | string | number;
9
- export declare type ArrayOrElement<T> = T | T[];
10
- export declare type VNodeChildren = ArrayOrElement<VNodeChildElement>;
11
- export declare type Key = string | number;
12
- export interface VNode {
13
- sel: string | undefined;
14
- data: VNodeData | undefined;
15
- children: Array<VNode | string | number> | undefined;
16
- elm: Node | undefined;
17
- text: string | number | undefined;
18
- key: Key | undefined;
19
- listener?: EventListenerOrEventListenerObject | undefined;
20
- }
21
- export interface VNodeData {
22
- props?: Props;
23
- attrs?: Attrs;
24
- class?: Classes;
25
- style?: VNodeStyle;
26
- on?: On;
27
- key?: Key;
28
- ns?: string;
29
- hook?: Hooks;
30
- }
31
- export declare function vnode(sel: string | undefined, data: any | undefined, children: Array<VNode | string | number> | undefined, text: string | number | undefined, elm: Element | Text | undefined): VNode;