Skip to content

fix: keep the property name when shimming a shorthand property - #510

Merged
dsherret merged 2 commits into
denoland:mainfrom
dsherret:fix_shim_shorthand
Jul 27, 2026
Merged

fix: keep the property name when shimming a shorthand property#510
dsherret merged 2 commits into
denoland:mainfrom
dsherret:fix_shim_shorthand

Conversation

@dsherret

Copy link
Copy Markdown
Collaborator

Closes #329

An object literal shorthand property whose name is a shimmed global emitted invalid code. For example, this:

export const _internals = {
  prompt,
};

...emitted this to src/:

export const _internals = {
  dntShim.prompt,
};

...which the compiler then silently emitted as { dntShim, : .prompt, } in the output. Now the property name is kept:

export const _internals = {
  prompt: dntShim.prompt,
};

This applies to the globalThis and window replacements as well ({ window } was becoming { globalThis }, which quietly renamed the property).

Only a shorthand property is affected — a computed key, spread, or explicit key that happens to use a shimmed global still resolves the way it did before.

dsherret added 2 commits July 26, 2026 20:07
An object literal shorthand property whose name was a shimmed global
emitted invalid code (ex. `{ prompt }` became `{ dntShim.prompt }`),
which the compiler then silently emitted as garbage.

Closes denoland#329
@dsherret
dsherret merged commit 8e42209 into denoland:main Jul 27, 2026
5 checks passed
@dsherret
dsherret deleted the fix_shim_shorthand branch July 27, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Object with shim targets in the short-hand format result in invalid compilation

1 participant