nonzzz / vite-plugin-cdn

replace module with CDN. work with vite.
MIT License
73 stars 5 forks source link

feat: filter empty value & support `export * from 'xzy'` #1

Closed nonzzz closed 1 year ago

nonzzz commented 1 year ago

Background

Improves & Features

Improves

Features


// a.js

export * from 'vue';

// b.js

import { ref } from 'a'

const t = ref(0)

// will be

// b.js

const t = Vue.ref(0)

We will remove export * from 'vue' in a.js.Because if others file import from a.js. According to the graph. we only transform the imported is enough :)

codecov-commenter commented 1 year ago

Codecov Report

Base: 91.33% // Head: 95.51% // Increases project coverage by +4.18% :tada:

Coverage data is based on head (6424445) compared to base (9763bb0). Patch coverage: 92.85% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1 +/- ## ========================================== + Coverage 91.33% 95.51% +4.18% ========================================== Files 1 1 Lines 150 223 +73 Branches 24 31 +7 ========================================== + Hits 137 213 +76 + Misses 13 10 -3 ``` | [Impacted Files](https://codecov.io/gh/nonzzz/vite-plugin-cdn/pull/1?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kanno) | Coverage Δ | | |---|---|---| | [src/ast.ts](https://codecov.io/gh/nonzzz/vite-plugin-cdn/pull/1/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kanno#diff-c3JjL2FzdC50cw==) | `95.51% <92.85%> (+4.18%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kanno). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kanno)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

nonzzz commented 1 year ago

Here's the latest result. I make a mistake. i think we can get imported information from rollup. But when we filter the file. we can't get the right imported information. So we should transform the export nodes. Such as ExportAllDeclaration. will load the module and set the whole exports. :)