You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- `importMeta` (`shim`): rewrite `import.meta.*` to CommonJS equivalents.
150
152
- `importMetaMain` (`shim`): gate `import.meta.main` with shimming/warning/error when Node support is too old.
151
153
- `requireMainStrategy` (`import-meta-main`): use `import.meta.main` or the realpath-based `pathToFileURL(realpathSync(process.argv[1])).href` check.
154
+
- `importMetaPrelude` (`auto`): emit a no-op `void import.meta.filename;` touch. `on` always emits; `off` never emits; `auto` emits only when helpers that reference `import.meta.*` are synthesized (e.g., `__dirname`/`__filename` in CJS→ESM, require-main shims, createRequire helpers). Useful for bundlers/transpilers that do usage-based `import.meta` polyfilling.
- `topLevelAwait` (`error`): throw, wrap, or preserve when TLA appears in CommonJS output.
154
157
- `rewriteSpecifier` (off): rewrite relative specifiers to a chosen extension or via a callback. Precedence: the callback (if provided) runs first; if it returns a string, that wins. If it returns `undefined` or `null`, the appenders still apply.
155
158
- `requireSource` (`builtin`): whether `require` comes from Node or `createRequire`.
156
159
- `cjsDefault` (`auto`): bundler-style default interop vs direct `module.exports`.
160
+
- `idiomaticExports` (`safe`): when raising CJS to ESM, attempt to synthesize `export` statements directly when it is safe. `off` always uses the helper bag; `aggressive` currently matches `safe` heuristics.
157
161
- `out`/`inPlace`: write the transformed code to a file; otherwise the function returns the transformed string only.
158
162
- CommonJS → ESM lowering will throw on `with` statements and unshadowed `eval` calls to avoid unsound rewrites.
0 commit comments