mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-08 08:44:37 +08:00
- redeclaring an inherited field WITH an initializer lowers as the [[Define]]-equivalent assignment into the base slot at the subclass's field-init position (builtin Error prefix included — prettier's errors.js `name = "ConfigError"`); bare and type-changing redeclares keep sharpened fences (corpus 2428, diagnostics inheritance re-record)
- object destructuring of CLASS instances desugars to one member read per element, left to right: fields read slots, accessors call getters through the fieldGetExpr dispatch, renames/parameter patterns/defaults included (corpus 2429 — prettier's AstPath { previous, next })
- an object literal missing an 'unknown' field completes with the DOM undefined (the absent-property read's answer), at literal completion and in the record width relation (corpus 2430 — prettier's getFileInfo(file, {}))
- node:module joins the supported builtins prefix-only as an admit-then-fence surface: createRequire keeps a per-member fence that defers to a catchable runtime error in JS sources (diagnostics create-require pins the hint naming the pattern)
11 lines
563 B
TypeScript
11 lines
563 B
TypeScript
// node:module ADMITS (the builtin import carries no evaluation), and every
|
|
// member keeps a per-site fence: createRequire loads CommonJS from disk at
|
|
// RUNTIME (prettier's config/plugin loading), which a compiled program —
|
|
// whose modules are fixed at build time — cannot do. In TS sources the
|
|
// fence is this compile-time diagnostic; in JS sources the same call
|
|
// defers to a catchable runtime error naming the member.
|
|
import { createRequire } from "node:module";
|
|
|
|
const req = createRequire("/tmp/parent.js");
|
|
console.log(String(req("./config.cjs")));
|