diff --git a/.editorconfig b/.editorconfig index 35999a7d9ff..07e49a0e38b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,25 @@ root = true -[*.js] -indent_style=tab +[*] +indent_style = tab +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 80 + +[*.{yml,yaml,json}] +indent_style = space +indent_size = 2 + +[test/cases/parsing/bom/bomfile.{css,js}] +charset = utf-8-bom + +[test/configCases/css/no-extra-runtime-in-js/source.text] +insert_final_newline = false + +[*.md] +trim_trailing_whitespace = false + +[*.snap] +trim_trailing_whitespace = false diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 2c0a425a623..00000000000 --- a/.eslintrc +++ /dev/null @@ -1,28 +0,0 @@ -{ - "env": { - "node": true - }, - "plugins": [ - "nodeca" - ], - "rules": { - "strict": 0, - "camelcase": 0, - "curly": 0, - "indent": [0, "tab"], - "nodeca/indent": [2, "tabs", 1 ], - "eol-last": 1, - "no-shadow": 0, - "no-redeclare": 1, - "no-extra-bind": 1, - "no-empty": 0, - "no-process-exit": 1, - "no-underscore-dangle": 0, - "no-use-before-define": 0, - "no-unused-vars": 0, - "consistent-return": 0, - "no-inner-declarations": 1, - "no-loop-func": 1, - "space-before-function-paren": [2, "never"] - } -} diff --git a/.gitattributes b/.gitattributes index dd6c9a6c4f8..360694eafb6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,8 @@ * text=auto +test/statsCases/** eol=lf +test/hotCases/** eol=lf examples/* eol=lf -bin/* eol=lf \ No newline at end of file +bin/* eol=lf +*.svg eol=lf +*.css eol=lf +**/*webpack.lock.data/** -text diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..5e7c7b6d7a6 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +open_collective: webpack diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000000..3b257921146 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,24 @@ + + + + +**Do you want to request a _feature_ or report a _bug_?** + + + + + + +**What is the current behavior?** + +**If the current behavior is a bug, please provide the steps to reproduce.** + + + + + +**What is the expected behavior?** + +**If this is a feature request, what is motivation or use case for changing the behavior?** + +**Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.** diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 00000000000..de70ffd482d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,36 @@ +--- +name: Bug report +about: Create a report to help us improve +--- + + + + +# Bug report + + + + + + +**What is the current behavior?** + +**If the current behavior is a bug, please provide the steps to reproduce.** + + + + + + + + +**What is the expected behavior?** + + + + +**Other relevant information:** +webpack version: +Node.js version: +Operating System: +Additional tools: diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md new file mode 100644 index 00000000000..704020c0671 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -0,0 +1,23 @@ +--- +name: Feature request +about: Suggest an idea for this project +--- + + + +## Feature request + + + + + + + +**What is the expected behavior?** + +**What is motivation or use case for adding/changing the behavior?** + +**How should this be implemented in your opinion?** + +**Are you willing to work on this yourself?** +yes diff --git a/.github/ISSUE_TEMPLATE/Other.md b/.github/ISSUE_TEMPLATE/Other.md new file mode 100644 index 00000000000..3faf967c321 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Other.md @@ -0,0 +1,10 @@ +--- +name: Other +about: Something else +--- + + + + + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..89efe54b7d5 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,22 @@ + + + + + + +**What kind of change does this PR introduce?** + + + +**Did you add tests for your changes?** + + + +**Does this PR introduce a breaking change?** + + + +**What needs to be documented once your changes are merged?** + + + diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..7b3e3b3ec5d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,31 @@ +version: 2 +updates: + - package-ecosystem: npm + directory: "/" + schedule: + interval: daily + time: "04:00" + timezone: Europe/Berlin + open-pull-requests-limit: 20 + labels: + - dependencies + versioning-strategy: widen + groups: + dependencies: + patterns: + - "*" + exclude-patterns: + - "eslint-scope" + - "json-parse-even-better-errors" + - "strip-ansi" + - "rimraf" + - "mime-types" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: daily + time: "04:00" + timezone: Europe/Berlin + open-pull-requests-limit: 20 + labels: + - dependencies diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000000..4db2a128537 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,61 @@ +name: "Dependency Review" + +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + - name: "Dependency Review" + uses: actions/dependency-review-action@v4 + with: + allow-dependencies-licenses: "pkg:npm/@cspell/dict-en-common-misspellings, pkg:npm/flatted, pkg:npm/parse-imports, pkg:npm/prettier, pkg:npm/type-fest, pkg:npm/abbrev, pkg:npm/@pkgjs/parseargs, pkg:npm/cookie-signature" + allow-licenses: | + 0BSD, + AFL-1.1, + AFL-1.2, + AFL-2.0, + AFL-2.1, + AFL-3.0, + AGPL-3.0-only, + AGPL-3.0-or-later, + Apache-1.1, + Apache-2.0, + APSL-2.0, + Artistic-2.0, + BlueOak-1.0.0, + BSD-2-Clause, + BSD-3-Clause-Clear, + BSD-3-Clause, + BSL-1.0, + CAL-1.0, + CC-BY-3.0, + CC-BY-4.0, + CC-BY-SA-4.0, + CDDL-1.0, + CC0-1.0, + EPL-2.0, + GPL-2.0-only, + GPL-2.0-or-later, + GPL-2.0, + GPL-3.0-or-later, + ISC, + LGPL-2.0-only, + LGPL-2.1-only, + LGPL-2.1-or-later, + LGPL-2.1, + LGPL-3.0-only, + LGPL-3.0, + MIT, + MPL-2.0, + OFL-1.1, + PSF-2.0, + Python-2.0, + Python-2.0.1, + Unicode-DFS-2016, + Unlicense diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 00000000000..3d2f8b96ec2 --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,41 @@ +name: "Update examples" + +on: + schedule: + - cron: "0 0 * * 0" + +permissions: + contents: read + +jobs: + examples: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: "yarn" + - run: yarn --frozen-lockfile + - run: yarn link --frozen-lockfile || true + - run: yarn link webpack --frozen-lockfile + - run: yarn build:examples + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.PAT }} + delete-branch: true + commit-message: | + docs: update examples + title: | + docs: update examples + body: | + Update examples. + + This PR was autogenerated. + branch: update-examples diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000000..f3ca0ed4754 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,211 @@ +name: Github Actions + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: "yarn" + - run: yarn --frozen-lockfile + - name: Cache prettier result + uses: actions/cache@v4 + with: + path: ./node_modules/.cache/prettier/.prettier-cache + key: lint-prettier-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/.prettierrc.js') }} + restore-keys: lint-prettier- + - name: Cache eslint result + uses: actions/cache@v4 + with: + path: .eslintcache + key: lint-eslint-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/eslint.config.mjs') }} + restore-keys: lint-eslint- + - name: Cache cspell result + uses: actions/cache@v4 + with: + path: .cspellcache + key: lint-cspell-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/cspell.json') }} + restore-keys: lint-cspell- + - run: yarn lint + - name: Validate types using old typescript version + run: | + yarn upgrade typescript@5.0 + yarn --frozen-lockfile + yarn validate:types + validate-legacy-node: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 10.x + cache: "yarn" + # Remove `devDependencies` from `package.json` to avoid `yarn install` compatibility error + - run: node -e "const content = require('./package.json');delete content.devDependencies;require('fs').writeFileSync('package.json', JSON.stringify(content, null, 2));" + - run: yarn install --production --frozen-lockfile + benchmark: + strategy: + fail-fast: false + matrix: + shard: [1/4, 2/4, 3/4, 4/4] + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + fetch-tags: true + fetch-depth: 0 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: "yarn" + - run: yarn --frozen-lockfile + - run: yarn link --frozen-lockfile || true + - run: yarn link webpack --frozen-lockfile + - name: Run benchmarks + uses: CodSpeedHQ/action@v3 + with: + run: yarn benchmark --ci + token: ${{ secrets.CODSPEED_TOKEN }} + env: + LAST_COMMIT: 1 + NEGATIVE_FILTER: on-schedule + SHARD: ${{ matrix.shard }} + basic: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: "yarn" + - run: yarn --frozen-lockfile + - run: yarn link --frozen-lockfile || true + - run: yarn link webpack --frozen-lockfile + - run: yarn test:basic --ci + unit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: "yarn" + - run: yarn --frozen-lockfile + - run: yarn link --frozen-lockfile || true + - run: yarn link webpack --frozen-lockfile + - uses: actions/cache@v4 + with: + path: .jest-cache + key: jest-unit-${{ env.GITHUB_SHA }} + restore-keys: jest-unit-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }} + - run: yarn cover:unit --ci --cacheDirectory .jest-cache + - uses: codecov/codecov-action@v5 + with: + flags: unit + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + integration: + needs: basic + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: [10.x, 20.x, 22.x, 24.x] + part: [a, b] + include: + # Test with main branches of webpack dependencies + - os: ubuntu-latest + node-version: lts/* + part: a + use_main_branches: 1 + - os: ubuntu-latest + node-version: lts/* + part: b + use_main_branches: 1 + # Test on old Node.js versions + - os: ubuntu-latest + node-version: 18.x + part: a + - os: ubuntu-latest + node-version: 16.x + part: a + - os: ubuntu-latest + node-version: 14.x + part: a + - os: ubuntu-latest + node-version: 12.x + part: a + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + id: calculate_architecture + with: + result-encoding: string + script: | + if ('${{ matrix.os }}' === 'macos-latest' && '${{ matrix['node-version'] }}' === '10.x') { + return "x64" + } else { + return '' + } + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + architecture: ${{ steps.calculate_architecture.outputs.result }} + cache: "yarn" + # Install old `jest` version and deps for legacy node versions + - run: | + yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 coffee-loader@^1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 nyc@^15.1.0 --ignore-engines + yarn --frozen-lockfile --ignore-engines + if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' + - run: | + yarn upgrade husky@^8.0.3 lint-staged@^13.2.1 nyc@^15.1.0 coffee-loader@1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines + yarn --frozen-lockfile + if: matrix.node-version == '16.x' + - run: | + yarn upgrade cspell@^8.8.4 lint-staged@^15.2.5 --ignore-engines + yarn --frozen-lockfile + if: matrix.node-version == '18.x' + # Install main version of our deps + - run: yarn upgrade enhanced-resolve@webpack/enhanced-resolve#main loader-runner@webpack/loader-runner#main webpack-sources@webpack/webpack-sources#main watchpack@webpack/watchpack#main tapable@webpack/tapable#main + if: matrix.use_main_branches == '1' + # Install dependencies for LTS node versions + - run: yarn --frozen-lockfile + if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x' + - run: yarn link --frozen-lockfile || true + - run: yarn link webpack --frozen-lockfile + - uses: actions/cache@v4 + with: + path: .jest-cache + key: jest-integration-${{ env.GITHUB_SHA }} + restore-keys: jest-integration-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }} + - run: yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache || yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache -f + - run: yarn cover:merge + - uses: codecov/codecov-action@v5 + with: + flags: integration + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 111a805d1fd..20ee74c931a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,23 @@ /node_modules /test/js /test/browsertest/js -/benchmark/js -/benchmark/fixtures -/examples/*/js +/test/fixtures/temp-* +/test/temp +/test/ChangesAndRemovals +/test/**/dev-defaults.webpack.lock +/test/**/generated/** +/examples/**/dist +/examples/nodejs-addons/build/** +/assembly/**/*.wat +/assembly/**/*.wasm /coverage +/.nyc_output +/.jest-cache .DS_Store *.log +.idea +.vscode +.cache +.eslintcache +.cspellcache +package-lock.json diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000000..041c660c92b --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx --no-install lint-staged diff --git a/.istanbul.yml b/.istanbul.yml new file mode 100644 index 00000000000..380ddeb6d88 --- /dev/null +++ b/.istanbul.yml @@ -0,0 +1,4 @@ +instrumentation: + excludes: + - "**/*.runtime.js" + - ".github/*" diff --git a/.jsbeautifyrc b/.jsbeautifyrc deleted file mode 100644 index 79b04984674..00000000000 --- a/.jsbeautifyrc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "js": { - "allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"], - "brace_style": "collapse", - "break_chained_methods": false, - "e4x": true, - "eval_code": false, - "end_with_newline": true, - "indent_char": "\t", - "indent_level": 0, - "indent_size": 1, - "indent_with_tabs": true, - "jslint_happy": false, - "jslint_happy_align_switch_case": true, - "space_after_anon_function": false, - "keep_array_indentation": false, - "keep_function_indentation": false, - "max_preserve_newlines": 2, - "preserve_newlines": true, - "space_before_conditional": false, - "space_in_paren": false, - "unescape_strings": false, - "wrap_line_length": 0 - } -} \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000000..9cf9495031e --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..ebf1141fc83 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,39 @@ +package.json + +# Ignore some test files +test/**/*.* +!test/*.js +!test/*.cjs +!test/*.mjs +!test/**/webpack.config.js +!test/**/webpack.config.cjs +!test/**/webpack.config.mjs +!test/**/test.config.js +!test/**/test.filter.js +!test/**/errors.js +!test/**/warnings.js +!test/**/deprecations.js +!test/**/infrastructure-log.js +!test/*.md +!test/helpers/*.* +!test/benchmarkCases/**/*.mjs +test/js/**/*.* + +# Ignore some folders +benchmark/ +coverage/ + +# Ignore generated files +*.check.js +*.check.d.ts +types.d.ts +declarations/WebpackOptions.d.ts + +# Ignore precompiled schemas +schemas/**/*.check.js + +# Ignore example fixtures +examples/ +!examples/**/webpack.config.js + +.vscode/**/*.* diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 00000000000..52e3a560973 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,22 @@ +module.exports = { + printWidth: 80, + useTabs: true, + tabWidth: 2, + trailingComma: "none", + arrowParens: "avoid", + overrides: [ + { + files: "*.json", + options: { + parser: "json", + useTabs: false + } + }, + { + files: "*.{cts,mts,ts}", + options: { + parser: "typescript" + } + } + ] +}; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0900861970f..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -sudo: false -language: node_js -node_js: - - "0.10" - - "0.12" - - "iojs" -script: npm run travis -env: - - NO_WATCH_TESTS=1 - -before_install: - - '[ "${TRAVIS_NODE_VERSION}" != "0.10" ] || npm install -g npm' - -after_success: - - cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose - - cat ./coverage/coverage.json | node_modules/codecov.io/bin/codecov.io.js - - rm -rf ./coverage diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..4faf227c455 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1 @@ +[Code of Conduct](https://github.com/openjs-foundation/code-and-learn/blob/master/CODE_OF_CONDUCT.md) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 97ef8d8292c..7ade9adab17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,41 +1,83 @@ - # Contributing -Most of the time, if webpack is not working correctly for you it is a simple configuration issue. +From opening a bug report to creating a pull request: every contribution is +appreciated and welcome. If you're planning to implement a new feature or change +the api please create an issue first. This way we can ensure that your precious +work is not in vain. + +## Issues + +Most of the time, if webpack is not working correctly for you, it is a simple configuration issue. If you are still having difficulty after looking over your configuration carefully, please post -a question to [StackOverflow with the webpack tag](http://stackoverflow.com/tags/webpack). Questions -that include your webpack.config.js and relevant files are more likely to receive responses. +a question to [StackOverflow with the webpack tag](https://stackoverflow.com/tags/webpack). Questions +that include your webpack.config.js, relevant files, and the full error message are more likely to receive responses. -**If you have discovered a bug or have a feature suggestion, feel free to create an issue on Github.** +**If you have discovered a bug or have a feature suggestion, please [create an issue on GitHub](https://github.com/webpack/webpack/issues/new).** -If you have created your own loader/plugin please include it on the relevant -documentation pages: +Do you want to fix an issue? Look at the issues with a tag of [X5: work required (PR / Help Wanted)](https://github.com/webpack/webpack/labels/X5%3A%20work%20required%20%28PR%20%2F%20Help%20Wanted%29). Here are some of the key labels you may encounter: -[List of loaders](http://webpack.github.io/docs/list-of-loaders.html) -[List of plugins](http://webpack.github.io/docs/list-of-plugins.html) +- **bug**: An unexpected problem or unintended behavior. +- **enhancement**: A suggestion for a new feature or improvement. +- **question**: Requests for clarification or more information. +- **documentation**: Issues related to improving or adding documentation. -### Documentation +> **Note:** Previous references to labels such as `D0: My First Commit`, `D1: Easy`, `D2: Medium`, and `D3: Hard` have been removed as these are not currently in use. If you would like to see difficulty labels added, please open a suggestion or discuss with maintainers. -webpack is insanely feature rich and documentation is a huge time sink. We -greatly appreciate any time spent fixing typos or clarifying sections in the -documentation. +## Contributing to the webpack ecosystem +If you have created your own loader/plugin please include it on the relevant documentation pages: -## Submitting Changes +- [List of loaders](https://webpack.js.org/loaders/) or [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#loaders) +- [List of plugins](https://webpack.js.org/plugins) or [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#webpack-plugins) -From opening a bug report to creating a pull request: every contribution is -appreciated and welcome. If you're planning to implement a new feature or change -the api please create an issue first. This way we can ensure that your precious -work is not in vain. +## Setup + +[Setup your local webpack repository](_SETUP.md) + +## Submitting Changes After getting some feedback, push to your fork and submit a pull request. We may suggest some changes or improvements or alternatives, but for small changes your pull request should be accepted quickly. -Some things that will increase the chance that your pull request is accepted: +Something that will increase the chance that your pull request is accepted: + +- [Write tests](./test/README.md) +- Follow the existing coding style +- Write a [good commit message](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) +- For a major fix/feature make sure your PR has an issue and if it doesn't, please create one. This would help discussion with the community, and polishing ideas in case of a new feature. +- Make sure your PR's description contains GitHub's special keyword references that automatically close the related issue when the PR is merged. ([More info](https://github.com/blog/1506-closing-issues-via-pull-requests)) +- When you have a lot of commits in your PR, it's good practice to squash all your commits in one single commit. ([Learn how to squash here](https://davidwalsh.name/squash-commits-git)) +- For a better understanding of the folder structure and testing procedures, refer to the [Testing Documentation](./TESTING_DOCS.md). + +## Documentation + +webpack is insanely feature rich and documentation is a huge time sink. We +greatly appreciate any time spent fixing typos or clarifying sections in the +documentation. [See a list of issues with the documentation tag](https://github.com/webpack/webpack/labels/documentation), +or [check out the issues on the documentation website's repository](https://github.com/webpack/webpack.js.org/issues). + +## Types + +webpack is statically typed using JSDoc annotation and TypeScript. If you would like to export a new type which doesn't belong to a public API, then you can do so by declaring it in `webpack/lib/index.js`. + +`webpack/lib/index.js` + +```js +/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */ +``` + +Then, automatically generate the type declarations by running `yarn fix` locally, and the changes you have made will be reflected in `types.d.ts`. + +## Discussions + +Gitter is only for small questions. To discuss a subject in detail, please send a link to your forum or blog in the Gitter chat. + +## Join the development + +- Before you join development, please [set up the project](./_SETUP.md) on your local machine, run it and go through the application completely. Use any command you can find and see what it does. Explore. -* Write tests -* Follow the existing coding style -* Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) + > Don't worry ... Nothing will happen to the project or to you due to the exploring. Only thing that will happen is, you'll be more familiar with what is where and might even get some cool ideas on how to improve various aspects of the project. +- If you would like to work on an issue, drop in a comment at the issue. If it is already assigned to someone, but there is no sign of any work being done, please feel free to drop in a comment so that the issue can be assigned to you if the previous assignee has dropped it entirely. diff --git a/GOVERNANCE.md b/GOVERNANCE.md new file mode 100644 index 00000000000..6d004f58610 --- /dev/null +++ b/GOVERNANCE.md @@ -0,0 +1,3 @@ +# webpack Project Governance + +The webpack project (and organization) follows the webpack's governance model defined within [the webpack governance repository](https://github.com/webpack/governance/blob/main/README.md). diff --git a/LICENSE b/LICENSE index c4bdf1b81cc..8c11fc7289b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,4 @@ -(The MIT License) - -Copyright (c) 2012 - 2015 Tobias Koppers +Copyright JS Foundation and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/README.md b/README.md index cc369f68b23..2149c2f2126 100644 --- a/README.md +++ b/README.md @@ -1,314 +1,677 @@ -[](http://webpack.github.io) - - -[![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Downloads][downloads-image]][downloads-url] -[![NPM][nodei-image]][nodei-url] - -build -[![Build Status][travis-image]][travis-url] [![Appveyor Status][appveyor-image]][appveyor-url] [![Coverage Status][coveralls-image]][coveralls-url] - -dependencies -[![Dependency Status][david-image]][david-url] [![devDependency Status][david-dev-image]][david-dev-url] [![peerDependency Status][david-peer-image]][david-peer-url] - -donation -[![Gittip donate button][gittip-image]][gittip-url] [![Donate to sokra][donate-image]][donate-url] - - - - +
+ Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset. +
+