Skip to content

Commit 39a248c

Browse files
docs: update.
1 parent 6f6af0c commit 39a248c

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Behavior notes (defaults in parentheses)
133133
- `requireSource` (`builtin`): whether `require` comes from Node or `createRequire`.
134134
- `cjsDefault` (`auto`): bundler-style default interop vs direct `module.exports`.
135135
- `out`/`inPlace`: write the transformed code to a file; otherwise the function returns the transformed string only.
136+
- CommonJS → ESM lowering will throw on `with` statements and unshadowed `eval` calls to avoid unsound rewrites.
136137
137138
See [docs/esm-to-cjs.md](docs/esm-to-cjs.md) for deeper notes on live bindings, interop helpers, top-level await behavior, and `import.meta.main` handling. For CommonJS to ESM lowering details, read [docs/cjs-to-esm.md](docs/cjs-to-esm.md).
138139
@@ -141,3 +142,4 @@ See [docs/esm-to-cjs.md](docs/esm-to-cjs.md) for deeper notes on live bindings,
141142
- Remove `@knighted/specifier` and avoid double parsing.
142143
- Emit source maps and clearer diagnostics for transform choices.
143144
- Broaden fixtures covering live-binding and top-level await edge cases across Node versions.
145+
- Benchmark scope analysis choices: compare `periscopic`, `scope-analyzer`, and `eslint-scope` on fixtures and pick the final adapter.

docs/cjs-to-esm.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Rewrites CommonJS modules to ESM when `target: 'module'` with `transformSyntax` enabled.
66
- Assumes Node 22.21+ runtime with native ESM.
77
- Skips lowering when `module` or `exports` are shadowed at module scope to avoid mis-compilation.
8+
- Throws when encountering `with` statements or unshadowed `eval` to avoid unsound rewrites.
89
- Deprecated CJS features (`require.extensions`, `module.parent`, legacy folder-as-module resolution) are left as-is.
910

1011
## Imports

docs/esm-to-cjs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Scope
44

55
- Translates ESM syntax to CommonJS when `target: 'commonjs'` with `transformSyntax` enabled.
6-
- Assumes Node 20.11+ runtime with `__filename`/`__dirname` shims supplied by the host.
6+
- Assumes Node 22.21+ runtime with `__filename`/`__dirname` shims supplied by the host (matches package engines).
77
- Keeps optional live-binding behavior via `liveBindings` (strict/loose/off).
88
- Top-level await (TLA) handling is controlled by `topLevelAwait: 'error' | 'wrap' | 'preserve'` when lowering to CommonJS.
99
- Optional import.meta.main gating via `importMetaMain: 'shim' | 'warn' | 'error'`.

0 commit comments

Comments
 (0)