今日已更新 50 条资讯 | 累计 24336 条内容
关于我们

标签:#r

找到 20572 篇相关文章

AI 资讯

# From JavaScript to Node.js: Understanding What Really Happens Behind the Scenes (Part 4.3A.1)

# Module Resolution Algorithm (Part 1): How Node.js Finds the Right Module In the previous article, we explored one of the most fascinating parts of Node.js—the hidden Module Wrapper Function. We learned that every CommonJS module is wrapped inside a function before execution, and we also discovered that require() is not a JavaScript feature. It is provided by the Node.js runtime. But a very important mystery still remains. When we write: const fs = require ( " fs " ); or const math = require ( " ./math " ); how does Node.js know where these modules are located? How does it decide whether "fs" is a built-in module or a file inside your project? Why does require("./math") work even if you don't write .js ? And what happens internally before your code starts executing? The answer lies inside one of Node.js's most important systems: The Module Resolution Algorithm Understanding this algorithm is essential because every Node.js application uses it hundreds or even thousands of times while starting. What is Module Resolution? The word resolution simply means: Finding the actual file represented by the string passed to require() . Suppose you write: require ( " ./math " ); To you, "./math" looks like a file. But for Node.js, it is initially nothing more than a string. "./math" Node cannot execute a string. It needs the real file. So its first job is to answer one question: "Which exact file should I load?" The complete process of converting the string inside require() into an actual file on disk is called Module Resolution . Why Does Node Need a Resolution Algorithm? Imagine a project like this: project/ ├── app.js ├── math.js ├── database.js ├── auth.js └── utils/ ├── logger.js └── helper.js Now look at these statements. require ( " ./math " ); require ( " ./database " ); require ( " ./utils/logger " ); require ( " fs " ); require ( " express " ); All of them look similar. But internally they are completely different. Some point to your own files. Some point to Node's bu

2026-07-24 原文 →
AI 资讯

Whack-a-drone

In Pasadena, California, there's a cute red brick courtyard where one storefront isn't like the rest. The glass doors open onto a sparse industrial hallway, which leads to a sunlit foyer with a large spiral staircase. Go up, and you'll see a typical coworking space: open tables, healthy snacks, a collection of meeting rooms with […]

2026-07-24 原文 →
AI 资讯

TikTok’s protection of minors should not be opt-in, warns EU

TikTok has attracted the ire of the European Union over its protection of children who use the video sharing platform. The European Commission announced preliminary findings today under the Digital Services Act (DSA) that offer specific issues to address. The Commission suggests that TikTok should adjust the default settings of minors' "public" accounts so the […]

2026-07-24 原文 →
AI 资讯

Golang Maps: How Swiss Tables Replaced the Old Bucket Design

A deep dive on Go 1.24’s map redesign, where the runtime moved from the classic bucket + overflow-chain model to a Swiss Table-inspired implementation: how the old map layout worked and where pointer-chasing hurt cache locality how control-byte metadata + h2 filtering changes lookup behavior why this can improve practical load factor and memory efficiency Go-specific constraints (iteration semantics, GC/runtime integration, incremental growth behavior) benchmark context: large microbench wins vs smaller full-application geomean gains trade-offs still being worked on (cold-cache and certain delete/clear-heavy paths) submitted by /u/OtherwisePush6424 [link] [留言]

2026-07-24 原文 →