上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 491 下一页
摘要: By default, git ignorecase for filename. It might happen that you change the filename from Modal.vueto modal.vue, then commit to git, in remote repo, 阅读全文
posted @ 2025-05-06 14:10 Zhentiw 阅读(11) 评论(0) 推荐(0)
摘要: type Watcher<T> = { on<K extends keyof T & string>( eventName: `${K}Changed`, callback: (oldValue: T[K], newValue: T[K]) => void ): void; }; declare f 阅读全文
posted @ 2025-05-06 14:06 Zhentiw 阅读(7) 评论(0) 推荐(0)
摘要: const get = /*#__PURE__*/ createGetter(); const readonlyGet = /*#__PURE__*/ createGetter(true); const shallowGet = /*#__PURE__*/ createGetter(false, t 阅读全文
posted @ 2025-04-08 00:55 Zhentiw 阅读(10) 评论(0) 推荐(0)
摘要: const obj = { a: 1, b: 2, c: { d: 3 } } console.log(obj.toString()) // [object Object] Using Symbol.toStringTag const obj = { a: 1, b: 2, c: { d: 3 }, 阅读全文
posted @ 2025-04-08 00:27 Zhentiw 阅读(12) 评论(0) 推荐(0)
摘要: Using T extends any ? {...} : never helps to see the type result Example: type DeepReadonly<T extends Record<string, any>> = T extends any ? { readonl 阅读全文
posted @ 2025-04-05 19:47 Zhentiw 阅读(13) 评论(0) 推荐(0)
摘要: 框架设计的权衡 框架设计里面到处体现了权衡的艺术。 在框架设计之初,我们的最初的构想往往是“既要....又要....”,但是往往现实是非常残酷的, 因此我们需要处处作出权衡。 框架的设计应该将其设计为命令式还是声明式 ? 框架需要设计成纯运行时还是纯编译时,还是设计为运行时 + 编译时 ? 这里只是 阅读全文
posted @ 2025-04-05 19:11 Zhentiw 阅读(18) 评论(0) 推荐(0)
摘要: 本文将带着大家使用 Node.js 快速制作一个 cli 工具,主要包含以下内容: 搭建 cli 整体框架 完善 cli 命令 搭建 cli 整体框架 首先,在桌面上新建一个 cli 工程目录 mycli,npm init -y 进行初始化,如下: cd desktop mkdir mycli cd 阅读全文
posted @ 2025-04-05 19:10 Zhentiw 阅读(87) 评论(0) 推荐(0)
摘要: 生成 JavaScript AST 我们要对整个模板的 AST 进行转换,转换为 JS AST。 我们目前的代码已经有了遍历模板 AST,并且针对不同的节点,做不同操作的能力。 我们首先需要知道 JS AST 长什么样子: function render(){ return null; } 上面的代 阅读全文
posted @ 2025-03-30 22:12 Zhentiw 阅读(17) 评论(0) 推荐(0)
摘要: 转换器 主要的目的是将模板的 AST 转换为 JS 的 AST,整个模板的编译过程如下: // Vue 的模板编译器 function compile(template) { // 1. 得到模板的 AST const ast = parse(template); // 2. 将模板 AST 转为 阅读全文
posted @ 2025-03-29 19:47 Zhentiw 阅读(34) 评论(0) 推荐(0)
摘要: 模板编译整体流程 首先我们看一下什么是编译? 所谓编译(Compile),指的是将语言 A 翻译成语言 B,语言 A 就被称之为源码(source code),语言 B 就被称之为目标代码(target code),这个事情谁来做?编译器来做。编译器你也不用想得那么神秘,就是一段程序而已。 完整的编 阅读全文
posted @ 2025-03-29 19:33 Zhentiw 阅读(60) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 491 下一页