babel / babel/proposals

import.meta: (Stage 3)

Open
#10 7 comments 0 reactions 0 assignees View on GitHub
Parsing: Done Proposal Issue
Dominant language
No language data
Stars
435
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Original issue submitted by @hzoo in https://github.com/babel/babel/issues/5832

Original issue submitted by @hzoo in https://github.com/babel/babylon/issues/539

> import.meta for stage 2 (Domenic Denicola) (@domenic)

## Info
Proposed at TC39 Meeting: [May 2017](https://github.com/tc39/agendas/blob/master/2017/05.md)
Spec Repo: https://github.com/tc39/proposal-import-meta
Spec Text: https://tc39.github.io/proposal-import-meta/
Moved to Stage 3 at the Sept 2017 meeting

## Example

```js
(async () => {
const response = await fetch(new URL("../hamsters.jpg", import.meta.url));
const blob = await response.blob();

const size = import.meta.scriptElement.dataset.size || 300;

const image = new Image();
image.src = URL.createObjectURL(blob);
image.width = image.height = size;

document.body.appendChild(image);
})();
```

## Parsing

- Done in : https://github.com/babel/babylon/pull/544

## Transform
- Not sure, maybe webpack should handle? Or in node?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the TC39 proposal and spec linked in the issue, then review Babylon pull request 544 for the completed parsing work. The remaining question is whether transformation belongs in Babel, webpack, or Node; completion requires an agreed implementation scope and support for import.meta beyond parsing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.