06 2025 档案
摘要:通过前面的代码,其实我们已经完成了从模板AST到Javascript AST的转换 const ast = parse(template); transform(ast); 那接下来,我们只需要再根据Javascript AST生成具体的js代码就行了,比如再执行下面的函数: generate(as
阅读全文
摘要:我们现在已经有了模板AST,那么根据之前的顺序,我们现在需要把模板AST转化为JSAST。 要知道,模板AST是对模板的描述,那么JSAST就是对JS代码的描述。 也就是说,我们最终希望得到的代码是下面这样的: function render(){ return h('div',[ h('p','V
阅读全文
摘要:在转换AST节点的过程中,往往需要根据其子节点的情况来决定如何对当前节点进行转换,这就要求父节点的转换操作必须等待其所有子节点全部转换完毕之后再执行。 但是我们现在设计的转换流程并不支持这个能力,我们是从根节点开始,顺序往下执行的流程,如下图: 当一个节点被处理时,意味着它的子节点已经被处理完毕了,
阅读全文
摘要:For example, we have following code doing AST transform from templateAST to Javascript AST function traverseNode(ast) { const currentNode = ast; // If
阅读全文
摘要:const template = "<p>Vue</p>"; const State = { initial: 1, // init state tagOpen: 2, tagName: 3, text: 4, tagEnd: 5, tagEndName: 6, }; function isAlph
阅读全文
摘要:https://risingstars.js.org/2024/en 2024 年最流行,最火热的项目排名 shadcnui:This is NOT a component library. It's a collection of re-usable components that you can
阅读全文
摘要:从上到下按照规则比较,直到能得到确切结果为止: 两端类型相同,比较值 两端存在 NaN,返回 false undefined 和 null 只有与自身比较,或者互相比时,才会返回 true 两端都是原始类型,转换成数字比较 一端是原始类型,一端是对象类型,把对象转换成原始类型后进入第 1 步 对象如
阅读全文
摘要:You’re seeing that const scores = {} satisfies Record<string,number> does check at compile-time “hey, {} can be a Record<string,number>”, but it doesn
阅读全文
摘要:In Vue 3’s reactivity engine (as of v3.5), globalVersion is a single, ever‐incrementing counter that bumps whenever any reactive value changes. Each c
阅读全文
摘要:For example when you open a overlay to play video, and you want to disable background page scrolling playBtn.onclick = function() { // ... video.play(
阅读全文
摘要:https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API 1. Video screenshot blocking when you render video through a DRM‐prote
阅读全文
摘要:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/try function fetchData() { if (Math.random() < 0.5) throw new
阅读全文
摘要:export const enum ShapeFlags { ELEMENT = 1, FUNCTIONAL_COMPONENT = 1 << 1, //2 STATEFUL_COMPONENT = 1 << 2, //4 TEXT_CHILDREN = 1 << 3, //8 ARRAY_CHIL
阅读全文
摘要:monorepo工程基本格式 pnpm-workspace.yaml 指定工程管理目录 packages: - "packages/**" 这里配置之后,我们在安装第三方包的时候,就需要指定安装参数,如果是全局安装,就需要指定-w或者--workspace-root 安装全局第三方包 注意:为了ts
阅读全文
摘要:Greedy approach: function LIS(nums) { if (nums.length 0) return []; // 先取得第一项 const results = [[nums[0]]]; for (let i = 1; i < nums.length; i++) { con
阅读全文
摘要:概述 JavaScript 中所有位运算都会先将操作数通过 ToInt32 转为 32 位有符号整数(补码),再按位进行计算。常用于标志位管理、快速取整、高效色彩处理等场景。 常见运算符 运算符 名称 说明 & 按位与 两位都为 1 时,结果为 1 | 按位或 任一位为 1 时,结果为 1 ^ 按位
阅读全文
摘要:Manually staging files, writing commit messages, committing, and syncing to Git involves multiple repetitive steps. This lesson demonstrates how to si
阅读全文
摘要:In development we often want to test out features we are building but can only do so with deployed or staging applications or setting up Ngrok or Clou
阅读全文
摘要:Planning complex application logic or workflows before coding can be challenging. This lesson demonstrates how to leverage Cursor's AI (Chat and Agent
阅读全文
摘要:Writing clear and effective prompts or rules for AI (.mdc files in Cursor) can be tricky. Your instructions might start out clumsy or ambiguous, leadi
阅读全文
摘要:We have new Arrayin Javascript const arr1 = new Array(3) // create an empty array with lengh 3 const arr2 = new Array(1,2,3) // create an array with v
阅读全文

浙公网安备 33010602011771号