├── .eslintrc.json ├── .github ├── labeler.yml ├── pull_request_template.md └── workflows │ ├── health-check.yml │ ├── pr-labeler.yml │ ├── release.yml │ ├── stale.yml │ └── tests.yml ├── .gitignore ├── .npmignore ├── .npmrc ├── CHANGELOG.md ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── __fixtures__ ├── Component.jsx ├── ComponentGlobal.jsx ├── root.scss └── styles.css ├── __tests__ ├── .eslintrc.json └── loader.spec.js ├── commitlint.config.js ├── loader.js ├── package-lock.json ├── package.json └── purgecss-loader.png /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "amex" 3 | } 4 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | one-app-team-review-requested: 2 | - '**/*' 3 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Description 4 | 5 | 6 | ## Motivation and Context 7 | 8 | 9 | 10 | ## How Has This Been Tested? 11 | 12 | 13 | 14 | 15 | ## Types of Changes 16 | 17 | - [ ] Bug fix (non-breaking change which fixes an issue) 18 | - [ ] New feature (non-breaking change which adds functionality) 19 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 20 | - [ ] Documentation (adding or updating documentation) 21 | - [ ] Dependency update 22 | 23 | ## Checklist: 24 | 25 | 26 | - [ ] My change requires a change to the documentation and I have updated the documentation accordingly. 27 | - [ ] My changes are in sync with the code style of this project. 28 | - [ ] There aren't any other open Pull Requests for the same issue/update. 29 | - [ ] These changes should be applied to a maintenance branch. 30 | - [ ] I have added the Apache 2.0 license header to any new files created. 31 | 32 | ## What is the Impact to Developers Using Purgecss-Loader? 33 | 34 | -------------------------------------------------------------------------------- /.github/workflows/health-check.yml: -------------------------------------------------------------------------------- 1 | name: Health Check 2 | 3 | on: 4 | schedule: 5 | # At minute 0 past hour 0800 and 2000. 6 | - cron: '0 8,20 * * *' 7 | 8 | jobs: 9 | tests: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | node: [ '16.x' ] 14 | name: Node ${{ matrix.node }} 15 | steps: 16 | - uses: actions/checkout@v2 17 | - run: | 18 | git remote set-branches --add origin main 19 | git fetch 20 | - name: Setup Node 21 | uses: actions/setup-node@v1 22 | with: 23 | node-version: ${{ matrix.node }} 24 | - name: Install Dependencies 25 | run: npm ci 26 | env: 27 | NODE_ENV: development 28 | - name: Run Test Script 29 | run: npm run test 30 | env: 31 | NODE_ENV: production 32 | -------------------------------------------------------------------------------- /.github/workflows/pr-labeler.yml: -------------------------------------------------------------------------------- 1 | name: "Pull Request Labeler" 2 | on: 3 | pull_request_target: 4 | types: [opened, reopened] 5 | 6 | jobs: 7 | triage: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/labeler@v3 11 | with: 12 | repo-token: "${{ secrets.GITHUB_TOKEN }}" -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | prepare: 10 | runs-on: ubuntu-latest 11 | if: "! contains(github.event.head_commit.message, '[skip ci]')" 12 | steps: 13 | - run: echo "${{ github.event.head_commit.message }}" 14 | release: 15 | needs: prepare 16 | name: Release 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v2 21 | with: 22 | persist-credentials: false 23 | - name: Setup Node.js 24 | uses: actions/setup-node@v1 25 | with: 26 | node-version: 18 27 | - name: Install dependencies 28 | run: npm ci 29 | - name: Release 30 | env: 31 | GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} 32 | GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} 33 | GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} 34 | GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }} 35 | GITHUB_TOKEN: ${{ secrets.PA_TOKEN }} 36 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 37 | run: npx semantic-release 38 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Mark stale issues and pull requests 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * *' 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/stale@v3 13 | with: 14 | repo-token: ${{ secrets.GITHUB_TOKEN }} 15 | stale-issue-message: 'This issue is stale because it has been open 30 days with no activity.' 16 | stale-pr-message: 'This pull request is stale because it has been open 30 days with no activity.' 17 | stale-issue-label: 'stale-issue' 18 | exempt-issue-labels: 'enhancement,documentation,good-first-issue,question' 19 | stale-pr-label: 'stale-pr' 20 | exempt-pr-labels: 'work-in-progress' 21 | days-before-stale: 30 22 | days-before-close: -1 23 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | tests: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | node: [ '16.x', '18.x' ] 14 | name: Node ${{ matrix.node }} 15 | steps: 16 | - uses: actions/checkout@v2 17 | - run: | 18 | git remote set-branches --add origin main 19 | git fetch 20 | - name: Setup Node 21 | uses: actions/setup-node@v1 22 | with: 23 | node-version: ${{ matrix.node }} 24 | - name: Install Dependencies 25 | run: npm ci 26 | env: 27 | NODE_ENV: development 28 | - name: Unit Tests 29 | run: npm run test:unit 30 | env: 31 | NODE_ENV: production 32 | - name: Git History Test 33 | run: npm run test:git-history 34 | env: 35 | NODE_ENV: production 36 | - name: Lockfile Lint Test 37 | run: npm run test:lockfile 38 | env: 39 | NODE_ENV: production 40 | - name: Lint 41 | run: npm run test:lint 42 | env: 43 | NODE_ENV: production 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | *.swp 4 | *.log 5 | node_modules 6 | test-results 7 | .jest-cache 8 | *.tgz -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | test-results 2 | __tests__ 3 | CODEOWNERS 4 | .travis.yml 5 | .eslintrc.json 6 | *.tgz 7 | .jest-cache 8 | commitlint.config.js 9 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [4.0.0](https://github.com/americanexpress/purgecss-loader/compare/v3.0.0...v4.0.0) (2023-05-01) 2 | 3 | 4 | * Feat/upgrade purgecss to version 4 (#63) ([2a847fa](https://github.com/americanexpress/purgecss-loader/commit/2a847fafde567b2746fad60a410f134f48cba209)), closes [#63](https://github.com/americanexpress/purgecss-loader/issues/63) [#62](https://github.com/americanexpress/purgecss-loader/issues/62) 5 | 6 | 7 | ### BREAKING CHANGES 8 | 9 | * various whitelist options replaced with safelist 10 | 11 | Co-authored-by: Scott McIntyre 12 | 13 | * chore(update-eslint): upgrade eslint related deps and update test format 14 | 15 | * feat(purgecss): upgrade to purgecss4 16 | 17 | * feat(purgecss): add to gitignore 18 | 19 | * feat(purgecss): fix gitignore 20 | 21 | # [3.0.0](https://github.com/americanexpress/purgecss-loader/compare/v2.0.0...v3.0.0) (2023-02-27) 22 | 23 | 24 | ### Features 25 | 26 | * **node:** update support for node 16 ([#51](https://github.com/americanexpress/purgecss-loader/issues/51)) ([e183819](https://github.com/americanexpress/purgecss-loader/commit/e18381955542313e32655f6abdeacf0af6d48ca4)) 27 | 28 | 29 | ### BREAKING CHANGES 30 | 31 | * **node:** drop support for node 8, 10, 12, 14 32 | 33 | # [2.0.0](https://github.com/americanexpress/purgecss-loader/compare/v1.0.0...v2.0.0) (2020-04-28) 34 | 35 | 36 | ### chore 37 | 38 | * **travis:** remove node 6 from travis config ([c6360fc](https://github.com/americanexpress/purgecss-loader/commit/c6360fcc6258c47172960c81cd2d083e957d2517)) 39 | 40 | 41 | ### Features 42 | 43 | * **loader:** upgrade purgecss version ([#9](https://github.com/americanexpress/purgecss-loader/issues/9)) ([44886a3](https://github.com/americanexpress/purgecss-loader/commit/44886a3c4d57b7b71dca6601f5fcdd6a2c499713)) 44 | 45 | 46 | ### Reverts 47 | 48 | * Revert "chore(release): 1.0.0 " (#12) ([f79e503](https://github.com/americanexpress/purgecss-loader/commit/f79e5038025f3ff91ec25c0507ba42bb0581db7c)), closes [#12](https://github.com/americanexpress/purgecss-loader/issues/12) 49 | 50 | 51 | ### BREAKING CHANGES 52 | 53 | * **travis:** drop support for node 6 54 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://help.github.com/en/articles/about-code-owners 2 | 3 | * @americanexpress/one-app-team @americanexpress/one-amex-admins 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ### American Express Open Source Community Guidelines 2 | 3 | #### Last Modified: January 29, 2016 4 | 5 | Welcome to the American Express Open Source Community on GitHub! These American Express Community Guidelines outline our expectations for Github participating members within the American Express community, as well as steps for reporting unacceptable behavior. We are committed to providing a welcoming and inspiring community for all and expect our community Guidelines to be honored. 6 | 7 | **IMPORTANT REMINDER:** 8 | 9 | When you visit American Express on any third party sites such as GitHub your activity there is subject to that site’s then current terms of use., along with their privacy and data security practices and policies. The Github platform is not affiliated with us and may have practices and policies that are different than are our own. 10 | Please note, American Express is not responsible for, and does not control, the GitHub site’s terms of use, privacy and data security practices and policies. You should, therefore, always exercise caution when posting, sharing or otherwise taking any action on that site and, of course, on the Internet in general. 11 | Our open source community strives to: 12 | - **Be friendly and patient**. 13 | - **Be welcoming**: We strive to be a community that welcomes and supports people of all 14 | backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, color, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability. 15 | - **Be considerate**: Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language. 16 | - **Be respectful**: Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. 17 | - **Be careful in the words that we choose**: We are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. 18 | - **Try to understand why we disagree**: Disagreements, both social and technical, happen all the time. It is important that we resolve disagreements and differing views constructively. Remember that we’re all different people. The strength of our community comes from its diversity, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes. 19 | 20 | ### Definitions 21 | Harassment includes, but is not limited to: 22 | - Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, neuro(a)typicality, physical appearance, body size, race, age, regional discrimination, political or religious affiliation 23 | - Unwelcome comments regarding a person’s lifestyle choices and practices, including those related to food, health, parenting, drugs, and employment 24 | - Deliberate misgendering. This includes deadnaming or persistently using a pronoun that does not correctly reflect a person's gender identity. You must address people by the name they give you when not addressing them by their username or handle 25 | - Physical contact and simulated physical contact (eg, textual descriptions like “hug” or “backrub”) without consent or after a request to stop 26 | - Threats of violence, both physical and psychological 27 | - Incitement of violence towards any individual, including encouraging a person to commit suicide 28 | or to engage in self-harm 29 | - Deliberate intimidation 30 | - Stalking or following 31 | - Harassing photography or recording, including logging online activity for harassment purposes 32 | - Sustained disruption of discussion 33 | - Unwelcome sexual attention, including gratuitous or off-topic sexual images or behaviour 34 | - Pattern of inappropriate social contact, such as requesting/assuming inappropriate levels of 35 | intimacy with others 36 | - Continued one-on-one communication after requests to cease 37 | - Deliberate “outing” of any aspect of a person’s identity without their consent except as necessary 38 | to protect others from intentional abuse 39 | - Publication of non-harassing private communication 40 | 41 | Our open source community prioritizes marginalized people’s safety over privileged people’s comfort. We will not act on complaints regarding: 42 | - ‘Reverse’ -isms, including ‘reverse racism,’ ‘reverse sexism,’ and ‘cisphobia’ 43 | - Reasonable communication of boundaries, such as “leave me alone,” “go away,” or “I’m not 44 | discussing this with you” 45 | - Refusal to explain or debate social justice concepts 46 | - Communicating in a ‘tone’ you don’t find congenial 47 | - Criticizing racist, sexist, cissexist, or otherwise oppressive behavior or assumptions 48 | 49 | ### Diversity Statement 50 | We encourage everyone to participate and are committed to building a community for all. Although we will fail at times, we seek to treat everyone both as fairly and equally as possible. Whenever a participant has made a mistake, we expect them to take responsibility for it. If someone has been harmed or offended, it is our responsibility to listen carefully and respectfully, and do our best to right the wrong. 51 | 52 | Although this list cannot be exhaustive, we explicitly honor diversity in age, gender, gender identity or expression, culture, ethnicity, language, national origin, political beliefs, profession, race, religion, sexual orientation, socioeconomic status, and technical ability. We will not tolerate discrimination based on any of the protected characteristics above, including participants with disabilities. 53 | 54 | ### Reporting Issues 55 | If you experience or witness unacceptable behavior—or have any other concerns—please report it by contacting us at opensource@aexp.com. All reports will be handled with discretion. In your report please include: 56 | - Your contact information. 57 | - Names (real, nicknames, or pseudonyms) of any individuals involved. If there are additional 58 | witnesses, please include them as well. Your account of what occurred, and if you believe the incident is ongoing. If there is a publicly available record (e.g. a mailing list archive or a public IRC logger), please include a link. 59 | - Any additional information that may be helpful. 60 | 61 | After filing a report, a representative of our community will contact you personally, review the incident, follow up with any additional questions, and make a decision as to how to respond. If the person who is harassing you is part of the response team, they will recuse themselves from handling your incident. If the complaint originates from a member of the response team, it will be handled by a different member of the response team. We will respect confidentiality requests for the purpose of protecting victims of abuse. 62 | 63 | ### Removal of Posts 64 | We will not review every comment or post, but we reserve the right to remove any that violates these Guidelines or that, in our sole discretion, we otherwise consider objectionable and we may ban offenders from our community. 65 | 66 | ### Suspension/Termination/Reporting to Authority 67 | In certain instances, we may suspend, terminate or ban certain repeat offenders and/or those committing significant violations of these Guidelines. When appropriate, we may also, on our own or as required by the GitHub terms of use, be required to refer and/or work with GitHub and/or the appropriate authorities to review and/or pursue certain violations. 68 | 69 | ### Attribution & Acknowledgements 70 | These Guidelines have been adapted from the [Code of Conduct of the TODO group](http://todogroup.org/opencodeofconduct/). They are subject to revision by American Express and may be revised from time to time. 71 | 72 | Thank you for your participation! 73 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | The following guidelines must be followed by all contributors to this repository. Please review them carefully and do not hesitate to ask for help. 4 | 5 | ### Code of Conduct 6 | 7 | * Review and test your code before submitting a pull request. 8 | * Be kind and professional. Avoid assumptions; oversights happen. 9 | * Be clear and concise when documenting code; focus on value. 10 | * Don't commit commented code to the main repo (stash locally, if needed). 11 | 12 | ### Git Commit Guidelines 13 | 14 | We follow precise rules for git commit message formatting. These rules make it easier to review commit logs and improve contextual understanding of code changes. This also allows us to auto-generate the CHANGELOG from commit messages. 15 | 16 | Each commit message consists of a **header**, **body** and **footer**. 17 | 18 | #### Header 19 | 20 | The header is required and must not exceed 70 characters to ensure it is well-formatted in common git tools. It has a special format that includes a *type*, *scope* and *subject*: 21 | 22 | Syntax: 23 | 24 | ```bash 25 | (): 26 | ``` 27 | 28 | #### Type 29 | 30 | The *type* should always be lowercase as shown below. 31 | 32 | ##### Allowed `` values: 33 | 34 | * **feat** (new feature for the user) 35 | * **fix** (bug fix for the user, not a fix to build scripts) 36 | * **docs** (changes to documentation) 37 | * **style** (formatting, missing semi colons, etc; no functional code change) 38 | * **refactor** (refactoring production code, eg. renaming a variable) 39 | * **test** (adding missing tests, refactoring tests; no production code change) 40 | * **chore** (updating build/env/packages, etc; no production code change) 41 | 42 | #### Scope 43 | 44 | The *scope* describes the affected code. The descriptor may be a route, component, feature, utility, etc. It should be one word or camelCased, if needed: 45 | 46 | ```bash 47 | feat(transactions): added column for quantity 48 | feat(BalanceModule): initial setup 49 | ``` 50 | 51 | The commit headers above work well if the commit affects many parts of a larger feature. If changes are more specific, it may be too broad. To better clarify specific scopes, you should use a `feature/scope` syntax: 52 | 53 | ```bash 54 | fix(transaction/details): missing quantity field 55 | ``` 56 | 57 | The above syntax helps reduce verbosity in the _subject_. In comparison, consider the following example: 58 | 59 | ```bash 60 | fix(transaction): missing quantity field in txn details 61 | ``` 62 | 63 | Another scenario for scope is using a `route/scope` (or `context/scope`) syntax. This would be useful when a commit only affects a particular instance of code that is used in multiple places. 64 | 65 | *Example*: Transactions may be shown in multiple routes/contexts, but a bug affecting transaction actions may only exist under the "home" route, possibly related to other code. In such cases, you could use the following format: 66 | 67 | ```bash 68 | fix(home/transactions): txn actions not working 69 | ``` 70 | 71 | This header makes it clear that the fix is limited in scope to transactions within the home route/context. 72 | 73 | #### Subject 74 | 75 | Short summary of the commit. Avoid redundancy and simplify wording in ways that do not compromise understanding. 76 | 77 | Good: 78 | 79 | ```bash 80 | $ git commit -m "fix(nav/link): incorrect URL for Travel" 81 | ``` 82 | 83 | Bad: 84 | 85 | ```bash 86 | $ git commit -m "fix(nav): incorrect URL for Travel nav item :P" 87 | ``` 88 | 89 | > Note that the _Bad_ example results in a longer commit header. This is partly attributed to the scope not being more specific and personal expression tacked on the end. 90 | 91 | **Note regarding subjects for bug fixes:** 92 | 93 | Summarize _what is fixed_, rather than stating that it _is_ fixed. The _type_ ("fix") already specifies the state of the issue. 94 | 95 | For example, don't do: 96 | 97 | ```bash 98 | $ git commit -m "fix(nav): corrected Travel URL" 99 | ``` 100 | 101 | Instead, do: 102 | 103 | ```bash 104 | $ git commit -m "fix(nav): broken URL for Travel" 105 | ``` 106 | 107 | 108 | #### Body and Footer (optional) 109 | 110 | The body and footer should wrap at 80 characters. 111 | 112 | The **body** describes the commit in more detail and should not be more than 1 paragraph (3-5 sentences). Details are important, but too much verbosity can inhibit understanding and productivity -- keep it clear and concise. 113 | 114 | The **footer** should only reference Pull Requests or Issues associated with the commit. 115 | 116 | For bug fixes that address open issues, the footer should be formatted like so: 117 | 118 | ```bash 119 | Closes #17, #26 120 | ``` 121 | and for Pull Requests, use the format: 122 | 123 | ```bash 124 | Related #37 125 | ``` 126 | 127 | If a commit is associated with issues and pull requests, use the following format: 128 | 129 | ```bash 130 | Closes #17, #26 131 | Related #37 132 | ``` 133 | > Issues should always be referenced before pull requests, as shown above. 134 | 135 | #### Piecing It All Together 136 | 137 | Below is an example of a full commit message that includes a header, body and footer: 138 | 139 | ```bash 140 | refactor(nav/item): added prop (isActive) 141 | 142 | NavItem now supports an "isActive" property. This property is used to control the styling of active navigation links. 143 | 144 | Closes #21 145 | ``` -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2018 American Express Travel Related Services Company, Inc. 190 | 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | [One App is now InnerSource](https://github.com/americanexpress/one-app/issues/1393) 4 | 5 |
6 | 7 | purgecss-loader - One Amex 8 |

