gajus / gajus/create-index

Support creating index with default export

Open
#61 9 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
277
Forks
86
PR merge metrics
No merged PRs in 30d

Description

Currently, this plugin only supports creating an index with named exports. I need an index file with a default-exported object.

Example:

```js
import foo from './foo.js';
import bar from './bar.js';
import _3_x_recommended from './3-x-recommended.js'; // note unsafe variable name needs to be tweaked

export default {
foo,
bar,
'3-x-recommended': _3_x_recommended
};
```

I see this functionality is in a forked version of this tool: https://github.com/tjjfvi/create-index-better#modes

> // @create-index {"mode":"default{}"}
>
> import foo from './foo.js';
> import bar from './bar.js';
> export default { foo, bar };

Has it been considered for the original `create-index`? @tjjfvi would you consider upstreaming this functionality (and presumably any other improvements from the fork)?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing index-generation behavior and the fork's documented "default{}" mode. Trace how named exports and unsafe imported names are handled, then define completion against the provided example: generate a default-exported object with valid local identifiers and the requested property names.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.