Feature: Contextual package.json exports generation#4
Open
cawfeecoder wants to merge 2 commits intoatomicojs:masterfrom
0x9D-io:feature/named-index-exports
Open
Feature: Contextual package.json exports generation#4cawfeecoder wants to merge 2 commits intoatomicojs:masterfrom 0x9D-io:feature/named-index-exports
cawfeecoder wants to merge 2 commits intoatomicojs:masterfrom
0x9D-io:feature/named-index-exports
Conversation
added 2 commits
November 25, 2021 00:25
…r index.js is located under to determine whether it is the main import or a named export
Member
|
Thanks for the feature, src
|- component-1
| |- component-1.jsx
| |- component-1.test.js
| |- component-1.css
|- component-2
| |- component-2.jsx
| |- component-2.test.js
| |- component-2.cssnpx exports src/*/*.{js,jsx,ts,tsx} --main component-1 --exports{
"exports": {
".": "dist/component-1.js",
"component-2": "dist/component-2.js"
}
}It is a pattern that inherits from the Stencil development model, but I think we can add it as requested, for this we must consider the following:
it could be something like this: const parsedPath = path.parse(output);
const { name } = {
name:
parsedPath.name === "index"
? path.parse(parsedPath.dir).name
: parsedPath.name,
};when detecting the use of index as a name it moves to the sub-folder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds the ability for exports to contextually determine whether index.{js,ts,tsx,jsx} is located at the top level (i.e. src/index.) or within a sub-folder (i.e. src/button/index.) to determine what the appropriate named export should be.
In the case of a sub-folder, the export becomes "./${sub_folder}" instead of "./index" (old behavior).
This resolves #3