usedexports | Find in Go exported variables that could be

 by   jgautheron Go Version: Current License: MIT

kandi X-RAY | usedexports Summary

kandi X-RAY | usedexports Summary

usedexports is a Go library. usedexports has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Find exported variables (const, var, func, struct) in Go that could be unexported. The Go Challenge #5 sparked the idea of detecting unused exports. My goal with usedexports is to report on unused exports for a local application, and not scan the whole GOPATH.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              usedexports has a low active ecosystem.
              It has 27 star(s) with 2 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 4 have been closed. On average issues are closed in 155 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of usedexports is current.

            kandi-Quality Quality

              usedexports has 0 bugs and 2 code smells.

            kandi-Security Security

              usedexports has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              usedexports code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              usedexports is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              usedexports releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.
              It has 248 lines of code, 10 functions and 1 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed usedexports and discovered the below as its top functions. This is intended to give you an instant insight into usedexports implemented functionality, and help decide if they suit your requirements.
            • parseUsedExports parses a directory in the given directory
            • Visit invokes ast . Visitor .
            • parseExports walks the given directory .
            • main . go
            • parseTree recursively walks the tree rooted at the given path .
            • getImportPath returns the absolute path to use for codebase
            • printOutput prints exported export declarations .
            • usage prints a usage message .
            Get all kandi verified functions for this library.

            usedexports Key Features

            No Key Features are available at this moment for usedexports.

            usedexports Examples and Code Snippets

            No Code Snippets are available at this moment for usedexports.

            Community Discussions

            QUESTION

            Webpack5 does not seem to tree-shake unused exports
            Asked 2022-Mar-31 at 15:43

            I set up a small project with the following files

            ...

            ANSWER

            Answered 2022-Mar-31 at 15:43

            I figured it out myself, auto-answer for the record :

            The tsconfig.json was wrong, it wasn't preserving the ES6 module syntaxe so webpack couldn't treeshake properly.

            More details on the correct configuration (optionally including Babel too) can be found here

            Source https://stackoverflow.com/questions/71679366

            QUESTION

            Why isn't webpack tree-shaking swiperjs modules?
            Asked 2022-Feb-08 at 18:17

            So, swiperjs, from docs:

            "By default Swiper exports only core version without additional modules (like Navigation, Pagination, etc.). So you need to import and configure them too:"

            ...

            ANSWER

            Answered 2022-Feb-08 at 18:17

            I've found out the issue: with swiper (at least), sideEffects option must be used at loader level and not at package level. Or maybe you can use at package level, but explicitly declaring the files. Didn't try though. Instead, it did worked by setting sideEffects like this:

            Source https://stackoverflow.com/questions/71031894

            QUESTION

            @fluentui/icons not showing in page
            Asked 2021-Nov-23 at 16:10

            recently I cleaned up the webpack configuration in a project in order to make it more maintainable, I did so by splitting the configuration in two files:

            ...

            ANSWER

            Answered 2021-Nov-23 at 16:10

            Well, I was able to figure out the problem, the problematic lines were:

            Source https://stackoverflow.com/questions/70025331

            QUESTION

            Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema
            Asked 2021-Oct-16 at 19:21

            In running yarn run build I am running into the following error:

            ...

            ANSWER

            Answered 2021-Oct-16 at 19:21

            I think it is case sensitive, ie. change the D to a d, change moduleIDs to moduleIds.

            Source https://stackoverflow.com/questions/69597768

            QUESTION

            Why is material ui build so big
            Asked 2021-Sep-11 at 04:17

            I'm trying to get Material-ui to tree-shake correctly. The bundle is extremely large compared to what I'm actually using. I'm not using most of the components listed by the analyzer plugin below and I'm importing everything like it says on the material-ui docs. For example here is what it looks like in one of my files.

            ...

            ANSWER

            Answered 2021-Sep-11 at 04:17

            It looks like this happens with material-ui when you build in development. The production build tree-shakes correctly. Weirdly though, material-ui's own docs claim that if you do the direct file import, the dev build should tree-shake correctly too.

            Source https://stackoverflow.com/questions/69137884

            QUESTION

            webpack not bundling scss when using import instead of require
            Asked 2021-Sep-04 at 07:59

            Simple webpack setup, when I use import to load my scss it is completely missing from the bundle. The line where the import should be is simply missing. When I use require instead, it works.

            optimization: {usedExports: true} is not the problem, I tried with and without

            mini-css-extract-plugin also did not work.

            when I put a typo in the scss it complains, so it is parsed but simply not bundled in the end?

            index.js

            ...

            ANSWER

            Answered 2021-Sep-04 at 07:59

            I found the problem but I don't understand why webpack drops it.

            Quote from https://webpack.js.org/guides/tree-shaking/

            Note that any imported file is subject to tree shaking. This means if you use something like css-loader in your project and import a CSS file, it needs to be added to the side effect list so it will not be unintentionally dropped in production mode:

            In my package.json I put

            Source https://stackoverflow.com/questions/68966512

            QUESTION

            React + Webpack 5 + Babel 7 IE11 issue -- not attaching to root
            Asked 2021-Aug-16 at 15:32

            I have been scouring the internet for solution after solution and nothing seems to be working for me so I'm requesting help.

            Issue: No matter what I do, I can't get anything inside my root div. There are no console errors at all in IE11. The app works fine on chrome, ff, & safari.

            Dependencies / Versions

            • "react": "^17.0.2",
            • "@babel/core": "^7.14.6",
            • "babel-loader": "^8.2.2",
            • "core-js": "^3.8.0",
            • "webpack": "^5.41.1",

            index.js

            ...

            ANSWER

            Answered 2021-Aug-16 at 15:32

            I didn't need the browserlist in package.json nor webpack.config.js, I did however need the target: ['web','es5'] in my webpack.config.js. My issue was this & the suggestion from @matthiasgiger -- even though I had set modules to false for my output environment, removing the type="module" was they key

            Source https://stackoverflow.com/questions/68672773

            QUESTION

            Why does Webpack 5 include my unused TypeScript enum exports, even when Tree Shaking is enabled?
            Asked 2021-Aug-11 at 03:08

            My TypeScript enums are defined like this, as in this file:

            ...

            ANSWER

            Answered 2021-Aug-10 at 06:32

            This is due to Terser being unable to reason about the side-effects in your colors.ts enum, so Terser keeps all three definitions even though it only exports one of them.

            If these weren't transpiled TypeScript enums, I'd recommend to simplify the declarations, ideally by marking each function /*#__PURE__*/ and making it return its intended value. However, since they are TypeScript enums, you might need to convert them to object literals as const, are certainly easier for Terser to reason about and are likely sufficient for your needs.

            If I'm reading your output right, the arrays you're trying to remove are present in both development and runtime builds; you've omitted them with "..." but they're there.

            According to your package.json you are using both sideEffects and usedExports of Webpack's tree-shaking feature set. sideEffects correctly asserts that you aren't changing anything aside from your exports, so Webpack can safely skip your whole module if your project consumes none of its exports. However, usedExports might not be as smart as you would hope:

            usedExports relies on terser to detect side effects in statements. It is a difficult task in JavaScript and not as effective as straightforward sideEffects flag. It also can't skip subtree/dependencies since the spec says that side effects need to be evaluated.

            It seems that for both development and production Webpack is smart enough to detect that your HueColors is the only export you consume, but Terser is not smart enough to determine that each self-initializing IIFE is free of side-effects that would affect the others. Technically, as a human, I can't reason about it either: Some other piece of code might have changed the Object or Array prototype in a bizarre way, even if your functions didn't use inline assignment or modify same-named shadowed variables of an enclosing scope in your IIFEs.

            With an in-browser copy of terser I've been able to reproduce your problem.

            First of all, switching to const object literals would be completely effective:

            Source https://stackoverflow.com/questions/68720866

            QUESTION

            Reconciling antd import with postcss
            Asked 2021-Jul-15 at 15:14

            I am trying to use postcss-env-function in order to be able to share variables between javascript and less/css. I get the following error during build. The error disappears if I remove the first line of index.less:

            @import '~antd/dist/antd.less';

            However, then I will not get antd's styles. (There is no error also if I remove postcss-loader). How to solve this issue?

            Minimal repository

            Error:

            ...

            ANSWER

            Answered 2021-Jul-12 at 23:26

            It seems that it is a syntax error regarding your opacity. The most common styles use objects so that you would declare opacity as:

            Source https://stackoverflow.com/questions/68200691

            QUESTION

            Typescript targeting es2017 throws error "You may need an appropriate loader" but project builds fine with es5
            Asked 2021-Jul-12 at 14:13

            We have a typescript react 'main' project. In the package.json is a dependency on another internal library that we use. The 'main' project builds fine when both projects targeted es5, but changing to es2017 throws the following error:

            You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.

            It throws this error for all the files that declare enums in the dependent project.

            This is the tsconfig.json file for the main project:

            ...

            ANSWER

            Answered 2021-Jul-12 at 14:13

            2 thing led me to the solution. First of all:

            The bable.config.json file has:

            "@babel/preset-react"

            which causes babel to "remove typescript types". Ref here. Removing it gets rid of the errors, since obviously all types are removed (but obviously babel cannot then process JSX).

            Thus I realised that the enum files are ambient, and babel-loader (specifically preset-react) doesn't know how to process them (unlike tsc).

            That led me to to this SO question, and I realized I had to specifically tell babel-loader where to find the enum files, and so added this to my package.json:

            Source https://stackoverflow.com/questions/68287691

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install usedexports

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/jgautheron/usedexports.git

          • CLI

            gh repo clone jgautheron/usedexports

          • sshUrl

            git@github.com:jgautheron/usedexports.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link