9 | 10 | [![npm version](https://badge.fury.io/js/%40americanexpress%2Fpurgecss-loader.svg)](https://badge.fury.io/js/%40americanexpress%2Fpurgecss-loader) 11 | 12 | > This [Webpack](https://github.com/webpack/webpack) loader uses [purgecss](https://github.com/FullHuman/purgecss) 13 | to strip unused selectors from your CSS. 14 | 15 | ## 📖 Table of Contents 16 | 17 | * [Features](#-features) 18 | * [Usage](#-usage) 19 | * [API](#%EF%B8%8F-api) 20 | * [License](#%EF%B8%8F-license) 21 | * [Code Of Conduct](#%EF%B8%8F-code-of-conduct) 22 | * [Contributing](#-contributing) 23 | 24 | ## ✨ Features 25 | 26 | * Ability to remove CSS modules 27 | * Ability to remove plain CSS declarations 28 | * Reduce bundle size 29 | 30 | ## 🤹‍ Usage 31 | 32 | ``` 33 | npm install -D @americanexpress/purgecss-loader 34 | ``` 35 | 36 | ## 🎛️ API 37 | 38 | ### Configure as follows: 39 | 40 | ```js 41 | module.exports = { 42 | entry: {...}, 43 | output: {...}, 44 | module: { 45 | rules: [ 46 | { 47 | test: /\.css$/, 48 | use: [ 49 | { 50 | loader: 'css-loader', 51 | options: { 52 | modules: true, 53 | localIdentName: '[name]__[local]___[hash:base64:5]', 54 | }, 55 | }, 56 | { 57 | loader: '@americanexpress/purgecss-loader', 58 | options: { 59 | paths: [path.join(somePath, 'src/**/*.{js,jsx}')], 60 | safelist: [/:global$/], 61 | }, 62 | }, 63 | ], 64 | }, 65 | ], 66 | }, 67 | } 68 | ``` 69 | 70 | You should use this with the [`css-loader`](https://github.com/webpack-contrib/css-loader) 71 | as seen above. However, it is not required that you use CSS modules. That is in 72 | the example to express this loader's compatibility. 73 | 74 | ### Options 75 | 76 | | Property | Description | Required | 77 | |-----------------|-----------------------------------|----------| 78 | | `paths` | An array of file [glob] patterns | `true` | 79 | | `extractors` | An array of [purgecss extractors] | `false` | 80 | | `fontFace` | `boolean` (default: false) see [options] | `false` | 81 | | `keyframes` | `boolean` (default: false) see [options] | `false` | 82 | | `variables` | `boolean` (default: false) see [options] | `false` | 83 | | `safelist` | `UserDefinedSafelist` see [options]| `false` | 84 | | `blocklist` | `StringRegExpArray` see [options] | `false` | 85 | 86 | [glob]: https://github.com/isaacs/node-glob 87 | [purgecss extractors]: https://www.purgecss.com/extractors.html 88 | [options]: https://purgecss.com/configuration.html#options 89 | 90 | ## 🗝️ License 91 | 92 | Any contributions made under this project will be governed by the 93 | [Apache License 2.0](./LICENSE.txt). 94 | 95 | ## 🗣️ Code of Conduct 96 | 97 | This project adheres to the [American Express Community Guidelines](./CODE_OF_CONDUCT.md). 98 | By participating, you are expected to honor these guidelines. 99 | 100 | ## 🏆 Contributing 101 | 102 | We welcome Your interest in the American Express Open Source Community on Github. 103 | Any Contributor to any Open Source Project managed by the American Express Open 104 | Source Community must accept and sign an Agreement indicating agreement to the 105 | terms below. Except for the rights granted in this Agreement to American Express 106 | and to recipients of software distributed by American Express, You reserve all 107 | right, title, and interest, if any, in and to Your Contributions. Please [fill 108 | out the Agreement](https://cla-assistant.io/americanexpress/purgecss-loader). 109 | 110 | Please feel free to open pull requests and see [CONTRIBUTING.md](./CONTRIBUTING.md) 111 | for commit formatting details. 112 | -------------------------------------------------------------------------------- /__fixtures__/Component.jsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 American Express Travel Related Services Company, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | // eslint-disable-next-line import/no-unresolved, import/extensions 16 | import React from 'react'; 17 | import styles from './styles.css'; 18 | 19 | export default () =>

Hello, world

; 20 | -------------------------------------------------------------------------------- /__fixtures__/ComponentGlobal.jsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 American Express Travel Related Services Company, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | // eslint-disable-next-line import/no-unresolved, import/extensions 16 | import React from 'react'; 17 | import './root.scss'; 18 | 19 | export default () =>

Hello, world

; 20 | -------------------------------------------------------------------------------- /__fixtures__/root.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 American Express Travel Related Services Company, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | :global { 16 | .isUsed { 17 | color: #00175a; 18 | } 19 | .isNotUsed { 20 | color: red; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /__fixtures__/styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 American Express Travel Related Services Company, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | .isUsed { 16 | color: red; 17 | } 18 | 19 | .isNotUsed { 20 | color: black; 21 | } 22 | -------------------------------------------------------------------------------- /__tests__/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "amex/test" 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/loader.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 American Express Travel Related Services Company, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | const path = require('path'); 16 | const webpack = require('webpack'); 17 | const MemoryFs = require('memory-fs'); 18 | const findIndex = require('lodash/findIndex'); 19 | 20 | const crypto = require('crypto'); 21 | 22 | // Monkey Patch for unsupported hash algo. Needed to support Node >=17. 23 | // https://github.com/webpack/webpack/issues/13572#issuecomment-923736472 24 | const originalCreateHash = crypto.createHash; 25 | crypto.createHash = (algo) => originalCreateHash(algo === 'md4' ? 'sha256' : algo); 26 | 27 | jest.setTimeout(10000); 28 | 29 | const runLoader = (safelist, 30 | { 31 | entry = '../__fixtures__/Component.jsx', 32 | } = {}) => { 33 | const compiler = webpack({ 34 | context: __dirname, 35 | entry, 36 | output: { 37 | path: path.resolve(__dirname), 38 | }, 39 | module: { 40 | rules: [ 41 | { 42 | test: /\.jsx?$/, 43 | use: [{ 44 | loader: 'babel-loader', 45 | options: { 46 | presets: [ 47 | 'babel-preset-env', 48 | 'babel-preset-react', 49 | ], 50 | }, 51 | }], 52 | }, 53 | { 54 | test: /\.s?css$/, 55 | use: [ 56 | { loader: 'style-loader' }, 57 | { 58 | loader: 'css-loader', 59 | options: { 60 | modules: true, 61 | localIdentName: '[name]__[local]___[hash:base64:5]', 62 | }, 63 | }, 64 | { 65 | loader: path.resolve(__dirname, '../loader.js'), 66 | options: { 67 | paths: [path.resolve(__dirname, '../__fixtures__/**/*.{js,jsx}')], 68 | safelist, 69 | }, 70 | }, 71 | ], 72 | }, 73 | ], 74 | }, 75 | externals: { 76 | react: { 77 | var: 'React', 78 | commonjs2: 'react', 79 | }, 80 | }, 81 | }); 82 | 83 | compiler.outputFileSystem = new MemoryFs(); 84 | 85 | return new Promise((resolve, reject) => { 86 | compiler.run((err, stats) => { 87 | if (err) reject(err); 88 | 89 | resolve(stats); 90 | }); 91 | }); 92 | }; 93 | 94 | describe('purgecss loader', () => { 95 | it('should strip unused classes', async () => { 96 | const stats = await runLoader(); 97 | const { modules } = stats.toJson(); 98 | const cssModuleIndex = findIndex(modules, { 99 | name: '../node_modules/css-loader??ref--5-1!../loader.js??ref--5-2!../__fixtures__/styles.css', 100 | }); 101 | const output = modules[cssModuleIndex].source; 102 | expect(output).not.toContain('isNotUsed'); 103 | expect(output).toContain('isUsed'); 104 | }); 105 | 106 | it('should not strip safelisted global classes', async () => { 107 | const componentEntry = { entry: '../__fixtures__/ComponentGlobal.jsx' }; 108 | const stats = await runLoader([/:global$/], componentEntry); 109 | const { modules } = stats.toJson(); 110 | const cssModuleIndex = findIndex(modules, { 111 | name: '../node_modules/css-loader??ref--5-1!../loader.js??ref--5-2!../__fixtures__/root.scss', 112 | }); 113 | const output = modules[cssModuleIndex].source; 114 | expect(output).not.toContain('isNotUsed'); 115 | expect(output).toContain('isUsed'); 116 | }); 117 | }); 118 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 American Express Travel Related Services Company, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 13 | * or implied. See the License for the specific language governing 14 | * permissions and limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | extends: ['@commitlint/config-conventional'], 19 | rules: { 20 | 'scope-case': [2, 'always', ['pascal-case', 'camel-case', 'kebab-case']], 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /loader.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 American Express Travel Related Services Company, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | const { PurgeCSS } = require('purgecss'); 16 | const { getOptions } = require('loader-utils'); 17 | 18 | module.exports = async function purifyCssLoader(content) { 19 | const { 20 | paths, extractors = [], fontFace = false, keyframes = false, variables = false, safelist = [], 21 | blocklist = [], 22 | } = getOptions(this); 23 | const purgeCSSResult = await new PurgeCSS().purge({ 24 | content: paths, 25 | css: [{ raw: content }], 26 | extractors, 27 | fontFace, 28 | keyframes, 29 | variables, 30 | safelist, 31 | blocklist, 32 | }); 33 | return purgeCSSResult[0].css; 34 | }; 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@americanexpress/purgecss-loader", 3 | "version": "4.0.0", 4 | "description": "Webpack loader for removing unused CSS", 5 | "main": "loader.js", 6 | "scripts": { 7 | "prepare": "npm test", 8 | "test": "npm run test:lint && npm run test:unit", 9 | "test:lint": "eslint ./ --ignore-path .gitignore --ext .js", 10 | "test:lockfile": "lockfile-lint -p package-lock.json -t npm -a npm -o https: -c -i", 11 | "test:git-history": "commitlint --from origin/main --to HEAD", 12 | "test:unit": "jest", 13 | "posttest": "npm run test:git-history && npm run test:lockfile" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "git+https://github.com/americanexpress/purgecss-loader.git" 18 | }, 19 | "keywords": [ 20 | "webpack-loader", 21 | "purgecss", 22 | "remove", 23 | "unused", 24 | "css" 25 | ], 26 | "jest": { 27 | "testEnvironment": "node", 28 | "preset": "amex-jest-preset", 29 | "coveragePathIgnorePatterns": [ 30 | "/commitlint.config.js" 31 | ] 32 | }, 33 | "author": "Jamie King (https://github.com/10xLaCroixDrinker)", 34 | "license": "Apache-2.0", 35 | "bugs": { 36 | "url": "https://github.com/americanexpress/purgecss-loader/issues" 37 | }, 38 | "homepage": "https://github.com/americanexpress/purgecss-loader#readme", 39 | "dependencies": { 40 | "loader-utils": "^1.4.2", 41 | "purgecss": "^4.1.3" 42 | }, 43 | "devDependencies": { 44 | "@babel/core": "^7.10.1", 45 | "@commitlint/cli": "^17.6.5", 46 | "@commitlint/config-conventional": "^17.8.1", 47 | "@semantic-release/changelog": "^6.0.3", 48 | "@semantic-release/commit-analyzer": "^10.0.4", 49 | "@semantic-release/git": "^10.0.1", 50 | "@semantic-release/github": "^9.2.1", 51 | "@semantic-release/npm": "^10.0.6", 52 | "@semantic-release/release-notes-generator": "^11.0.7", 53 | "amex-jest-preset": "^7.0.0", 54 | "babel-eslint": "^10.1.0", 55 | "babel-loader": "^7.1.4", 56 | "babel-preset-env": "^1.6.1", 57 | "babel-preset-react": "^6.24.1", 58 | "css-loader": "^0.28.11", 59 | "eslint": "^8.39.0", 60 | "eslint-config-amex": "^16.0.0", 61 | "eslint-plugin-jest": "^27.6.0", 62 | "eslint-plugin-jest-dom": "^4.0.3", 63 | "husky": "^3.1.0", 64 | "jest": "^29.4.3", 65 | "lockfile-lint": "^4.3.7", 66 | "lodash": "^4.17.5", 67 | "memory-fs": "^0.4.1", 68 | "semantic-release": "^21.1.2", 69 | "style-loader": "^0.21.0", 70 | "webpack": "^4.6.0" 71 | }, 72 | "husky": { 73 | "hooks": { 74 | "pre-commit": "npm test", 75 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" 76 | } 77 | }, 78 | "release": { 79 | "branches": [ 80 | "+([0-9])?(.{+([0-9]),x}).x", 81 | "main", 82 | "next", 83 | "next-major", 84 | { 85 | "name": "beta", 86 | "prerelease": true 87 | }, 88 | { 89 | "name": "alpha", 90 | "prerelease": true 91 | } 92 | ], 93 | "plugins": [ 94 | "@semantic-release/commit-analyzer", 95 | "@semantic-release/release-notes-generator", 96 | "@semantic-release/changelog", 97 | "@semantic-release/npm", 98 | "@semantic-release/git", 99 | "@semantic-release/github" 100 | ] 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /purgecss-loader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/americanexpress/purgecss-loader/fdd45e195d45c9a2689f0d726c72af940db8ea5f/purgecss-loader.png --------------------------------------------------------------------------------