Compare commits

...

31 Commits

Author SHA1 Message Date
Jan Amann da41fc545d
Merge 0c0da3a205 into 9f98d803c0 2025-10-06 14:11:53 +08:00
Alexander Akait 9f98d803c0
fix: javascript parser options types (#19980)
Github Actions / lint (push) Has been cancelled Details
Github Actions / validate-legacy-node (push) Has been cancelled Details
Github Actions / benchmark (1/4) (push) Has been cancelled Details
Github Actions / benchmark (2/4) (push) Has been cancelled Details
Github Actions / benchmark (3/4) (push) Has been cancelled Details
Github Actions / benchmark (4/4) (push) Has been cancelled Details
Github Actions / basic (push) Has been cancelled Details
Github Actions / unit (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Has been cancelled Details
Update examples / examples (push) Has been cancelled Details
2025-10-04 14:58:38 +03:00
dependabot[bot] 8804459884
chore(deps): bump CodSpeedHQ/action from 4.0.1 to 4.1.0 (#19977)
Bumps [CodSpeedHQ/action](https://github.com/codspeedhq/action) from 4.0.1 to 4.1.0.
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](653fdc30e6...3959e9e296)

---
updated-dependencies:
- dependency-name: CodSpeedHQ/action
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-04 13:32:45 +03:00
Alexander Akait bc91301142
chore: update codespeed (#19959) 2025-10-04 13:26:48 +03:00
Alexander Akait e1afcd4cc2
test: stability and avoid extra output (#19974)
Github Actions / lint (push) Has been cancelled Details
Github Actions / validate-legacy-node (push) Has been cancelled Details
Github Actions / benchmark (1/4) (push) Has been cancelled Details
Github Actions / benchmark (2/4) (push) Has been cancelled Details
Github Actions / benchmark (3/4) (push) Has been cancelled Details
Github Actions / benchmark (4/4) (push) Has been cancelled Details
Github Actions / basic (push) Has been cancelled Details
Github Actions / unit (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Has been cancelled Details
2025-10-02 21:55:56 +03:00
Alexander Akait d45073a2b3
fix: dynamic import support in workers using browserslist (#19972) 2025-10-02 19:19:35 +03:00
Alexander Akait 568bb1d789
fix: types (#19971) 2025-10-02 18:26:16 +03:00
fregante 11144e4eec
fix: support web workers loading for jsonp format 2025-10-02 17:00:39 +03:00
Alexander Akait b6c781a0f1
fix: support `extends` with env for `browserslist` (#19964)
Github Actions / lint (push) Has been cancelled Details
Github Actions / validate-legacy-node (push) Has been cancelled Details
Github Actions / benchmark (1/4) (push) Has been cancelled Details
Github Actions / benchmark (2/4) (push) Has been cancelled Details
Github Actions / benchmark (3/4) (push) Has been cancelled Details
Github Actions / benchmark (4/4) (push) Has been cancelled Details
Github Actions / basic (push) Has been cancelled Details
Github Actions / unit (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Has been cancelled Details
2025-10-01 20:12:27 +03:00
Kevin Brey 3c08fd105c
fix(warnings): update import.meta warning messages for clarity (#19961)
Github Actions / lint (push) Waiting to run Details
Github Actions / validate-legacy-node (push) Waiting to run Details
Github Actions / benchmark (1/4) (push) Waiting to run Details
Github Actions / benchmark (2/4) (push) Waiting to run Details
Github Actions / benchmark (3/4) (push) Waiting to run Details
Github Actions / benchmark (4/4) (push) Waiting to run Details
Github Actions / basic (push) Waiting to run Details
Github Actions / unit (push) Waiting to run Details
Github Actions / integration (10.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Blocked by required conditions Details
2025-09-30 17:32:35 +03:00
Alexander Akait f508e8b705
chore: pin memfs for old node.js version (#19963) 2025-09-30 17:32:09 +03:00
Alexander Akait 5c11f27b6b
chore(deps): update (#19960)
Github Actions / lint (push) Waiting to run Details
Github Actions / validate-legacy-node (push) Waiting to run Details
Github Actions / benchmark (1/4) (push) Waiting to run Details
Github Actions / benchmark (2/4) (push) Waiting to run Details
Github Actions / benchmark (3/4) (push) Waiting to run Details
Github Actions / benchmark (4/4) (push) Waiting to run Details
Github Actions / basic (push) Waiting to run Details
Github Actions / unit (push) Waiting to run Details
Github Actions / integration (10.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Blocked by required conditions Details
2025-09-30 12:55:30 +03:00
alexander-akait 14c813a0b3 chore(release): 5.102.0
Github Actions / lint (push) Waiting to run Details
Github Actions / validate-legacy-node (push) Waiting to run Details
Github Actions / benchmark (1/4) (push) Waiting to run Details
Github Actions / benchmark (2/4) (push) Waiting to run Details
Github Actions / benchmark (3/4) (push) Waiting to run Details
Github Actions / benchmark (4/4) (push) Waiting to run Details
Github Actions / basic (push) Waiting to run Details
Github Actions / unit (push) Waiting to run Details
Github Actions / integration (10.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Blocked by required conditions Details
2025-09-29 21:24:41 +03:00
hai-x 761b153060
feat: support function matcher in rule options (#19952)
Github Actions / lint (push) Waiting to run Details
Github Actions / validate-legacy-node (push) Waiting to run Details
Github Actions / benchmark (1/4) (push) Waiting to run Details
Github Actions / benchmark (2/4) (push) Waiting to run Details
Github Actions / benchmark (3/4) (push) Waiting to run Details
Github Actions / benchmark (4/4) (push) Waiting to run Details
Github Actions / basic (push) Waiting to run Details
Github Actions / unit (push) Waiting to run Details
Github Actions / integration (10.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Blocked by required conditions Details
2025-09-29 21:22:46 +03:00
Gengkun 8c0fa9e9dc
feat: tree shaking nested exports for destructuring assignment (#19955) 2025-09-29 19:43:22 +03:00
dependabot[bot] 0a58530ef4
chore(deps): bump actions/dependency-review-action from 4.7.3 to 4.8.0 (#19958)
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.7.3 to 4.8.0.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](595b5aeba7...56339e523c)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-version: 4.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-29 19:18:52 +03:00
hai-x 042bf86cf8
fix: integrity in http-url test (#19954) 2025-09-29 19:17:35 +03:00
Alexander Akait d9121b39a1
docs: use markdown instead html (#19938)
Github Actions / lint (push) Waiting to run Details
Github Actions / validate-legacy-node (push) Waiting to run Details
Github Actions / benchmark (1/4) (push) Waiting to run Details
Github Actions / benchmark (2/4) (push) Waiting to run Details
Github Actions / benchmark (3/4) (push) Waiting to run Details
Github Actions / benchmark (4/4) (push) Waiting to run Details
Github Actions / basic (push) Waiting to run Details
Github Actions / unit (push) Waiting to run Details
Github Actions / integration (10.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (10.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (20.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (22.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, macos-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (24.x, windows-latest, b) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Blocked by required conditions Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Blocked by required conditions Details
2025-09-26 19:27:11 +03:00
Alexander Akait 3f00777e67
docs: remove unused files (#19937) 2025-09-26 16:51:33 +03:00
Even Stensberg 3cf0d95e86
chore: add lfx badge (#19934) 2025-09-26 15:19:55 +03:00
Gengkun 84e5c129d1
fix: should analyze correct variable for dynamic import (#19936) 2025-09-26 15:17:26 +03:00
Ulises Gascón 44cf16f2eb
docs: Revise security policy and reporting guidelines (#19886) 2025-09-25 15:23:26 +03:00
dependabot[bot] a9c6c3d203
chore(deps): bump actions/cache from 4.2.4 to 4.3.0 (#19932)
Bumps [actions/cache](https://github.com/actions/cache) from 4.2.4 to 4.3.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0400d5f644...0057852bfa)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 4.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-25 15:23:01 +03:00
Gengkun 45d47c608a
fix: should always walk import then arguments (#19933) 2025-09-25 15:22:37 +03:00
Alexander Akait f6c3c24da3
feat: added support for import file from "./file.ext" with { type: "bytes" } to get the content as `Uint8Array` (#19928) 2025-09-24 21:01:10 +03:00
Jack Works c647cf193c
fix: deferred modules define order and transitive deferred module not emitted correctly in concatenated modules 2025-09-23 23:33:02 +03:00
Gengkun 73cecf5e78
feat: static analyze destructuring assignment dynamic import variable for tree shaking (#19925) 2025-09-23 20:52:59 +03:00
hai-x ae52500e95
fix: `assetsByChunkName` should also included assets from `chunk.auxiliaryFiles` (#19921) 2025-09-23 20:30:13 +03:00
Alexander Akait 19f5693ebc
docs: update examples (#19923) 2025-09-23 20:28:03 +03:00
Jan Amann 0c0da3a205 Change top-level await usage to not export directly. 2020-10-30 15:15:38 +01:00
Jan Amann 21012d4327 Add failing test. 2020-10-30 14:59:05 +01:00
180 changed files with 5555 additions and 1505 deletions

View File

@ -21,5 +21,11 @@ trim_trailing_whitespace = false
[test/cases/parsing/bom/bomfile.{css,js}]
charset = utf-8-bom
[test/configCases/asset-modules/bytes/file.text]
insert_final_newline = false
[test/configCases/asset-modules/bytes/file.svg]
insert_final_newline = false
[test/configCases/css/no-extra-runtime-in-js/source.text]
insert_final_newline = false

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
open_collective: webpack

View File

@ -1,24 +0,0 @@
<!-- Please don't delete this template or we'll close your issue -->
<!-- Before creating an issue please make sure you are using the latest version of webpack. -->
<!-- Also consider trying the webpack@beta version, maybe it's already fixed. -->
**Do you want to request a _feature_ or report a _bug_?**
<!-- Please ask questions on StackOverflow or the GitHub Discussions. -->
<!-- https://github.com/webpack/webpack/discussions -->
<!-- https://stackoverflow.com/questions/ask?tags=webpack -->
<!-- Issues which contain questions or support requests will be closed. -->
**What is the current behavior?**
**If the current behavior is a bug, please provide the steps to reproduce.**
<!-- A great way to do this is to provide your configuration via a GitHub gist. -->
<!-- Best provide a minimal reproducible repo -->
<!-- If your issue is caused by a plugin or loader file the issue on the plugin/loader repo -->
**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.**

View File

@ -1,36 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
---
<!-- Please don't delete this template because we'll close your issue -->
<!-- Before creating an issue please make sure you are using the latest version of webpack. -->
# Bug report
<!-- Please ask questions on StackOverflow or the GitHub Discussions. -->
<!-- https://github.com/webpack/webpack/discussions -->
<!-- https://stackoverflow.com/questions/ask?tags=webpack -->
<!-- Issues which contain questions or support requests will be closed. -->
**What is the current behavior?**
**If the current behavior is a bug, please provide the steps to reproduce.**
<!-- A great way to do this is to provide your configuration via a GitHub repository -->
<!-- The most helpful is a minimal reproduction with instructions on how to reproduce -->
<!-- Repositories with too many files or large `webpack.config.js` files are not suitable -->
<!-- Please only add small code snippets directly into this issue -->
<!-- https://gist.github.com is a good place for longer code snippets -->
<!-- If your issue is caused by a plugin or loader, please create an issue on the loader/plugin repository instead -->
**What is the expected behavior?**
<!-- "It should work" is not a helpful explanation -->
<!-- Explain exactly how it should behave -->
**Other relevant information:**
webpack version:
Node.js version:
Operating System:
Additional tools:

View File

@ -1,23 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
---
<!-- Please don't delete this template or we'll close your issue -->
## Feature request
<!-- Issues that contain questions or support requests will be closed. -->
<!-- Before creating an issue please make sure you are using the latest version of webpack. -->
<!-- Check if this feature needs to be implemented in a plugin or loader instead -->
<!-- If yes: file the issue on the plugin/loader repo -->
<!-- Features related to the development server should be filed on this repo instead -->
**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

View File

@ -1,10 +0,0 @@
---
name: Other
about: Something else
---
<!-- Bug reports and Feature requests must use other templates, or will be closed -->
<!-- Please ask questions on StackOverflow or the GitHub Discussions. -->
<!-- https://github.com/webpack/webpack/discussions -->
<!-- https://stackoverflow.com/questions/ask?tags=webpack -->
<!-- Issues which contain questions or support requests will be closed. -->

View File

@ -1,22 +0,0 @@
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. -->
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
<!-- Try to link to an open issue for more information. -->
<!-- In addition to that please answer these questions: -->
**What kind of change does this PR introduce?**
<!-- E.g. a bugfix, feature, refactoring, build related change, etc… -->
**Did you add tests for your changes?**
<!-- Note that we won't merge your changes if you don't add tests -->
**Does this PR introduce a breaking change?**
<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->
**What needs to be documented once your changes are merged?**
<!-- List all the information that needs to be added to the documentation after merge -->
<!-- When your changes are merged you will be asked to contribute this to the documentation -->

View File

@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Dependency Review
uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3
uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0
with:
allow-dependencies-licenses: |
pkg:npm/@cspell/dict-en-common-misspellings,

View File

@ -25,21 +25,21 @@ jobs:
- run: yarn --frozen-lockfile
- name: Cache prettier result
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
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@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
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@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .cspellcache
key: lint-cspell-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/cspell.json') }}
@ -97,7 +97,7 @@ jobs:
- run: yarn link webpack --frozen-lockfile
- name: Run benchmarks
uses: CodSpeedHQ/action@653fdc30e6c40ffd9739e40c8a0576f4f4523ca1 # v4.0.1
uses: CodSpeedHQ/action@3959e9e296ef25296e93e32afcc97196f966e57f # v4.1.0
with:
run: yarn benchmark --ci
mode: "instrumentation"
@ -144,7 +144,7 @@ jobs:
- run: yarn link webpack --frozen-lockfile
- name: Cache jest result
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .jest-cache
key: jest-unit-${{ env.GITHUB_SHA }}
@ -214,7 +214,7 @@ jobs:
# 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 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 memfs@4.14.0 --ignore-engines
yarn --frozen-lockfile --ignore-engines
if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x'
@ -241,7 +241,7 @@ jobs:
- run: yarn link webpack --frozen-lockfile
- name: Cache jest result
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .jest-cache
key: jest-integration-${{ env.GITHUB_SHA }}

View File

@ -1 +0,0 @@
[Code of Conduct](https://github.com/openjs-foundation/code-and-learn/blob/master/CODE_OF_CONDUCT.md)

View File

@ -1,65 +0,0 @@
# Webpack Security Incident Response Plan
This document defines how the Webpack project responds to security incidents.
It is intended for maintainers and contributors who may need to coordinate a response.
## Scope
This plan applies to incidents such as:
- Vulnerabilities in Webpack core modules or official tools (e.g., `webpack-cli`, `webpack-dev-server`).
- Dependency vulnerabilities that impact Webpack users.
- Premature public disclosure of a vulnerability.
- Account compromise or supply-chain risks affecting the project.
## Communication Channels
- **Private & Preferred**: [GitHub Security Advisories](https://github.com/webpack/webpack/security/advisories).
- **Email**: `webpack-security@openjsf.org`.
- **Public**: GitHub releases, changelog, and advisories (after fix is available).
## Incident Response Workflow
### 1. Report Received
- Reports should be submitted via GitHub Security Advisories (preferred) or private email.
- **Acknowledgment timelines**:
- Standard reports: within **30 days**.
- Zero-day or critical vulnerabilities: within **7 days**.
### 2. Triage & Assessment
- Validate whether the report is security-related.
- Classify severity (critical, high, medium, low).
- Determine impact and scope (affected versions, configurations, or environments).
### 3. Containment & Private Fix Development
- Create a **private working group** (e.g., GitHub private fork or draft advisory).
- Explore temporary mitigations if immediate patching is not feasible.
- Maintain confidentiality during the process.
### 4. Fix & Testing
- Develop and review a fix privately.
- Add regression tests where applicable.
- Backport fixes to supported major versions if relevant.
### 5. Release
- Publish a patched release.
- Publish a security advisory simultaneously, including:
- Description of the issue.
- Impacted versions.
- Severity rating.
- Mitigation or upgrade steps.
## Summary Table
| Step | Action | Responsible Party |
| --------------- | ----------------------------------------------- | --------------------------- |
| Report | Submit via GH Advisory or email | Reporter |
| Acknowledge | Confirm receipt (30 days / 7 days for critical) | Security Maintainer |
| Triage | Validate and classify severity | Security Maintainer |
| Containment/Fix | Develop patch privately | Core + Security Maintainers |
| Release | Publish patch & advisory | Security Maintainer |

View File

@ -20,6 +20,7 @@
[![contributors](https://img.shields.io/github/contributors/webpack/webpack.svg)](https://github.com/webpack/webpack/graphs/contributors)
[![discussions](https://img.shields.io/github/discussions/webpack/webpack)](https://github.com/webpack/webpack/discussions)
[![discord](https://img.shields.io/discord/1180618526436888586?label=discord&logo=discord&logoColor=white&style=flat)](https://discord.gg/5sxFZPdx2k)
[![LFX Health Score](https://insights.linuxfoundation.org/api/badge/health-score?project=webpack)](https://insights.linuxfoundation.org/project/webpack)
<h1>webpack</h1>
<p>
@ -45,7 +46,7 @@
- [Backers](#backers)
- [Special Thanks](#special-thanks-to)
<h2>Install</h2>
## Install
Install with npm:
@ -59,7 +60,7 @@ Install with yarn:
yarn add webpack --dev
```
<h2>Introduction</h2>
## Introduction
Webpack is a bundler for modules. The main purpose is to bundle JavaScript
files for usage in a browser, yet it is also capable of transforming, bundling,
@ -87,7 +88,7 @@ Check out webpack's quick [**Get Started**](https://webpack.js.org/guides/gettin
Webpack supports all browsers that are [ES5-compliant](https://kangax.github.io/compat-table/es5/) (IE8 and below are not supported).
Webpack also needs `Promise` for `import()` and `require.ensure()`. If you want to support older browsers, you will need to [load a polyfill](https://webpack.js.org/guides/shimming/) before using these expressions.
<h2>Concepts</h2>
## Concepts
### [Plugins](https://webpack.js.org/plugins/)
@ -264,7 +265,7 @@ If you're working on webpack itself, or building advanced plugins or integration
[tapable-tracer-npm]: https://img.shields.io/npm/v/tapable-tracer.svg
<h2>Contributing</h2>
## Contributing
**We want contributing to webpack to be fun, enjoyable, and educational for anyone, and everyone.** We have a [vibrant ecosystem](https://medium.com/webpack/contributors-guide/home) that spans beyond this single repo. We welcome you to check out any of the repositories in [our organization](https://github.com/webpack) or [webpack-contrib organization](https://github.com/webpack-contrib) which houses all of our loaders and plugins.
@ -283,11 +284,11 @@ Contributions go far beyond pull requests and commits. Although we love giving y
To get started have a look at our [documentation on contributing](https://github.com/webpack/webpack/blob/main/CONTRIBUTING.md).
<h3>Creating your own plugins and loaders</h3>
### Creating your own plugins and loaders
If you create a loader or plugin, we would <3 for you to open source it, and put it on npm. We follow the `x-loader`, `x-webpack-plugin` naming convention.
<h2>Support</h2>
## Support
We consider webpack to be a low-level tool used not only individually but also layered beneath other awesome tools. Because of its flexibility, webpack isn't always the _easiest_ entry-level solution, however we do believe it is the most powerful. That said, we're always looking for ways to improve and simplify the tool without compromising functionality. If you have any ideas on ways to accomplish this, we're all ears!
@ -295,11 +296,11 @@ If you're just getting started, take a look at [our new docs and concepts page](
If you have discovered a 🐜 or have a feature suggestion, feel free to create an issue on GitHub.
<h2>Current project members</h2>
## Current project members
For information about the governance of the webpack project, see [GOVERNANCE.md](./GOVERNANCE.md).
<h3>TSC (Technical Steering Committee)</h3>
### TSC (Technical Steering Committee)
- [alexander-akait](https://github.com/alexander-akait) -
**Alexander Akait** <<sheo13666q@gmail.com>> (he/him)
@ -312,11 +313,11 @@ For information about the governance of the webpack project, see [GOVERNANCE.md]
- [thelarkinn](https://github.com/thelarkinn) -
**Sean Larkin** <<selarkin@microsoft.com>> (he/him)
<h3>Maintenance</h3>
### Maintenance
This webpack repository is maintained by the [`Core Working Group`](./WORKING_GROUP.md).
<h2>Sponsoring</h2>
## Sponsoring
Most of the core team members, webpack contributors and contributors in the ecosystem do this open source work in their free time. If you use webpack for a serious task, and you'd like us to invest more time on it, please donate. This project increases your income/productivity too. It makes development and applications faster and it reduces the required bandwidth.
@ -329,7 +330,7 @@ This is how we use the donations:
- Infrastructure cost
- Fees for money handling
<h3>Premium Partners</h3>
### Premium Partners
<div align="center">
@ -338,7 +339,7 @@ This is how we use the donations:
</div>
<h3>Other Backers and Sponsors</h3>
### Other Backers and Sponsors
Before we started using OpenCollective, donations were made anonymously. Now that we have made the switch, we would like to acknowledge these sponsors (and the ones who continue to donate using OpenCollective). If we've missed someone, please send us a PR, and we'll add you to this list.
@ -350,7 +351,7 @@ Before we started using OpenCollective, donations were made anonymously. Now tha
</div>
<h3>Gold Sponsors</h3>
### Gold Sponsors
[Become a gold sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on GitHub with a link to your site.
@ -389,7 +390,7 @@ Before we started using OpenCollective, donations were made anonymously. Now tha
</div>
<h3>Silver Sponsors</h3>
### Silver Sponsors
[Become a silver sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on GitHub with a link to your site.
@ -428,7 +429,7 @@ Before we started using OpenCollective, donations were made anonymously. Now tha
</div>
<h3>Bronze Sponsors</h3>
### Bronze Sponsors
[Become a bronze sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on GitHub with a link to your site.
@ -538,7 +539,7 @@ Before we started using OpenCollective, donations were made anonymously. Now tha
</div>
<h3>Backers</h3>
### Backers
[Become a backer](https://opencollective.com/webpack#backer) and get your image on our README on GitHub with a link to your site.
@ -644,7 +645,8 @@ Before we started using OpenCollective, donations were made anonymously. Now tha
<a href="https://opencollective.com/webpack/backer/99/website?requireActive=false" target="_blank"><img width="30" src="https://opencollective.com/webpack/backer/99/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/webpack/backer/100/website?requireActive=false" target="_blank"><img width="30" src="https://opencollective.com/webpack/backer/100/avatar.svg?requireActive=false"></a>
<h2>Special Thanks to</h2>
## Special Thanks to
<p>(In chronological order)</p>
- [@google](https://github.com/google) for [Google Web Toolkit (GWT)](http://www.gwtproject.org/), which aims to compile Java to JavaScript. It features a similar [Code Splitting](http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html) as webpack.

View File

@ -1,20 +0,0 @@
# Reporting Security Issues
If you discover a security issue in webpack, please report it by sending an
email to [webpack@opencollective.com](mailto:webpack@opencollective.com).
This will allow us to assess the risk, and make a fix available before we add a
bug report to the GitHub repository.
Thanks for helping make webpack safe for everyone.
## Threat Model
For an overview of the security assumptions, potential attack vectors, and areas
of concern relevant to webpack, please refer to the
[Threat Model](https://github.com/webpack/security-wg/blob/main/docs/threat-model.md).
## Incident Response Plan
In the event of a security incident, please refer to the
[Security Incident Response Plan](https://github.com/webpack/webpack/blob/main/INCIDENT_RESPONSE_PLAN.md).

View File

@ -284,6 +284,7 @@
"url's",
"valign",
"valtype",
"walltime",
"wasi",
"wasm",
"watchings",
@ -304,7 +305,6 @@
"commithash",
"formaters",
"akait",
"Akait",
"evenstensberg",
"Stensberg",
"ovflowd",
@ -314,7 +314,8 @@
"Kumar",
"spacek",
"thelarkinn",
"behaviour"
"behaviour",
"WHATWG"
],
"ignoreRegExpList": [
"/Author.+/",

View File

@ -3349,7 +3349,6 @@ export interface JavascriptParserOptions {
* Set the inner regular expression for partial dynamic dependencies.
*/
wrappedContextRegExp?: RegExp;
[k: string]: any;
}
/**
* Generator options for json modules.
@ -3977,6 +3976,10 @@ export interface GeneratorOptionsByModuleTypeKnown {
* Generator options for asset modules.
*/
asset?: AssetGeneratorOptions;
/**
* No generator options are supported for this module type.
*/
"asset/bytes"?: EmptyGeneratorOptions;
/**
* Generator options for asset/inline modules.
*/
@ -3985,6 +3988,10 @@ export interface GeneratorOptionsByModuleTypeKnown {
* Generator options for asset/resource modules.
*/
"asset/resource"?: AssetResourceGeneratorOptions;
/**
* No generator options are supported for this module type.
*/
"asset/source"?: EmptyGeneratorOptions;
/**
* Generator options for css modules.
*/
@ -4041,6 +4048,10 @@ export interface ParserOptionsByModuleTypeKnown {
* Parser options for asset modules.
*/
asset?: AssetParserOptions;
/**
* No parser options are supported for this module type.
*/
"asset/bytes"?: EmptyParserOptions;
/**
* No parser options are supported for this module type.
*/

View File

@ -23,7 +23,7 @@ export type Rules = Rule[] | Rule;
/**
* Filtering rule as regex or string.
*/
export type Rule = RegExp | string;
export type Rule = RegExp | string | ((str: string) => boolean);
export interface BannerPluginOptions {
/**

View File

@ -11,7 +11,7 @@ export type Rules = Rule[] | Rule;
/**
* Include source maps for modules based on their extension (defaults to .js and .css).
*/
export type Rule = RegExp | string;
export type Rule = RegExp | string | ((str: string) => boolean);
export interface SourceMapDevToolPluginOptions {
/**

View File

@ -1,223 +0,0 @@
This is a very simple example that shows the usage of the asset module type.
Files can be imported like other modules without file-loader.
# example.js
```javascript
import png from "./images/file.png";
import jpg from "./images/file.jpg";
import svg from "./images/file.svg";
const container = document.createElement("div");
Object.assign(container.style, {
display: "flex",
justifyContent: "center"
});
document.body.appendChild(container);
function createImageElement(title, src) {
const div = document.createElement("div");
div.style.textAlign = "center";
const h2 = document.createElement("h2");
h2.textContent = title;
div.appendChild(h2);
const img = document.createElement("img");
img.setAttribute("src", src);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
}
[png, jpg, svg].forEach(src => {
createImageElement(src.split(".").pop(), src);
});
```
# webpack.config.js
```javascript
"use strict";
module.exports = {
output: {
assetModuleFilename: "images/[hash][ext]"
},
module: {
rules: [
{
test: /\.(png|jpg|svg)$/,
type: "asset"
}
]
}
};
```
# js/output.js
```javascript
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/*!*************************!*\
!*** ./images/file.png ***!
\*************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__.p, module, __webpack_require__.* */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = __webpack_require__.p + "images/89a353e9c515885abd8e.png";
/***/ }),
/* 2 */
/*!*************************!*\
!*** ./images/file.jpg ***!
\*************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: module */
/***/ ((module) => {
module.exports = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAA...4CD/9M//Z";
/***/ }),
/* 3 */
/*!*************************!*\
!*** ./images/file.svg ***!
\*************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: module */
/***/ ((module) => {
module.exports = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDo...vc3ZnPgo=";
/***/ })
/******/ ]);
```
<details><summary><code>/* webpack runtime code */</code></summary>
``` js
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ __webpack_require__.p = "dist/";
/******/ })();
/******/
/************************************************************************/
```
</details>
``` js
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
\********************/
/*! namespace exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _images_file_png__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.png */ 1);
/* harmony import */ var _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./images/file.jpg */ 2);
/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./images/file.svg */ 3);
const container = document.createElement("div");
Object.assign(container.style, {
display: "flex",
justifyContent: "center"
});
document.body.appendChild(container);
function createImageElement(title, src) {
const div = document.createElement("div");
div.style.textAlign = "center";
const h2 = document.createElement("h2");
h2.textContent = title;
div.appendChild(h2);
const img = document.createElement("img");
img.setAttribute("src", src);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
}
[_images_file_png__WEBPACK_IMPORTED_MODULE_0__, _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__, _images_file_svg__WEBPACK_IMPORTED_MODULE_2__].forEach(src => {
createImageElement(src.split(".").pop(), src);
});
})();
/******/ })()
;
```
# Info
## webpack output
```
asset images/89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main)
asset output.js 13 KiB [emitted] (name: main)
chunk (runtime: main) output.js (main) 9.58 KiB (javascript) 14.6 KiB (asset) 306 bytes (runtime) [entry] [rendered]
> ./example.js main
dependent modules 8.86 KiB (javascript) 14.6 KiB (asset) [dependent] 3 modules
runtime modules 306 bytes 2 modules
./example.js 742 bytes [built] [code generated]
[no exports]
[used exports unknown]
entry ./example.js main
webpack X.X.X compiled successfully
```

View File

@ -1,30 +0,0 @@
import png from "./images/file.png";
import jpg from "./images/file.jpg";
import svg from "./images/file.svg";
const container = document.createElement("div");
Object.assign(container.style, {
display: "flex",
justifyContent: "center"
});
document.body.appendChild(container);
function createImageElement(title, src) {
const div = document.createElement("div");
div.style.textAlign = "center";
const h2 = document.createElement("h2");
h2.textContent = title;
div.appendChild(h2);
const img = document.createElement("img");
img.setAttribute("src", src);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
}
[png, jpg, svg].forEach(src => {
createImageElement(src.split(".").pop(), src);
});

View File

Before

Width:  |  Height:  |  Size: 656 B

After

Width:  |  Height:  |  Size: 656 B

488
examples/asset/README.md Normal file
View File

@ -0,0 +1,488 @@
This is a very simple example that shows the usage of the asset module type.
Files can be imported like other modules without file-loader.
# example.js
```javascript
// There are different ways to use files:
// 1. Using `import something from "./file.ext";`
// return URLs or Data URL, depends on your configuration
import png from "./images/file.png";
import jpg from "./images/file.jpg";
import svg from "./images/file.svg";
// 2. Using `import something from "./file.ext"; with { type: "text" }` or `import something from "./file.ext"; with { type: "bytes" }`
// You don't need extra options in your configuration for these imports, they work out of the box
// returns the content as text
import text from "./content/file.text" with { type: "text" };
// returns the content as `Uint8Array`
import bytes from "./content/bytes.svg" with { type: "bytes" };
// 3. Using `new URL("./file.ext", import.meta.url);`
// You don't need extra options in your configuration for `new URL(...)` construction, they work out of the box
const url = new URL("./images/url.svg", import.meta.url);
const container = document.createElement("div");
Object.assign(container.style, {
display: "flex",
flexWrap: "wrap",
justifyContent: "center"
});
document.body.appendChild(container);
function createImageElement(div, data) {
const img = document.createElement("img");
img.setAttribute("src", data);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
}
function createTextElement(div, data) {
const context = document.createElement("div");
context.textContent = data;
div.appendChild(context);
container.appendChild(div);
}
function createBlobElement(div, data) {
const blob = new Blob([data], { type: 'image/svg+xml' });
const blobUrl = URL.createObjectURL(blob);
const img = document.createElement("img");
img.setAttribute("src", blobUrl);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
img.addEventListener(
'load',
() => { URL.revokeObjectURL(blobUrl) },
{ once: true }
);
}
const files = [
{
title: "import png from \"./images/file.png\";",
data: png,
render: createImageElement,
},
{
title: "import jpg from \"./images/file.jpg\";",
data: jpg,
render: createImageElement,
},
{
title: "import svg from \"./images/file.svg\";",
data: svg,
render: createImageElement,
},
{
title: "import text from \"./content/file.text\" with { type: \"text\" };",
data: text,
render: createTextElement,
},
{
title: "import bytes from \"./content/file.text\" with { type: \"bytes\" };",
data: bytes,
render: createBlobElement,
},
{
title: "new URL(\"./url.svg\", import.meta.url);",
data: url,
render: createImageElement,
},
];
function render(title, data, fn) {
const div = document.createElement("div");
div.style.textAlign = "center";
div.style.width = "50%";
const h2 = document.createElement("h2");
h2.textContent = title;
div.appendChild(h2);
fn(div, data)
}
files.forEach(item => {
render(item.title, item.data, item.render);
});
```
# webpack.config.js
```javascript
"use strict";
module.exports = {
output: {
assetModuleFilename: "images/[hash][ext]"
},
module: {
rules: [
{
test: /file\.(png|jpg|svg)$/,
type: "asset"
},
]
}
};
```
# js/output.js
```javascript
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/*!*************************!*\
!*** ./images/file.png ***!
\*************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__.p, module, __webpack_require__.* */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = __webpack_require__.p + "images/89a353e9c515885abd8e.png";
/***/ }),
/* 2 */
/*!*************************!*\
!*** ./images/file.jpg ***!
\*************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: module */
/***/ ((module) => {
module.exports = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAA...4CD/9M//Z";
/***/ }),
/* 3 */
/*!*************************!*\
!*** ./images/file.svg ***!
\*************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: module */
/***/ ((module) => {
module.exports = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDo...vc3ZnPgo=";
/***/ }),
/* 4 */
/*!************************!*\
!*** ./images/url.svg ***!
\************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__.p, module, __webpack_require__.* */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = __webpack_require__.p + "images/afc10c70ed4ce2b33593.svg";
/***/ }),
/* 5 */
/*!***************************!*\
!*** ./content/file.text ***!
\***************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: module */
/***/ ((module) => {
module.exports = "a Ā 𐀀 文 🦄 Text\n";
/***/ }),
/* 6 */
/*!***************************!*\
!*** ./content/bytes.svg ***!
\***************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__.tb, module */
/***/ ((module) => {
module.exports = __webpack_require__.tb("PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MDAgNjAwIj48dGl0bGU+aWNvbi1zcXVhcmUtc21hbGw8L3RpdGxlPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0zMDAgLjFMNTY1IDE1MHYyOTkuOUwzMDAgNTk5LjggMzUgNDQ5LjlWMTUweiIvPjxwYXRoIGZpbGw9IiM4RUQ2RkIiIGQ9Ik01MTcuNyA0MzkuNUwzMDguOCA1NTcuOHYtOTJMNDM5IDM5NC4xbDc4LjcgNDUuNHptMTQuMy0xMi45VjE3OS40bC03Ni40IDQ0LjF2MTU5bDc2LjQgNDQuMXpNODEuNSA0MzkuNWwyMDguOSAxMTguMnYtOTJsLTEzMC4yLTcxLjYtNzguNyA0NS40em0tMTQuMy0xMi45VjE3OS40bDc2LjQgNDQuMXYxNTlsLTc2LjQgNDQuMXptOC45LTI2My4yTDI5MC40IDQyLjJ2ODlsLTEzNy4zIDc1LjUtMS4xLjYtNzUuOS00My45em00NDYuOSAwTDMwOC44IDQyLjJ2ODlMNDQ2IDIwNi44bDEuMS42IDc1LjktNDR6Ii8+PHBhdGggZmlsbD0iIzFDNzhDMCIgZD0iTTI5MC40IDQ0NC44TDE2MiAzNzQuMVYyMzQuMmwxMjguNCA3NC4xdjEzNi41em0xOC40IDBsMTI4LjQtNzAuNnYtMTQwbC0xMjguNCA3NC4xdjEzNi41ek0yOTkuNiAzMDN6bS0xMjktODVsMTI5LTcwLjlMNDI4LjUgMjE4bC0xMjguOSA3NC40LTEyOS03NC40eiIvPjwvc3ZnPgo=");
/***/ })
/******/ ]);
```
<details><summary><code>/* webpack runtime code */</code></summary>
``` js
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/to binary */
/******/ (() => {
/******/ // define to binary helper
/******/ __webpack_require__.tb = (() => {
/******/ var table = new Uint8Array(128);
/******/ for (var i = 0; i < 64; i++) table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
/******/ return (base64) => {
/******/ var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == '=') - (base64[n - 2] == '=')) * 3 / 4 | 0);
/******/ for (var i = 0, j = 0; i < n;) {
/******/ var c0 = table[base64.charCodeAt(i++)], c1 = table[base64.charCodeAt(i++)];
/******/ var c2 = table[base64.charCodeAt(i++)], c3 = table[base64.charCodeAt(i++)];
/******/ bytes[j++] = (c0 << 2) | (c1 >> 4);
/******/ bytes[j++] = (c1 << 4) | (c2 >> 2);
/******/ bytes[j++] = (c2 << 6) | c3;
/******/ }
/******/ return bytes
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ __webpack_require__.p = "dist/";
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ __webpack_require__.b = (document && document.baseURI) || self.location.href;
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 0: 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ // no on chunks loaded
/******/
/******/ // no jsonp function
/******/ })();
/******/
/************************************************************************/
```
</details>
``` js
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
\********************/
/*! namespace exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__, __webpack_require__.b, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _images_file_png__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.png */ 1);
/* harmony import */ var _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./images/file.jpg */ 2);
/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./images/file.svg */ 3);
/* harmony import */ var _content_file_text__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./content/file.text */ 5);
/* harmony import */ var _content_bytes_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./content/bytes.svg */ 6);
// There are different ways to use files:
// 1. Using `import something from "./file.ext";`
// return URLs or Data URL, depends on your configuration
// 2. Using `import something from "./file.ext"; with { type: "text" }` or `import something from "./file.ext"; with { type: "bytes" }`
// You don't need extra options in your configuration for these imports, they work out of the box
// returns the content as text
// returns the content as `Uint8Array`
// 3. Using `new URL("./file.ext", import.meta.url);`
// You don't need extra options in your configuration for `new URL(...)` construction, they work out of the box
const url = new URL(/* asset import */ __webpack_require__(/*! ./images/url.svg */ 4), __webpack_require__.b);
const container = document.createElement("div");
Object.assign(container.style, {
display: "flex",
flexWrap: "wrap",
justifyContent: "center"
});
document.body.appendChild(container);
function createImageElement(div, data) {
const img = document.createElement("img");
img.setAttribute("src", data);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
}
function createTextElement(div, data) {
const context = document.createElement("div");
context.textContent = data;
div.appendChild(context);
container.appendChild(div);
}
function createBlobElement(div, data) {
const blob = new Blob([data], { type: 'image/svg+xml' });
const blobUrl = URL.createObjectURL(blob);
const img = document.createElement("img");
img.setAttribute("src", blobUrl);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
img.addEventListener(
'load',
() => { URL.revokeObjectURL(blobUrl) },
{ once: true }
);
}
const files = [
{
title: "import png from \"./images/file.png\";",
data: _images_file_png__WEBPACK_IMPORTED_MODULE_0__,
render: createImageElement,
},
{
title: "import jpg from \"./images/file.jpg\";",
data: _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__,
render: createImageElement,
},
{
title: "import svg from \"./images/file.svg\";",
data: _images_file_svg__WEBPACK_IMPORTED_MODULE_2__,
render: createImageElement,
},
{
title: "import text from \"./content/file.text\" with { type: \"text\" };",
data: _content_file_text__WEBPACK_IMPORTED_MODULE_3__,
render: createTextElement,
},
{
title: "import bytes from \"./content/file.text\" with { type: \"bytes\" };",
data: _content_bytes_svg__WEBPACK_IMPORTED_MODULE_4__,
render: createBlobElement,
},
{
title: "new URL(\"./url.svg\", import.meta.url);",
data: url,
render: createImageElement,
},
];
function render(title, data, fn) {
const div = document.createElement("div");
div.style.textAlign = "center";
div.style.width = "50%";
const h2 = document.createElement("h2");
h2.textContent = title;
div.appendChild(h2);
fn(div, data)
}
files.forEach(item => {
render(item.title, item.data, item.render);
});
})();
/******/ })()
;
```
# Info
## webpack output
```
asset output.js 19.2 KiB [emitted] (name: main)
asset images/89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main)
asset images/afc10c70ed4ce2b33593.svg 656 bytes [emitted] [immutable] [from: images/url.svg] (auxiliary name: main)
chunk (runtime: main) output.js (main) 12.4 KiB (javascript) 15.2 KiB (asset) 1.46 KiB (runtime) [entry] [rendered]
> ./example.js main
dependent modules 9.59 KiB (javascript) 15.2 KiB (asset) [dependent] 6 modules
runtime modules 1.46 KiB 5 modules
./example.js 2.85 KiB [built] [code generated]
[no exports]
[used exports unknown]
entry ./example.js main
webpack X.X.X compiled successfully
```

View File

Before

Width:  |  Height:  |  Size: 656 B

After

Width:  |  Height:  |  Size: 656 B

View File

@ -0,0 +1 @@
a Ā 𐀀 文 🦄 Text

116
examples/asset/example.js Normal file
View File

@ -0,0 +1,116 @@
// There are different ways to use files:
// 1. Using `import something from "./file.ext";`
// return URLs or Data URL, depends on your configuration
import png from "./images/file.png";
import jpg from "./images/file.jpg";
import svg from "./images/file.svg";
// 2. Using `import something from "./file.ext"; with { type: "text" }` or `import something from "./file.ext"; with { type: "bytes" }`
// You don't need extra options in your configuration for these imports, they work out of the box
// returns the content as text
import text from "./content/file.text" with { type: "text" };
// returns the content as `Uint8Array`
import bytes from "./content/bytes.svg" with { type: "bytes" };
// 3. Using `new URL("./file.ext", import.meta.url);`
// You don't need extra options in your configuration for `new URL(...)` construction, they work out of the box
const url = new URL("./images/url.svg", import.meta.url);
const container = document.createElement("div");
Object.assign(container.style, {
display: "flex",
flexWrap: "wrap",
justifyContent: "center"
});
document.body.appendChild(container);
function createImageElement(div, data) {
const img = document.createElement("img");
img.setAttribute("src", data);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
}
function createTextElement(div, data) {
const context = document.createElement("div");
context.textContent = data;
div.appendChild(context);
container.appendChild(div);
}
function createBlobElement(div, data) {
const blob = new Blob([data], { type: 'image/svg+xml' });
const blobUrl = URL.createObjectURL(blob);
const img = document.createElement("img");
img.setAttribute("src", blobUrl);
img.setAttribute("width", "150");
div.appendChild(img);
container.appendChild(div);
img.addEventListener(
'load',
() => { URL.revokeObjectURL(blobUrl) },
{ once: true }
);
}
const files = [
{
title: "import png from \"./images/file.png\";",
data: png,
render: createImageElement,
},
{
title: "import jpg from \"./images/file.jpg\";",
data: jpg,
render: createImageElement,
},
{
title: "import svg from \"./images/file.svg\";",
data: svg,
render: createImageElement,
},
{
title: "import text from \"./content/file.text\" with { type: \"text\" };",
data: text,
render: createTextElement,
},
{
title: "import bytes from \"./content/file.text\" with { type: \"bytes\" };",
data: bytes,
render: createBlobElement,
},
{
title: "new URL(\"./url.svg\", import.meta.url);",
data: url,
render: createImageElement,
},
];
function render(title, data, fn) {
const div = document.createElement("div");
div.style.textAlign = "center";
div.style.width = "50%";
const h2 = document.createElement("h2");
h2.textContent = title;
div.appendChild(h2);
fn(div, data)
}
files.forEach(item => {
render(item.title, item.data, item.render);
});

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 600"><title>icon-square-small</title><path fill="#FFF" d="M300 .1L565 150v299.9L300 599.8 35 449.9V150z"/><path fill="#8ED6FB" d="M517.7 439.5L308.8 557.8v-92L439 394.1l78.7 45.4zm14.3-12.9V179.4l-76.4 44.1v159l76.4 44.1zM81.5 439.5l208.9 118.2v-92l-130.2-71.6-78.7 45.4zm-14.3-12.9V179.4l76.4 44.1v159l-76.4 44.1zm8.9-263.2L290.4 42.2v89l-137.3 75.5-1.1.6-75.9-43.9zm446.9 0L308.8 42.2v89L446 206.8l1.1.6 75.9-44z"/><path fill="#1C78C0" d="M290.4 444.8L162 374.1V234.2l128.4 74.1v136.5zm18.4 0l128.4-70.6v-140l-128.4 74.1v136.5zM299.6 303zm-129-85l129-70.9L428.5 218l-128.9 74.4-129-74.4z"/></svg>

After

Width:  |  Height:  |  Size: 656 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 600"><title>icon-square-small</title><path fill="#FFF" d="M300 .1L565 150v299.9L300 599.8 35 449.9V150z"/><path fill="#8ED6FB" d="M517.7 439.5L308.8 557.8v-92L439 394.1l78.7 45.4zm14.3-12.9V179.4l-76.4 44.1v159l76.4 44.1zM81.5 439.5l208.9 118.2v-92l-130.2-71.6-78.7 45.4zm-14.3-12.9V179.4l76.4 44.1v159l-76.4 44.1zm8.9-263.2L290.4 42.2v89l-137.3 75.5-1.1.6-75.9-43.9zm446.9 0L308.8 42.2v89L446 206.8l1.1.6 75.9-44z"/><path fill="#1C78C0" d="M290.4 444.8L162 374.1V234.2l128.4 74.1v136.5zm18.4 0l128.4-70.6v-140l-128.4 74.1v136.5zM299.6 303zm-129-85l129-70.9L428.5 218l-128.9 74.4-129-74.4z"/></svg>

After

Width:  |  Height:  |  Size: 656 B

View File

@ -7,9 +7,9 @@ module.exports = {
module: {
rules: [
{
test: /\.(png|jpg|svg)$/,
test: /file\.(png|jpg|svg)$/,
type: "asset"
}
},
]
}
};

View File

@ -39,9 +39,9 @@ export default foo;
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/*!******************************************************************************!*\
!*** ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ***!
\******************************************************************************/
/*!**************************************************************************************************!*\
!*** ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ***!
\**************************************************************************************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: module, __webpack_require__.o, __webpack_require__, __webpack_require__.e, __webpack_require__.* */
@ -370,21 +370,21 @@ chunk (runtime: main) output.js (main) 565 bytes (javascript) 5.48 KiB (runtime)
[used exports unknown]
entry ./example.js main
chunk (runtime: main) 792.output.js (chunk-bar-baz2) 38 bytes [rendered]
> ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz
> ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
> ./baz ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./baz
> ./baz.js ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./baz.js
./templates/baz.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
import() context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz
import() context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
import() context element ./baz ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./baz
import() context element ./baz.js ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./baz.js
chunk (runtime: main) 994.output.js (chunk-bar-baz0) 38 bytes [rendered]
> ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
> ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
> ./bar ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./bar
> ./bar.js ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./bar.js
./templates/bar.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
import() context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
import() context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
import() context element ./bar ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./bar
import() context element ./bar.js ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./bar.js
webpack X.X.X compiled successfully
```
@ -410,18 +410,18 @@ chunk (runtime: main) output.js (main) 565 bytes (javascript) 5.48 KiB (runtime)
[no exports used]
entry ./example.js main
chunk (runtime: main) 792.output.js (chunk-bar-baz2) 38 bytes [rendered]
> ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz
> ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
> ./baz ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./baz
> ./baz.js ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./baz.js
./templates/baz.js 38 bytes [optional] [built] [code generated]
[exports: default]
import() context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz
import() context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
import() context element ./baz ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./baz
import() context element ./baz.js ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./baz.js
chunk (runtime: main) 994.output.js (chunk-bar-baz0) 38 bytes [rendered]
> ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
> ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
> ./bar ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./bar
> ./bar.js ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./bar.js
./templates/bar.js 38 bytes [optional] [built] [code generated]
[exports: default]
import() context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
import() context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
import() context element ./bar ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./bar
import() context element ./bar.js ./templates/ lazy ^\.\/ba.*$ referencedExports: chunkName: chunk-bar-baz namespace object ./bar.js
webpack X.X.X compiled successfully
```

View File

@ -137,9 +137,9 @@ window.onLinkToPage = function onLinkToPage(name) { // name is "a" or "b"
/***/ }),
/* 4 */
/*!********************************************************************!*\
!*** ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ***!
\********************************************************************/
/*!***********************************************************************************************!*\
!*** ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ***!
\***********************************************************************************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: module, __webpack_require__.o, __webpack_require__, __webpack_require__.e, __webpack_require__.t, __webpack_require__.* */
@ -530,29 +530,29 @@ module.exports = function() {
```
asset pageB.bundle.js 13 KiB [emitted] (name: pageB)
asset pageA.bundle.js 13 KiB [emitted] (name: pageA)
asset router_js.bundle.js 2.45 KiB [emitted]
asset router_js.bundle.js 2.53 KiB [emitted]
asset aPage.bundle.js 392 bytes [emitted] (name: aPage)
asset bPage.bundle.js 392 bytes [emitted] (name: bPage)
Entrypoint pageA 15.8 KiB = router_js.bundle.js 2.45 KiB aPage.bundle.js 392 bytes pageA.bundle.js 13 KiB
Entrypoint pageB 15.8 KiB = router_js.bundle.js 2.45 KiB bPage.bundle.js 392 bytes pageB.bundle.js 13 KiB
Entrypoint pageA 15.9 KiB = router_js.bundle.js 2.53 KiB aPage.bundle.js 392 bytes pageA.bundle.js 13 KiB
Entrypoint pageB 15.9 KiB = router_js.bundle.js 2.53 KiB bPage.bundle.js 392 bytes pageB.bundle.js 13 KiB
chunk (runtime: pageA, pageB) aPage.bundle.js (aPage) 59 bytes [initial] [rendered] reused as split chunk (cache group: default)
> ./aPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./aPage
> ./aPage ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ./aPage
> ./aEntry pageA
> ./router pageA
./aPage.js 59 bytes [built] [code generated]
[used exports unknown]
cjs require ./aPage ./aEntry.js 3:7-25
cjs self exports reference ./aPage.js 1:0-14
import() context element ./aPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./aPage
import() context element ./aPage ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ./aPage
chunk (runtime: pageA, pageB) bPage.bundle.js (bPage) 59 bytes [initial] [rendered] reused as split chunk (cache group: default)
> ./bPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./bPage
> ./bPage ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ./bPage
> ./bEntry pageB
> ./router pageB
./bPage.js 59 bytes [built] [code generated]
[used exports unknown]
cjs require ./bPage ./bEntry.js 3:7-25
cjs self exports reference ./bPage.js 1:0-14
import() context element ./bPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./bPage
import() context element ./bPage ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ./bPage
chunk (runtime: pageA) pageA.bundle.js (pageA) 87 bytes (javascript) 7.58 KiB (runtime) [entry] [rendered]
> ./aEntry pageA
> ./router pageA
@ -591,23 +591,23 @@ asset bPage.bundle.js 117 bytes [emitted] [minimized] (name: bPage)
Entrypoint pageA 3.46 KiB = router_js.bundle.js 538 bytes aPage.bundle.js 117 bytes pageA.bundle.js 2.82 KiB
Entrypoint pageB 3.46 KiB = router_js.bundle.js 538 bytes bPage.bundle.js 117 bytes pageB.bundle.js 2.82 KiB
chunk (runtime: pageA, pageB) aPage.bundle.js (aPage) 59 bytes [initial] [rendered] reused as split chunk (cache group: default)
> ./aPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./aPage
> ./aPage ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ./aPage
> ./aEntry pageA
> ./router pageA
./aPage.js 59 bytes [built] [code generated]
[used exports unknown]
cjs require ./aPage ./aEntry.js 3:7-25
cjs self exports reference ./aPage.js 1:0-14
import() context element ./aPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./aPage
import() context element ./aPage ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ./aPage
chunk (runtime: pageA, pageB) bPage.bundle.js (bPage) 59 bytes [initial] [rendered] reused as split chunk (cache group: default)
> ./bPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./bPage
> ./bPage ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ./bPage
> ./bEntry pageB
> ./router pageB
./bPage.js 59 bytes [built] [code generated]
[used exports unknown]
cjs require ./bPage ./bEntry.js 3:7-25
cjs self exports reference ./bPage.js 1:0-14
import() context element ./bPage ././ lazy ^\.\/.*Page$ chunkName: [request] namespace object ./bPage
import() context element ./bPage ././ lazy ^\.\/.*Page$ referencedExports: default chunkName: [request] namespace object ./bPage
chunk (runtime: pageA) pageA.bundle.js (pageA) 87 bytes (javascript) 7.58 KiB (runtime) [entry] [rendered]
> ./aEntry pageA
> ./router pageA

View File

@ -425,21 +425,17 @@ __webpack_require__.e(/*! import() */ "lazy_js").then(__webpack_require__.bind(_
!*** ./lazy.js + 2 modules ***!
\*****************************/
/*! namespace exports */
/*! export c [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] -> ./node_modules/c.js .c */
/*! export d [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] -> ./node_modules/d.js */
/*! export a [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] */
/*! other exports [not provided] [maybe used in main (runtime-defined)] */
/*! export x [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] -> ./node_modules/shared.js + 1 modules .x */
/*! export y [provided] [maybe used in main (runtime-defined)] [usage prevents renaming] -> ./node_modules/shared2.js .y */
/*! other exports [not provided] [maybe used in main (runtime-defined)] */
/*! export c [provided] [used in main] [usage prevents renaming] -> ./node_modules/c.js .c */
/*! export d [provided] [only properties used in main] [usage prevents renaming] -> ./node_modules/d.js */
/*! export a [provided] [used in main] [usage prevents renaming] */
/*! export x [provided] [used in main] [usage prevents renaming] -> ./node_modules/shared.js + 1 modules .x */
/*! export y [provided] [used in main] [usage prevents renaming] -> ./node_modules/shared2.js .y */
/*! runtime requirements: __webpack_exports__, __webpack_require__.d, __webpack_require__.r, __webpack_require__, __webpack_require__.* */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/cjs.js: Module is not an ECMAScript module */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shared.js: Module ./node_modules/shared.js is not in the same chunk(s) (expected in chunk(s) unnamed chunk(s), module is in chunk(s) ) */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
@ -500,7 +496,7 @@ exports.c = "e";
Minimized
```javascript
(self.webpackChunk=self.webpackChunk||[]).push([["lazy_js"],{207:(r,a,e)=>{"use strict";e.r(a),e.d(a,{c:()=>C,d:()=>c,x:()=>s.x,y:()=>h.y});var c={};e.r(c),e.d(c,{a:()=>k});var d=e(330),s=e(331),h=e(453),C=String.fromCharCode(d.c.charCodeAt(0)-2),k="d"},330:(r,a)=>{a.c="e"}}]);
(self.webpackChunk=self.webpackChunk||[]).push([["lazy_js"],{207:(a,e,r)=>{"use strict";r.d(e,{c:()=>C,d:()=>c,x:()=>s.x,y:()=>h.y});var c={};r.r(c),r.d(c,{a:()=>k});var d=r(330),s=r(331),h=r(453),C=String.fromCharCode(d.c.charCodeAt(0)-2),k="d"},330:(a,e)=>{e.c="e"}}]);
```
# Info
@ -509,12 +505,13 @@ Minimized
```
asset output.js 11 KiB [emitted] (name: main)
asset lazy_js.output.js 2.67 KiB [emitted]
asset lazy_js.output.js 2.36 KiB [emitted]
chunk (runtime: main) lazy_js.output.js 263 bytes [rendered]
> ./lazy ./example.js 4:0-16
dependent modules 42 bytes [dependent] 1 module
./lazy.js + 2 modules 221 bytes [built] [code generated]
[exports: c, d, x, y]
[all exports used]
import() ./lazy ./example.js + 2 modules ./example.js 4:0-16
chunk (runtime: main) output.js (main) 367 bytes (javascript) 5.48 KiB (runtime) [entry] [rendered]
> ./example.js main
@ -531,12 +528,13 @@ webpack X.X.X compiled successfully
```
asset output.js 2.09 KiB [emitted] [minimized] (name: main)
asset lazy_js.output.js 278 bytes [emitted] [minimized]
asset lazy_js.output.js 271 bytes [emitted] [minimized]
chunk (runtime: main) lazy_js.output.js 263 bytes [rendered]
> ./lazy ./example.js 4:0-16
dependent modules 42 bytes [dependent] 1 module
./lazy.js + 2 modules 221 bytes [built] [code generated]
[exports: c, d, x, y]
[all exports used]
import() ./lazy ./example.js + 2 modules ./example.js 4:0-16
chunk (runtime: main) output.js (main) 367 bytes (javascript) 5.48 KiB (runtime) [entry] [rendered]
> ./example.js main

View File

@ -286,7 +286,7 @@ export const add = (content, from) => {
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ __webpack_require__.b = document.baseURI || self.location.href;
/******/ __webpack_require__.b = (document && document.baseURI) || self.location.href;
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
@ -746,9 +746,9 @@ chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes
./fib-worker.js 176 bytes [built] [code generated]
[no exports used]
new Worker() ./fib-worker.js ./example.js 80:18-84:2
chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.39 KiB (runtime) [entry] [rendered]
chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.4 KiB (runtime) [entry] [rendered]
> ./example.js main
runtime modules 5.39 KiB 7 modules
runtime modules 5.4 KiB 7 modules
./example.js 2.25 KiB [built] [code generated]
[no exports used]
entry ./example.js main
@ -758,7 +758,7 @@ webpack X.X.X compiled successfully
## Production mode
```
asset main.js 3.26 KiB [emitted] [minimized] (name: main)
asset main.js 3.27 KiB [emitted] [minimized] (name: main)
asset workers/fibonacci.js 776 bytes [emitted] [minimized] (name: fibonacci)
asset chat.js 270 bytes [emitted] [minimized] (name: chat)
asset 129.js 159 bytes [emitted] [minimized]
@ -782,9 +782,9 @@ chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes
./fib-worker.js 176 bytes [built] [code generated]
[no exports used]
new Worker() ./fib-worker.js ./example.js 80:18-84:2
chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.39 KiB (runtime) [entry] [rendered]
chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.4 KiB (runtime) [entry] [rendered]
> ./example.js main
runtime modules 5.39 KiB 7 modules
runtime modules 5.4 KiB 7 modules
./example.js 2.25 KiB [built] [code generated]
[no exports used]
entry ./example.js main

View File

@ -38,15 +38,7 @@ class LoaderOptionsPlugin {
// If no options are set then generate empty options object
if (typeof options !== "object") options = {};
if (!options.test) {
/** @type {Partial<RegExp>} */
const defaultTrueMockRegExp = {
test: () => true
};
/** @type {RegExp} */
options.test =
/** @type {RegExp} */
(defaultTrueMockRegExp);
options.test = () => true;
}
this.options = options;
}

View File

@ -15,7 +15,7 @@ const memoize = require("./util/memoize");
/** @typedef {import("./Module")} Module */
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {string | RegExp | (string | RegExp)[]} Matcher */
/** @typedef {string | RegExp | ((str: string) => boolean) | (string | RegExp | ((str: string) => boolean))[]} Matcher */
/** @typedef {{ test?: Matcher, include?: Matcher, exclude?: Matcher }} MatchObject */
const ModuleFilenameHelpers = module.exports;
@ -334,13 +334,15 @@ ModuleFilenameHelpers.replaceDuplicates = (array, fn, comparator) => {
*/
const matchPart = (str, test) => {
if (!test) return true;
if (Array.isArray(test)) {
return test.some((test) => matchPart(str, test));
}
if (typeof test === "string") {
if (test instanceof RegExp) {
return test.test(str);
} else if (typeof test === "string") {
return str.startsWith(test);
} else if (typeof test === "function") {
return test(str);
}
return test.test(str);
return test.some((test) => matchPart(str, test));
};
ModuleFilenameHelpers.matchPart = matchPart;

View File

@ -89,6 +89,12 @@ const ASSET_MODULE_TYPE_RESOURCE = "asset/resource";
*/
const ASSET_MODULE_TYPE_SOURCE = "asset/source";
/**
* @type {Readonly<"asset/bytes">}
* This is the module type used for assets that are imported as Uint8Array.
*/
const ASSET_MODULE_TYPE_BYTES = "asset/bytes";
/**
* @type {Readonly<"asset/raw-data-url">}
* TODO: Document what this asset type is for. See css-loader tests for its usage.
@ -144,6 +150,7 @@ const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = "lazy-compilation-proxy";
/** @typedef {JavaScriptModuleTypes | JSONModuleType | WebAssemblyModuleTypes | CSSModuleTypes | AssetModuleTypes | WebpackModuleTypes | UnknownModuleTypes} ModuleTypes */
module.exports.ASSET_MODULE_TYPE = ASSET_MODULE_TYPE;
module.exports.ASSET_MODULE_TYPE_BYTES = ASSET_MODULE_TYPE_BYTES;
module.exports.ASSET_MODULE_TYPE_INLINE = ASSET_MODULE_TYPE_INLINE;
module.exports.ASSET_MODULE_TYPE_RAW_DATA_URL = ASSET_MODULE_TYPE_RAW_DATA_URL;
module.exports.ASSET_MODULE_TYPE_RESOURCE = ASSET_MODULE_TYPE_RESOURCE;

View File

@ -114,6 +114,7 @@ const {
/** @typedef {import("./ModuleTypeConstants").ASSET_MODULE_TYPE_INLINE} ASSET_MODULE_TYPE_INLINE */
/** @typedef {import("./ModuleTypeConstants").ASSET_MODULE_TYPE_RESOURCE} ASSET_MODULE_TYPE_RESOURCE */
/** @typedef {import("./ModuleTypeConstants").ASSET_MODULE_TYPE_SOURCE} ASSET_MODULE_TYPE_SOURCE */
/** @typedef {import("./ModuleTypeConstants").ASSET_MODULE_TYPE_BYTES} ASSET_MODULE_TYPE_BYTES */
/** @typedef {import("./ModuleTypeConstants").WEBASSEMBLY_MODULE_TYPE_ASYNC} WEBASSEMBLY_MODULE_TYPE_ASYNC */
/** @typedef {import("./ModuleTypeConstants").WEBASSEMBLY_MODULE_TYPE_SYNC} WEBASSEMBLY_MODULE_TYPE_SYNC */
/** @typedef {import("./ModuleTypeConstants").CSS_MODULE_TYPE} CSS_MODULE_TYPE */
@ -268,6 +269,76 @@ const ruleSetCompiler = new RuleSetCompiler([
new UseEffectRulePlugin()
]);
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("./javascript/JavascriptGenerator")} JavascriptGenerator */
/** @typedef {import("../declarations/WebpackOptions").EmptyGeneratorOptions} EmptyGeneratorOptions */
/** @typedef {import("./json/JsonParser")} JsonParser */
/** @typedef {import("../declarations/WebpackOptions").JsonParserOptions} JsonParserOptions */
/** @typedef {import("./json/JsonGenerator")} JsonGenerator */
/** @typedef {import("../declarations/WebpackOptions").JsonGeneratorOptions} JsonGeneratorOptions */
/** @typedef {import("./asset/AssetParser")} AssetParser */
/** @typedef {import("./asset/AssetSourceParser")} AssetSourceParser */
/** @typedef {import("./asset/AssetBytesParser")} AssetBytesParser */
/** @typedef {import("../declarations/WebpackOptions").AssetParserOptions} AssetParserOptions */
/** @typedef {import("../declarations/WebpackOptions").EmptyParserOptions} EmptyParserOptions */
/** @typedef {import("./asset/AssetGenerator")} AssetGenerator */
/** @typedef {import("../declarations/WebpackOptions").AssetGeneratorOptions} AssetGeneratorOptions */
/** @typedef {import("../declarations/WebpackOptions").AssetInlineGeneratorOptions} AssetInlineGeneratorOptions */
/** @typedef {import("../declarations/WebpackOptions").AssetResourceGeneratorOptions} AssetResourceGeneratorOptions */
/** @typedef {import("./asset/AssetSourceGenerator")} AssetSourceGenerator */
/** @typedef {import("./asset/AssetBytesGenerator")} AssetBytesGenerator */
/** @typedef {import("./wasm-async/AsyncWebAssemblyParser")} AsyncWebAssemblyParser */
/** @typedef {import("./wasm-sync/WebAssemblyParser")} WebAssemblyParser */
/** @typedef {import("./css/CssParser")} CssParser */
/** @typedef {import("../declarations/WebpackOptions").CssParserOptions} CssParserOptions */
/** @typedef {import("../declarations/WebpackOptions").CssAutoParserOptions} CssAutoParserOptions */
/** @typedef {import("../declarations/WebpackOptions").CssGlobalParserOptions} CssGlobalParserOptions */
/** @typedef {import("../declarations/WebpackOptions").CssModuleParserOptions} CssModuleParserOptions */
/** @typedef {import("./css/CssGenerator")} CssGenerator */
/** @typedef {import("../declarations/WebpackOptions").CssGeneratorOptions} CssGeneratorOptions */
/** @typedef {import("../declarations/WebpackOptions").CssGlobalGeneratorOptions} CssGlobalGeneratorOptions */
/** @typedef {import("../declarations/WebpackOptions").CssModuleGeneratorOptions} CssModuleGeneratorOptions */
/** @typedef {import("../declarations/WebpackOptions").CssAutoGeneratorOptions} CssAutoGeneratorOptions */
/**
* @typedef {[
* [JAVASCRIPT_MODULE_TYPE_AUTO, JavascriptParser, JavascriptParserOptions, JavascriptGenerator, EmptyGeneratorOptions],
* [JAVASCRIPT_MODULE_TYPE_DYNAMIC, JavascriptParser, JavascriptParserOptions, JavascriptGenerator, EmptyGeneratorOptions],
* [JAVASCRIPT_MODULE_TYPE_ESM, JavascriptParser, JavascriptParserOptions, JavascriptGenerator, EmptyGeneratorOptions],
* [JSON_MODULE_TYPE, JsonParser, JsonParserOptions, JsonGenerator, JsonGeneratorOptions],
* [ASSET_MODULE_TYPE, AssetParser, AssetParserOptions, AssetGenerator, AssetGeneratorOptions],
* [ASSET_MODULE_TYPE_INLINE, AssetParser, EmptyParserOptions, AssetGenerator, AssetGeneratorOptions],
* [ASSET_MODULE_TYPE_RESOURCE, AssetParser, EmptyParserOptions, AssetGenerator, AssetGeneratorOptions],
* [ASSET_MODULE_TYPE_SOURCE, AssetSourceParser, EmptyParserOptions, AssetSourceGenerator, EmptyGeneratorOptions],
* [ASSET_MODULE_TYPE_BYTES, AssetBytesParser, EmptyParserOptions, AssetBytesGenerator, EmptyGeneratorOptions],
* [WEBASSEMBLY_MODULE_TYPE_ASYNC, AsyncWebAssemblyParser, EmptyParserOptions, Generator, EmptyParserOptions],
* [WEBASSEMBLY_MODULE_TYPE_SYNC, WebAssemblyParser, EmptyParserOptions, Generator, EmptyParserOptions],
* [CSS_MODULE_TYPE, CssParser, CssParserOptions, CssGenerator, CssGeneratorOptions],
* [CSS_MODULE_TYPE_AUTO, CssParser, CssAutoParserOptions, CssGenerator, CssAutoGeneratorOptions],
* [CSS_MODULE_TYPE_MODULE, CssParser, CssModuleParserOptions, CssGenerator, CssModuleGeneratorOptions],
* [CSS_MODULE_TYPE_GLOBAL, CssParser, CssGlobalParserOptions, CssGenerator, CssGlobalGeneratorOptions],
* [string, Parser, ParserOptions, Generator, GeneratorOptions],
* ]} ParsersAndGeneratorsByTypes
*/
/**
* @template {unknown[]} T
* @template {number[]} I
* @typedef {{ [K in keyof I]: K extends keyof I ? I[K] extends keyof T ? T[I[K]] : never : never }} ExtractTupleElements
*/
/**
* @template {unknown[]} T
* @template {number[]} A
* @template [R=void]
* @typedef {T extends [infer Head extends [string, ...unknown[]], ...infer Tail extends [string, ...unknown[]][]] ? Record<Head[0], SyncBailHook<ExtractTupleElements<Head, A>, R extends number ? Head[R] : R>> & RecordFactoryFromTuple<Tail, A, R> : unknown } RecordFactoryFromTuple
*/
class NormalModuleFactory extends ModuleFactory {
/**
* @param {object} param params
@ -306,15 +377,15 @@ class NormalModuleFactory extends ModuleFactory {
createModule: new AsyncSeriesBailHook(["createData", "resolveData"]),
/** @type {SyncWaterfallHook<[Module, CreateData, ResolveData]>} */
module: new SyncWaterfallHook(["module", "createData", "resolveData"]),
/** @type {HookMap<SyncBailHook<[ParserOptions], Parser | void>>} */
/** @type {import("tapable").TypedHookMap<RecordFactoryFromTuple<ParsersAndGeneratorsByTypes, [2], 1>>} */
createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
/** @type {HookMap<SyncBailHook<[EXPECTED_ANY, ParserOptions], void>>} */
/** @type {import("tapable").TypedHookMap<RecordFactoryFromTuple<ParsersAndGeneratorsByTypes, [1, 2]>>} */
parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
/** @type {HookMap<SyncBailHook<[GeneratorOptions], Generator | void>>} */
/** @type {import("tapable").TypedHookMap<RecordFactoryFromTuple<ParsersAndGeneratorsByTypes, [4], 3>>} */
createGenerator: new HookMap(
() => new SyncBailHook(["generatorOptions"])
),
/** @type {HookMap<SyncBailHook<[EXPECTED_ANY, GeneratorOptions], void>>} */
/** @type {import("tapable").TypedHookMap<RecordFactoryFromTuple<ParsersAndGeneratorsByTypes, [3, 4]>>} */
generator: new HookMap(
() => new SyncHook(["generator", "generatorOptions"])
),

View File

@ -416,6 +416,11 @@ module.exports.systemContext = "__webpack_require__.y";
*/
module.exports.thisAsExports = "top-level-this-exports";
/**
* to binary helper, convert base64 to Uint8Array
*/
module.exports.toBinary = "__webpack_require__.tb";
/**
* the uncaught error handler for the webpack runtime
*/

View File

@ -32,6 +32,7 @@ const PublicPathRuntimeModule = require("./runtime/PublicPathRuntimeModule");
const RelativeUrlRuntimeModule = require("./runtime/RelativeUrlRuntimeModule");
const RuntimeIdRuntimeModule = require("./runtime/RuntimeIdRuntimeModule");
const SystemContextRuntimeModule = require("./runtime/SystemContextRuntimeModule");
const ToBinaryRuntimeModule = require("./runtime/ToBinaryRuntimeModule");
const ShareRuntimeModule = require("./sharing/ShareRuntimeModule");
const StringXor = require("./util/StringXor");
const memoize = require("./util/memoize");
@ -489,6 +490,12 @@ class RuntimePlugin {
compilation.addRuntimeModule(chunk, new NonceRuntimeModule());
return true;
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.toBinary)
.tap(PLUGIN_NAME, (chunk) => {
compilation.addRuntimeModule(chunk, new ToBinaryRuntimeModule());
return true;
});
// TODO webpack 6: remove CompatRuntimeModule
compilation.hooks.additionalTreeRuntimeRequirements.tap(
PLUGIN_NAME,

View File

@ -107,7 +107,7 @@ class RuntimeTemplate {
isNeutralPlatform() {
return (
!this.outputOptions.environment.document &&
!this.compilation.compiler.platform.web &&
!this.compilation.compiler.platform.node
);
}

View File

@ -0,0 +1,166 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Alexander Akait @alexander-akait
*/
"use strict";
const { RawSource } = require("webpack-sources");
const ConcatenationScope = require("../ConcatenationScope");
const Generator = require("../Generator");
const {
CSS_URL_TYPES,
JS_AND_CSS_URL_TYPES,
JS_TYPES,
NO_TYPES
} = require("../ModuleSourceTypesConstants");
const RuntimeGlobals = require("../RuntimeGlobals");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */
/** @typedef {import("../Module").SourceTypes} SourceTypes */
/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../NormalModule")} NormalModule */
class AssetSourceGenerator extends Generator {
/**
* @param {ModuleGraph} moduleGraph the module graph
*/
constructor(moduleGraph) {
super();
this._moduleGraph = moduleGraph;
}
/**
* @param {NormalModule} module module for which the code should be generated
* @param {GenerateContext} generateContext context for generate
* @returns {Source | null} generated code
*/
generate(
module,
{ type, concatenationScope, getData, runtimeTemplate, runtimeRequirements }
) {
const originalSource = module.originalSource();
const data = getData ? getData() : undefined;
switch (type) {
case "javascript": {
if (!originalSource) {
return new RawSource("");
}
const encodedSource = originalSource.buffer().toString("base64");
runtimeRequirements.add(RuntimeGlobals.toBinary);
let sourceContent;
if (concatenationScope) {
concatenationScope.registerNamespaceExport(
ConcatenationScope.NAMESPACE_OBJECT_EXPORT
);
sourceContent = `${runtimeTemplate.renderConst()} ${
ConcatenationScope.NAMESPACE_OBJECT_EXPORT
} = ${RuntimeGlobals.toBinary}(${JSON.stringify(encodedSource)});`;
} else {
runtimeRequirements.add(RuntimeGlobals.module);
sourceContent = `${RuntimeGlobals.module}.exports = ${RuntimeGlobals.toBinary}(${JSON.stringify(
encodedSource
)});`;
}
return new RawSource(sourceContent);
}
case "css-url": {
if (!originalSource) {
return null;
}
const encodedSource = originalSource.buffer().toString("base64");
if (data) {
data.set("url", {
[type]: `data:application/octet-stream;base64,${encodedSource}`
});
}
return null;
}
default:
return null;
}
}
/**
* @param {Error} error the error
* @param {NormalModule} module module for which the code should be generated
* @param {GenerateContext} generateContext context for generate
* @returns {Source | null} generated code
*/
generateError(error, module, generateContext) {
switch (generateContext.type) {
case "javascript": {
return new RawSource(
`throw new Error(${JSON.stringify(error.message)});`
);
}
default:
return null;
}
}
/**
* @param {NormalModule} module module for which the bailout reason should be determined
* @param {ConcatenationBailoutReasonContext} context context
* @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated
*/
getConcatenationBailoutReason(module, context) {
return undefined;
}
/**
* @param {NormalModule} module fresh module
* @returns {SourceTypes} available types (do not mutate)
*/
getTypes(module) {
/** @type {Set<string>} */
const sourceTypes = new Set();
const connections = this._moduleGraph.getIncomingConnections(module);
for (const connection of connections) {
if (!connection.originModule) {
continue;
}
sourceTypes.add(connection.originModule.type.split("/")[0]);
}
if (sourceTypes.size > 0) {
if (sourceTypes.has("javascript") && sourceTypes.has("css")) {
return JS_AND_CSS_URL_TYPES;
} else if (sourceTypes.has("css")) {
return CSS_URL_TYPES;
}
return JS_TYPES;
}
return NO_TYPES;
}
/**
* @param {NormalModule} module the module
* @param {string=} type source type
* @returns {number} estimate size of the module
*/
getSize(module, type) {
const originalSource = module.originalSource();
if (!originalSource) {
return 0;
}
// Example: m.exports="abcd"
return originalSource.size() + 12;
}
}
module.exports = AssetSourceGenerator;

View File

@ -0,0 +1,37 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Alexander Akait @alexander-akait
*/
"use strict";
const Parser = require("../Parser");
/** @typedef {import("../Module").BuildInfo} BuildInfo */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../Parser").ParserState} ParserState */
/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */
class AssetBytesParser extends Parser {
/**
* @param {string | Buffer | PreparsedAst} source the source to parse
* @param {ParserState} state the parser state
* @returns {ParserState} the parser state
*/
parse(source, state) {
if (typeof source === "object" && !Buffer.isBuffer(source)) {
throw new Error("AssetBytesParser doesn't accept preparsed AST");
}
const { module } = state;
/** @type {BuildInfo} */
(module.buildInfo).strict = true;
/** @type {BuildMeta} */
(module.buildMeta).exportsType = "default";
/** @type {BuildMeta} */
(state.module.buildMeta).defaultObject = false;
return state;
}
}
module.exports = AssetBytesParser;

View File

@ -7,6 +7,7 @@
const {
ASSET_MODULE_TYPE,
ASSET_MODULE_TYPE_BYTES,
ASSET_MODULE_TYPE_INLINE,
ASSET_MODULE_TYPE_RESOURCE,
ASSET_MODULE_TYPE_SOURCE
@ -70,9 +71,11 @@ const validateParserOptions = createSchemaValidation(
const getAssetGenerator = memoize(() => require("./AssetGenerator"));
const getAssetParser = memoize(() => require("./AssetParser"));
const getAssetSourceParser = memoize(() => require("./AssetSourceParser"));
const getAssetBytesParser = memoize(() => require("./AssetBytesParser"));
const getAssetSourceGenerator = memoize(() =>
require("./AssetSourceGenerator")
);
const getAssetBytesGenerator = memoize(() => require("./AssetBytesGenerator"));
const type = ASSET_MODULE_TYPE;
const PLUGIN_NAME = "AssetModulesPlugin";
@ -125,6 +128,13 @@ class AssetModulesPlugin {
return new AssetSourceParser();
});
normalModuleFactory.hooks.createParser
.for(ASSET_MODULE_TYPE_BYTES)
.tap(PLUGIN_NAME, (_parserOptions) => {
const AssetBytesParser = getAssetBytesParser();
return new AssetBytesParser();
});
for (const type of [
ASSET_MODULE_TYPE,
@ -177,6 +187,14 @@ class AssetModulesPlugin {
return new AssetSourceGenerator(compilation.moduleGraph);
});
normalModuleFactory.hooks.createGenerator
.for(ASSET_MODULE_TYPE_BYTES)
.tap(PLUGIN_NAME, () => {
const AssetBytesGenerator = getAssetBytesGenerator();
return new AssetBytesGenerator(compilation.moduleGraph);
});
compilation.hooks.renderManifest.tap(PLUGIN_NAME, (result, options) => {
const { chunkGraph } = compilation;
const { chunk, codeGenerationResults, runtimeTemplate } = options;

View File

@ -15,59 +15,46 @@ const browserslist = require("browserslist");
// [[C:]/path/to/config][:env]
const inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
/**
* @typedef {object} BrowserslistHandlerConfig
* @property {string=} configPath
* @property {string=} env
* @property {string=} query
*/
/**
* @param {string | null | undefined} input input string
* @param {string} context the context directory
* @returns {BrowserslistHandlerConfig} config
*/
const parse = (input, context) => {
if (!input) {
return {};
}
if (path.isAbsolute(input)) {
const [, configPath, env] = inputRx.exec(input) || [];
return { configPath, env };
}
const config = browserslist.findConfig(context);
if (config && Object.keys(config).includes(input)) {
return { env: input };
}
return { query: input };
};
/**
* @param {string | null | undefined} input input string
* @param {string} context the context directory
* @returns {string[] | undefined} selected browsers
*/
const load = (input, context) => {
const { configPath, env, query } = parse(input, context);
// browserslist:path-to-config
// browserslist:path-to-config:env
if (input && path.isAbsolute(input)) {
const [, configPath, env] = inputRx.exec(input) || [];
// if a query is specified, then use it, else
// if a path to a config is specified then load it, else
// find a nearest config
const config =
query ||
(configPath
? browserslist.loadConfig({
config: configPath,
env
})
: browserslist.loadConfig({ path: context, env }));
const config = browserslist.loadConfig({
config: configPath,
env
});
if (!config) return;
return browserslist(config);
return browserslist(config, { env });
}
const env = input || undefined;
const config = browserslist.loadConfig({
path: context,
env
});
// browserslist
// browserslist:env
if (config) {
try {
return browserslist(config, { env, throwOnMissing: true });
} catch (_err) {
// Nothing, no `env` was found in browserslist, maybe input is `queries`
}
}
// browserslist:query
if (env) {
return browserslist(env);
}
};
/**
@ -104,28 +91,6 @@ const resolve = (browsers) => {
const anyBrowser = browsers.some((b) => /^(?!node)/.test(b));
const browserProperty = !anyBrowser ? false : anyNode ? null : true;
const nodeProperty = !anyNode ? false : anyBrowser ? null : true;
// Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features
const es6DynamicImport = rawChecker({
/* eslint-disable camelcase */
chrome: 63,
and_chr: 63,
edge: 79,
firefox: 67,
and_ff: 67,
// ie: Not supported
opera: 50,
op_mob: 46,
safari: [11, 1],
ios_saf: [11, 3],
samsung: [8, 2],
android: 63,
and_qq: [10, 4],
baidu: [13, 18],
and_uc: [15, 5],
kaios: [3, 0],
node: [12, 17]
/* eslint-enable camelcase */
});
return {
/* eslint-disable camelcase */
@ -188,9 +153,9 @@ const resolve = (browsers) => {
ios_saf: 7,
samsung: [3, 0],
android: 38,
// and_qq: Unknown support
and_qq: [10, 4],
// baidu: Unknown support
// and_uc: Unknown support
and_uc: [12, 12],
kaios: [3, 0],
node: [0, 12]
}),
@ -207,9 +172,9 @@ const resolve = (browsers) => {
ios_saf: 8,
samsung: [5, 0],
android: 49,
// and_qq: Unknown support
and_qq: [10, 4],
// baidu: Unknown support
// and_uc: Unknown support
and_uc: [12, 12],
kaios: [2, 5],
node: [6, 0]
}),
@ -253,8 +218,44 @@ const resolve = (browsers) => {
kaios: [3, 0],
node: [12, 17]
}),
dynamicImport: es6DynamicImport,
dynamicImportInWorker: es6DynamicImport && !anyNode,
dynamicImport: rawChecker({
chrome: 63,
and_chr: 63,
edge: 79,
firefox: 67,
and_ff: 67,
// ie: Not supported
opera: 50,
op_mob: 46,
safari: [11, 1],
ios_saf: [11, 3],
samsung: [8, 2],
android: 63,
and_qq: [10, 4],
baidu: [13, 18],
and_uc: [15, 5],
kaios: [3, 0],
node: [12, 17]
}),
dynamicImportInWorker: rawChecker({
chrome: 80,
and_chr: 80,
edge: 80,
firefox: 114,
and_ff: 114,
// ie: Not supported
opera: 67,
op_mob: 57,
safari: [15, 0],
ios_saf: [15, 0],
samsung: [13, 0],
android: 80,
and_qq: [10, 4],
baidu: [13, 18],
and_uc: [15, 5],
kaios: [3, 0],
node: [12, 17]
}),
// browserslist does not have info about globalThis
// so this is based on mdn-browser-compat-data
globalThis: rawChecker({
@ -270,9 +271,9 @@ const resolve = (browsers) => {
ios_saf: [12, 2],
samsung: [10, 1],
android: 71,
// and_qq: Unknown support
and_qq: [13, 1],
// baidu: Unknown support
// and_uc: Unknown support
and_uc: [15, 5],
kaios: [3, 0],
node: 12
}),
@ -289,9 +290,9 @@ const resolve = (browsers) => {
ios_saf: [13, 4],
samsung: 13,
android: 80,
// and_qq: Not supported
and_qq: [13, 1],
// baidu: Not supported
// and_uc: Not supported
and_uc: [15, 5],
kaios: [3, 0],
node: 14
}),
@ -327,9 +328,9 @@ const resolve = (browsers) => {
ios_saf: 11,
samsung: [6, 2],
android: 55,
and_qq: [13, 1],
and_qq: [10, 4],
baidu: [13, 18],
and_uc: [15, 5],
and_uc: [12, 12],
kaios: 3,
node: [7, 6]
}),
@ -345,7 +346,7 @@ const resolve = (browsers) => {
fetchWasm: browserProperty,
global: nodeProperty,
importScripts: false,
importScriptsInWorker: true,
importScriptsInWorker: Boolean(browserProperty),
nodeBuiltins: nodeProperty,
nodePrefixForCoreModules:
nodeProperty &&

View File

@ -9,6 +9,7 @@ const fs = require("fs");
const path = require("path");
const {
ASSET_MODULE_TYPE,
ASSET_MODULE_TYPE_BYTES,
ASSET_MODULE_TYPE_INLINE,
ASSET_MODULE_TYPE_RESOURCE,
ASSET_MODULE_TYPE_SOURCE,
@ -1066,6 +1067,10 @@ const applyModuleDefaults = (
{
with: { type: "text" },
type: ASSET_MODULE_TYPE_SOURCE
},
{
with: { type: "bytes" },
type: ASSET_MODULE_TYPE_BYTES
}
);
return rules;
@ -1321,8 +1326,13 @@ const applyOutputDefaults = (
if (tp.importScripts) return "array-push";
throw new Error(
"For the selected environment is no default script chunk format available:\n" +
"JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" +
`CommonJs exports can be chosen when 'require' or node builtins are available.\n${
`${
tp.module
? "Module ('module') can be chosen when ES modules are available (please set 'experiments.outputModule' and 'output.module' to `true`)"
: ""
}\n` +
"JSONP Array push ('array-push') can be chosen when 'document' or 'importScripts' is available.\n" +
`CommonJs exports ('commonjs') can be chosen when 'require' or node builtins are available.\n${
helpMessage
}`
);

View File

@ -16,7 +16,7 @@ const getBrowserslistTargetHandler = memoize(() =>
* @returns {string} default target
*/
const getDefaultTarget = (context) => {
const browsers = getBrowserslistTargetHandler().load(null, context);
const browsers = getBrowserslistTargetHandler().load(undefined, context);
return browsers ? "browserslist" : "web";
};

View File

@ -13,6 +13,7 @@ const {
const { getTrimmedIdsAndRange } = require("../util/chainedImports");
const makeSerializable = require("../util/makeSerializable");
const propertyAccess = require("../util/propertyAccess");
const traverseDestructuringAssignmentProperties = require("../util/traverseDestructuringAssignmentProperties");
const HarmonyImportDependency = require("./HarmonyImportDependency");
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
@ -194,10 +195,16 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
*/
_getReferencedExportsInDestructuring(ids) {
if (this.referencedPropertiesInDestructuring) {
/** @type {RawReferencedExports} */
const refsInDestructuring = [];
traverseDestructuringAssignmentProperties(
this.referencedPropertiesInDestructuring,
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
);
/** @type {RawReferencedExports} */
const refs = [];
for (const { id } of this.referencedPropertiesInDestructuring) {
refs.push(ids ? [...ids, id] : [id]);
for (const idsInDestructuring of refsInDestructuring) {
refs.push(ids ? [...ids, ...idsInDestructuring] : idsInDestructuring);
}
return refs;
}
@ -374,13 +381,23 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
}
}
for (const {
id,
shorthand,
range
} of dep.referencedPropertiesInDestructuring) {
/** @type {{ ids: Ids, range: Range, shorthand: boolean | string }[]} */
const replacementsInDestructuring = [];
traverseDestructuringAssignmentProperties(
dep.referencedPropertiesInDestructuring,
undefined,
(stack) => {
const property = stack[stack.length - 1];
replacementsInDestructuring.push({
ids: stack.map((p) => p.id),
range: property.range,
shorthand: property.shorthand
});
}
);
for (const { ids, shorthand, range } of replacementsInDestructuring) {
/** @type {Ids} */
const concatedIds = [...prefixedIds, id];
const concatedIds = [...prefixedIds, ...ids];
const module = /** @type {Module} */ (moduleGraph.getModule(dep));
const used = moduleGraph
.getExportsInfo(module)
@ -393,10 +410,8 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
const comment = `${Template.toNormalComment(name)} `;
const key = comment + JSON.stringify(newName);
source.replace(
/** @type {Range} */
(range)[0],
/** @type {Range} */
(range)[1] - 1,
range[0],
range[1] - 1,
shorthand ? `${key}: ${name}` : `${key}`
);
}

View File

@ -115,7 +115,7 @@ class ImportMetaPlugin {
new ModuleDependencyWarning(
parser.state.module,
new CriticalDependencyWarning(
"Accessing import.meta directly is unsupported (only property access or destructuring is supported)"
"'import.meta' cannot be used as a standalone expression. For static analysis, its properties must be accessed directly (e.g., 'import.meta.url') or through destructuring."
),
/** @type {DependencyLocation} */ (metaProperty.loc)
)

View File

@ -8,7 +8,11 @@
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
const CommentCompilationWarning = require("../CommentCompilationWarning");
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
const { getImportAttributes } = require("../javascript/JavascriptParser");
const {
VariableInfo,
getImportAttributes
} = require("../javascript/JavascriptParser");
const traverseDestructuringAssignmentProperties = require("../util/traverseDestructuringAssignmentProperties");
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
const ImportContextDependency = require("./ImportContextDependency");
const ImportDependency = require("./ImportDependency");
@ -123,9 +127,13 @@ function walkImportThenFulfilledCallback(
const references = /** @type {RawReferencedExports} */ (
state.get(importCall)
);
for (const ids of exportsFromEnumerable(
[...referencedPropertiesInDestructuring].map(({ id }) => id)
)) {
/** @type {RawReferencedExports} */
const refsInDestructuring = [];
traverseDestructuringAssignmentProperties(
referencedPropertiesInDestructuring,
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
);
for (const ids of refsInDestructuring) {
references.push(ids);
}
}
@ -184,6 +192,15 @@ class ImportParserPlugin {
PLUGIN_NAME,
(expr) => {
if (expr.type === "ImportExpression") return true;
const nameInfo = parser.getNameForExpression(expr);
if (
nameInfo &&
nameInfo.rootInfo instanceof VariableInfo &&
nameInfo.rootInfo.name &&
parser.getTagData(nameInfo.rootInfo.name, dynamicImportTag)
) {
return true;
}
}
);
parser.hooks.preDeclarator.tap(PLUGIN_NAME, (decl) => {
@ -193,12 +210,27 @@ class ImportParserPlugin {
decl.init.argument.type === "ImportExpression" &&
decl.id.type === "Identifier"
) {
parser.defineVariable(decl.id.name);
tagDynamicImportReferenced(parser, decl.init.argument, decl.id.name);
}
});
parser.hooks.expression.for(dynamicImportTag).tap(PLUGIN_NAME, () => {
parser.hooks.expression.for(dynamicImportTag).tap(PLUGIN_NAME, (expr) => {
const settings = /** @type {ImportSettings} */ (parser.currentTagData);
settings.references.push([]);
const referencedPropertiesInDestructuring =
parser.destructuringAssignmentPropertiesFor(expr);
if (referencedPropertiesInDestructuring) {
/** @type {RawReferencedExports} */
const refsInDestructuring = [];
traverseDestructuringAssignmentProperties(
referencedPropertiesInDestructuring,
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
);
for (const ids of refsInDestructuring) {
settings.references.push(ids);
}
} else {
settings.references.push([]);
}
return true;
});
parser.hooks.expressionMemberChain
@ -474,9 +506,14 @@ class ImportParserPlugin {
}
if (referencedPropertiesInDestructuring) {
exports = exportsFromEnumerable(
[...referencedPropertiesInDestructuring].map(({ id }) => id)
/** @type {RawReferencedExports} */
const refsInDestructuring = [];
traverseDestructuringAssignmentProperties(
referencedPropertiesInDestructuring,
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
);
exports = refsInDestructuring;
} else if (referencedPropertiesInMember) {
exports = referencedPropertiesInMember;
} else {
@ -570,6 +607,8 @@ class ImportParserPlugin {
fulfilledNamespaceObj
);
parser.walkExpressions(importThen.arguments.slice(1));
} else if (importThen) {
parser.walkExpressions(importThen.arguments);
}
return true;

View File

@ -106,7 +106,7 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
/** @typedef {Set<DestructuringAssignmentProperty>} DestructuringAssignmentProperties */
// TODO remove cast when @types/estree has been updated to import assertions
/** @typedef {import("estree").ImportExpression & { options?: Expression | null, phase?: "defer" }} ImportExpression */
/** @typedef {import("estree").ImportExpression & { phase?: "defer" }} ImportExpression */
/** @type {string[]} */
const EMPTY_ARRAY = [];
@ -342,7 +342,8 @@ const SCOPE_INFO_TERMINATED_THROW = 2;
/**
* @typedef {object} DestructuringAssignmentProperty
* @property {string} id
* @property {Range | undefined=} range
* @property {Range} range
* @property {Set<DestructuringAssignmentProperty> | undefined=} pattern
* @property {boolean | string} shorthand
*/
@ -2993,18 +2994,32 @@ class JavascriptParser extends Parser {
}
const key = property.key;
if (key.type === "Identifier" && !property.computed) {
const pattern =
property.value.type === "ObjectPattern"
? this._preWalkObjectPattern(property.value)
: property.value.type === "ArrayPattern"
? this._preWalkArrayPattern(property.value)
: undefined;
props.add({
id: key.name,
range: key.range,
range: /** @type {Range} */ (key.range),
pattern,
shorthand: this.scope.inShorthand
});
} else {
const id = this.evaluateExpression(key);
const str = id.asString();
if (str) {
const pattern =
property.value.type === "ObjectPattern"
? this._preWalkObjectPattern(property.value)
: property.value.type === "ArrayPattern"
? this._preWalkArrayPattern(property.value)
: undefined;
props.add({
id: str,
range: key.range,
range: /** @type {Range} */ (key.range),
pattern,
shorthand: this.scope.inShorthand
});
} else {
@ -3018,6 +3033,35 @@ class JavascriptParser extends Parser {
return props;
}
/**
* @param {ArrayPattern} arrayPattern array pattern
* @returns {Set<DestructuringAssignmentProperty> | undefined} set of names or undefined if not all keys are identifiers
*/
_preWalkArrayPattern(arrayPattern) {
/** @type {Set<DestructuringAssignmentProperty>} */
const props = new Set();
const elements = arrayPattern.elements;
for (let i = 0; i < elements.length; i++) {
const element = elements[i];
if (!element) continue;
if (element.type === "RestElement") return;
const pattern =
element.type === "ObjectPattern"
? this._preWalkObjectPattern(element)
: element.type === "ArrayPattern"
? this._preWalkArrayPattern(element)
: undefined;
props.add({
id: `${i}`,
range: /** @type {Range} */ (element.range),
pattern,
shorthand: false
});
}
return props;
}
/**
* @param {VariableDeclarator} declarator variable declarator
*/

View File

@ -23,6 +23,7 @@ const Template = require("../Template");
const { DEFAULTS } = require("../config/defaults");
const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency");
const HarmonyImportSpecifierDependency = require("../dependencies/HarmonyImportSpecifierDependency");
const JavascriptParser = require("../javascript/JavascriptParser");
const {
getMakeDeferredNamespaceModeFromExportsType,
@ -1832,6 +1833,25 @@ ${defineGetters}`
if (!source) continue;
result.add(source);
}
if (info.type === "external" && info.deferred) {
const moduleId = JSON.stringify(chunkGraph.getModuleId(info.module));
const loader = getOptimizedDeferredModule(
runtimeTemplate,
info.module.getExportsType(
moduleGraph,
/** @type {BuildMeta} */
(this.rootModule.buildMeta).strictHarmonyModule
),
moduleId,
// an async module will opt-out of the concat module optimization.
[]
);
runtimeRequirements.add(RuntimeGlobals.require);
result.add(
`\n// DEFERRED EXTERNAL MODULE: ${info.module.readableIdentifier(requestShortener)}\nvar ${info.deferredName} = ${loader};`
);
}
}
/** @type {InitFragment<ChunkRenderContext>[]} */
@ -1855,10 +1875,19 @@ ${defineGetters}`
for (const dep of info.module.dependencies) {
if (
!(/** @type {HarmonyImportDependency} */ (dep).defer) &&
dep instanceof HarmonyImportSideEffectDependency
(dep instanceof HarmonyImportSideEffectDependency ||
dep instanceof HarmonyImportSpecifierDependency)
) {
const referredModule = moduleGraph.getModule(dep);
if (!referredModule) continue;
if (!referredModule) {
if (dep instanceof HarmonyImportSideEffectDependency) {
continue;
} else {
throw new Error(
"Deferred module used, but no module in the graph."
);
}
}
if (moduleGraph.isDeferred(referredModule)) {
const deferredModuleInfo = /** @type {ExternalModuleInfo} */ (
modulesWithInfo.find(
@ -1887,41 +1916,30 @@ ${defineGetters}`
break;
}
case "external": {
result.add(
`\n// EXTERNAL MODULE: ${info.module.readableIdentifier(
requestShortener
)}\n`
);
runtimeRequirements.add(RuntimeGlobals.require);
const { runtimeCondition } =
/** @type {ExternalModuleInfo | ReferenceToModuleInfo} */
(rawInfo);
const condition = runtimeTemplate.runtimeConditionExpression({
chunkGraph,
runtimeCondition,
runtime,
runtimeRequirements
});
if (condition !== "true") {
isConditional = true;
result.add(`if (${condition}) {\n`);
}
const moduleId = JSON.stringify(chunkGraph.getModuleId(info.module));
if (info.deferred) {
const loader = getOptimizedDeferredModule(
runtimeTemplate,
info.module.getExportsType(
moduleGraph,
/** @type {BuildMeta} */
(this.rootModule.buildMeta).strictHarmonyModule
),
moduleId,
// an async module will opt-out of the concat module optimization.
[]
// deferred case is handled in the "const info of modulesWithInfo" loop above
if (!info.deferred) {
result.add(
`\n// EXTERNAL MODULE: ${info.module.readableIdentifier(
requestShortener
)}\n`
);
runtimeRequirements.add(RuntimeGlobals.require);
const { runtimeCondition } =
/** @type {ExternalModuleInfo | ReferenceToModuleInfo} */
(rawInfo);
const condition = runtimeTemplate.runtimeConditionExpression({
chunkGraph,
runtimeCondition,
runtime,
runtimeRequirements
});
if (condition !== "true") {
isConditional = true;
result.add(`if (${condition}) {\n`);
}
const moduleId = JSON.stringify(
chunkGraph.getModuleId(info.module)
);
result.add(`var ${info.deferredName} = ${loader};`);
name = info.deferredName;
} else {
result.add(`var ${info.name} = __webpack_require__(${moduleId});`);
name = info.name;
}

View File

@ -174,7 +174,7 @@ class MakeDeferredNamespaceObjectRuntimeModule extends HelperRuntimeModule {
])},`,
`ownKeys: ${runtimeTemplate.basicFunction("", [
init,
`var keys = Reflect.ownKeys(ns).filter(${runtimeTemplate.expressionFunction('x !== "then"', "x")}).concat([Symbol.toStringTag]);`,
`var keys = Reflect.ownKeys(ns).filter(${runtimeTemplate.expressionFunction('x !== "then" && x !== Symbol.toStringTag', "x")}).concat([Symbol.toStringTag]);`,
"return keys;"
])},`,
`getOwnPropertyDescriptor: ${runtimeTemplate.basicFunction("_, name", [

View File

@ -0,0 +1,64 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Alexander Akait @alexander-akait
*/
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const RuntimeModule = require("../RuntimeModule");
const Template = require("../Template");
/** @typedef {import("../Compilation")} Compilation */
class ToBinaryRuntimeModule extends RuntimeModule {
constructor() {
super("to binary");
}
/**
* @returns {string | null} runtime code
*/
generate() {
const compilation = /** @type {Compilation} */ (this.compilation);
const fn = RuntimeGlobals.toBinary;
const { runtimeTemplate } = compilation;
// Inspired by esbuild
const isNodePlatform = compilation.compiler.platform.node;
const isWebPlatform = compilation.compiler.platform.web;
const isNeutralPlatform = runtimeTemplate.isNeutralPlatform();
return Template.asString([
"// define to binary helper",
`${fn} = ${isNeutralPlatform ? "typeof Buffer !== 'undefined' ? " : ""}${
isNodePlatform || isNeutralPlatform
? `${runtimeTemplate.returningFunction("new Uint8Array(Buffer.from(base64, 'base64'))", "base64")}`
: ""
} ${isNeutralPlatform ? ": " : ""}${
isWebPlatform || isNeutralPlatform
? `(${runtimeTemplate.basicFunction("", [
"var table = new Uint8Array(128);",
"for (var i = 0; i < 64; i++) table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;",
`return ${runtimeTemplate.basicFunction("base64", [
"var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == '=') - (base64[n - 2] == '=')) * 3 / 4 | 0);",
"for (var i = 0, j = 0; i < n;) {",
Template.indent([
"var c0 = table[base64.charCodeAt(i++)], c1 = table[base64.charCodeAt(i++)];",
"var c2 = table[base64.charCodeAt(i++)], c3 = table[base64.charCodeAt(i++)];",
"bytes[j++] = (c0 << 2) | (c1 >> 4);",
"bytes[j++] = (c1 << 4) | (c2 >> 2);",
"bytes[j++] = (c2 << 6) | c3;"
]),
"}",
"return bytes"
])}`
])})();`
: ""
}`
]);
}
}
module.exports = ToBinaryRuntimeModule;

View File

@ -805,7 +805,10 @@ const SIMPLE_EXTRACTORS = {
}
object.assetsByChunkName = {};
for (const [file, chunks] of compilationFileToChunks) {
for (const [file, chunks] of [
...compilationFileToChunks,
...compilationAuxiliaryFileToChunks
]) {
for (const chunk of chunks) {
const name = chunk.name;
if (!name) continue;

View File

@ -8,7 +8,7 @@
const memoize = require("./memoize");
/** @typedef {import("schema-utils").Schema} Schema */
/** @typedef {import("schema-utils/declarations/validate").ValidationErrorConfiguration} ValidationErrorConfiguration */
/** @typedef {import("schema-utils").ValidationErrorConfiguration} ValidationErrorConfiguration */
const getValidate = memoize(() => require("schema-utils").validate);

View File

@ -0,0 +1,45 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("../javascript/JavascriptParser").DestructuringAssignmentProperties} DestructuringAssignmentProperties */
/** @typedef {import("../javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
/**
* Deep first traverse the properties of a destructuring assignment.
* @param {DestructuringAssignmentProperties} properties destructuring assignment properties
* @param {((stack: DestructuringAssignmentProperty[]) => void) | undefined=} onLeftNode on left node callback
* @param {((stack: DestructuringAssignmentProperty[]) => void) | undefined=} enterNode enter node callback
* @param {((stack: DestructuringAssignmentProperty[]) => void) | undefined=} exitNode exit node callback
* @param {DestructuringAssignmentProperty[] | undefined=} stack stack of the walking nodes
*/
function traverseDestructuringAssignmentProperties(
properties,
onLeftNode,
enterNode,
exitNode,
stack = []
) {
for (const property of properties) {
stack.push(property);
if (enterNode) enterNode(stack);
if (property.pattern) {
traverseDestructuringAssignmentProperties(
property.pattern,
onLeftNode,
enterNode,
exitNode,
stack
);
} else if (onLeftNode) {
onLeftNode(stack);
}
if (exitNode) exitNode(stack);
stack.pop();
}
}
module.exports = traverseDestructuringAssignmentProperties;

View File

@ -26,15 +26,6 @@ const decoderOpts = {
};
class WebAssemblyParser extends Parser {
/**
* @param {{}=} options parser options
*/
constructor(options) {
super();
this.hooks = Object.freeze({});
this.options = options;
}
/**
* @param {string | Buffer | PreparsedAst} source the source to parse
* @param {ParserState} state the parser state

View File

@ -63,15 +63,6 @@ const decoderOpts = {
};
class WebAssemblyParser extends Parser {
/**
* @param {{}=} options parser options
*/
constructor(options) {
super();
this.hooks = Object.freeze({});
this.options = options;
}
/**
* @param {string | Buffer | PreparsedAst} source the source to parse
* @param {ParserState} state the parser state

View File

@ -69,7 +69,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
if (options && options.baseUri) {
return `${RuntimeGlobals.baseURI} = ${JSON.stringify(options.baseUri)};`;
}
return `${RuntimeGlobals.baseURI} = (document && document.baseURI) || self.location.href;`;
return `${RuntimeGlobals.baseURI} = (typeof document !== 'undefined' && document.baseURI) || self.location.href;`;
}
/**

View File

@ -1,6 +1,6 @@
{
"name": "webpack",
"version": "5.101.3",
"version": "5.102.0",
"description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
"homepage": "https://github.com/webpack/webpack",
"bugs": "https://github.com/webpack/webpack/issues",
@ -89,7 +89,7 @@
"@webassemblyjs/wasm-parser": "^1.14.1",
"acorn": "^8.15.0",
"acorn-import-phases": "^1.0.3",
"browserslist": "^4.24.5",
"browserslist": "^4.26.3",
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.17.3",
"es-module-lexer": "^1.2.1",
@ -101,8 +101,8 @@
"loader-runner": "^4.2.0",
"mime-types": "^2.1.27",
"neo-async": "^2.6.2",
"schema-utils": "^4.3.2",
"tapable": "^2.2.3",
"schema-utils": "^4.3.3",
"tapable": "^2.3.0",
"terser-webpack-plugin": "^5.3.11",
"watchpack": "^2.4.4",
"webpack-sources": "^3.3.3"
@ -110,17 +110,17 @@
"devDependencies": {
"@babel/core": "^7.27.1",
"@babel/preset-react": "^7.27.1",
"@codspeed/core": "^4.0.1",
"@eslint/js": "^9.29.0",
"@eslint/markdown": "^7.1.0",
"@stylistic/eslint-plugin": "^5.2.2",
"@codspeed/core": "^5.0.1",
"@eslint/js": "^9.36.0",
"@eslint/markdown": "^7.3.0",
"@stylistic/eslint-plugin": "^5.4.0",
"@types/glob-to-regexp": "^0.4.4",
"@types/graceful-fs": "^4.1.9",
"@types/jest": "^30.0.0",
"@types/mime-types": "^2.1.4",
"@types/node": "^24.1.0",
"@types/node": "^24.5.2",
"@types/xxhashjs": "^0.2.4",
"assemblyscript": "^0.28.5",
"assemblyscript": "^0.28.8",
"babel-loader": "^10.0.0",
"bundle-loader": "^0.5.6",
"coffee-loader": "^5.0.0",
@ -131,13 +131,13 @@
"date-fns": "^4.0.0",
"es5-ext": "^0.10.53",
"es6-promise-polyfill": "^1.2.0",
"eslint": "^9.29.0",
"eslint": "^9.36.0",
"eslint-config-prettier": "^10.1.1",
"eslint-config-webpack": "^4.5.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-jsdoc": "^51.2.3",
"eslint-plugin-n": "^17.21.0",
"eslint-plugin-n": "^17.23.1",
"eslint-plugin-prettier": "^5.5.0",
"eslint-plugin-unicorn": "^61.0.1",
"file-loader": "^6.0.0",
@ -146,11 +146,11 @@
"hash-wasm": "^4.9.0",
"husky": "^9.0.11",
"istanbul": "^0.4.5",
"jest": "^30.1.2",
"jest-circus": "^30.1.2",
"jest-cli": "^30.1.2",
"jest-diff": "^30.1.2",
"jest-environment-node": "^30.1.2",
"jest": "^30.2.0",
"jest-circus": "^30.2.0",
"jest-cli": "^30.2.0",
"jest-diff": "^30.2.0",
"jest-environment-node": "^30.2.0",
"jest-junit": "^16.0.0",
"json-loader": "^0.5.7",
"json5": "^2.1.3",
@ -184,7 +184,7 @@
"toml": "^3.0.0",
"tooling": "webpack/tooling#v1.24.3",
"ts-loader": "^9.5.1",
"typescript": "^5.9.2",
"typescript": "^5.9.3",
"url-loader": "^4.1.0",
"wast-loader": "^1.12.1",
"webassembly-feature": "1.3.0",

File diff suppressed because one or more lines are too long

View File

@ -1521,12 +1521,18 @@
"asset": {
"$ref": "#/definitions/AssetGeneratorOptions"
},
"asset/bytes": {
"$ref": "#/definitions/EmptyGeneratorOptions"
},
"asset/inline": {
"$ref": "#/definitions/AssetInlineGeneratorOptions"
},
"asset/resource": {
"$ref": "#/definitions/AssetResourceGeneratorOptions"
},
"asset/source": {
"$ref": "#/definitions/EmptyGeneratorOptions"
},
"css": {
"$ref": "#/definitions/CssGeneratorOptions"
},
@ -1780,7 +1786,7 @@
"JavascriptParserOptions": {
"description": "Parser options for javascript modules.",
"type": "object",
"additionalProperties": true,
"additionalProperties": false,
"properties": {
"amd": {
"$ref": "#/definitions/Amd"
@ -3887,6 +3893,9 @@
"asset": {
"$ref": "#/definitions/AssetParserOptions"
},
"asset/bytes": {
"$ref": "#/definitions/EmptyParserOptions"
},
"asset/inline": {
"$ref": "#/definitions/EmptyParserOptions"
},

View File

@ -3,4 +3,4 @@
* DO NOT MODIFY BY HAND.
* Run `yarn fix:special` to update
*/
"use strict";function n(t,{instancePath:e="",parentData:s,parentDataProperty:l,rootData:a=t}={}){let r=null,o=0;const u=o;let i=!1;const p=o;if(o===p)if(Array.isArray(t)){const n=t.length;for(let e=0;e<n;e++){let n=t[e];const s=o,l=o;let a=!1,u=null;const i=o,p=o;let f=!1;const h=o;if(!(n instanceof RegExp)){const n={params:{}};null===r?r=[n]:r.push(n),o++}var c=h===o;if(f=f||c,!f){const t=o;if(o===t)if("string"==typeof n){if(n.length<1){const n={params:{}};null===r?r=[n]:r.push(n),o++}}else{const n={params:{type:"string"}};null===r?r=[n]:r.push(n),o++}c=t===o,f=f||c}if(f)o=p,null!==r&&(p?r.length=p:r=null);else{const n={params:{}};null===r?r=[n]:r.push(n),o++}if(i===o&&(a=!0,u=0),a)o=l,null!==r&&(l?r.length=l:r=null);else{const n={params:{passingSchemas:u}};null===r?r=[n]:r.push(n),o++}if(s!==o)break}}else{const n={params:{type:"array"}};null===r?r=[n]:r.push(n),o++}var f=p===o;if(i=i||f,!i){const n=o,e=o;let s=!1;const l=o;if(!(t instanceof RegExp)){const n={params:{}};null===r?r=[n]:r.push(n),o++}var h=l===o;if(s=s||h,!s){const n=o;if(o===n)if("string"==typeof t){if(t.length<1){const n={params:{}};null===r?r=[n]:r.push(n),o++}}else{const n={params:{type:"string"}};null===r?r=[n]:r.push(n),o++}h=n===o,s=s||h}if(s)o=e,null!==r&&(e?r.length=e:r=null);else{const n={params:{}};null===r?r=[n]:r.push(n),o++}f=n===o,i=i||f}if(!i){const t={params:{}};return null===r?r=[t]:r.push(t),o++,n.errors=r,!1}return o=u,null!==r&&(u?r.length=u:r=null),n.errors=r,0===o}function t(e,{instancePath:s="",parentData:l,parentDataProperty:a,rootData:r=e}={}){let o=null,u=0;const i=u;let p=!1;const c=u;if(u===c)if("string"==typeof e){if(e.length<1){const n={params:{}};null===o?o=[n]:o.push(n),u++}}else{const n={params:{type:"string"}};null===o?o=[n]:o.push(n),u++}var f=c===u;if(p=p||f,!p){const t=u;if(u===t)if(e&&"object"==typeof e&&!Array.isArray(e)){let t;if(void 0===e.banner&&(t="banner")){const n={params:{missingProperty:t}};null===o?o=[n]:o.push(n),u++}else{const t=u;for(const n in e)if("banner"!==n&&"entryOnly"!==n&&"exclude"!==n&&"footer"!==n&&"include"!==n&&"raw"!==n&&"stage"!==n&&"test"!==n){const t={params:{additionalProperty:n}};null===o?o=[t]:o.push(t),u++;break}if(t===u){if(void 0!==e.banner){let n=e.banner;const t=u,s=u;let l=!1;const a=u;if("string"!=typeof n){const n={params:{type:"string"}};null===o?o=[n]:o.push(n),u++}var h=a===u;if(l=l||h,!l){const t=u;if(!(n instanceof Function)){const n={params:{}};null===o?o=[n]:o.push(n),u++}h=t===u,l=l||h}if(l)u=s,null!==o&&(s?o.length=s:o=null);else{const n={params:{}};null===o?o=[n]:o.push(n),u++}var m=t===u}else m=!0;if(m){if(void 0!==e.entryOnly){const n=u;if("boolean"!=typeof e.entryOnly){const n={params:{type:"boolean"}};null===o?o=[n]:o.push(n),u++}m=n===u}else m=!0;if(m){if(void 0!==e.exclude){const t=u,l=u;let a=!1,i=null;const p=u;if(n(e.exclude,{instancePath:s+"/exclude",parentData:e,parentDataProperty:"exclude",rootData:r})||(o=null===o?n.errors:o.concat(n.errors),u=o.length),p===u&&(a=!0,i=0),a)u=l,null!==o&&(l?o.length=l:o=null);else{const n={params:{passingSchemas:i}};null===o?o=[n]:o.push(n),u++}m=t===u}else m=!0;if(m){if(void 0!==e.footer){const n=u;if("boolean"!=typeof e.footer){const n={params:{type:"boolean"}};null===o?o=[n]:o.push(n),u++}m=n===u}else m=!0;if(m){if(void 0!==e.include){const t=u,l=u;let a=!1,i=null;const p=u;if(n(e.include,{instancePath:s+"/include",parentData:e,parentDataProperty:"include",rootData:r})||(o=null===o?n.errors:o.concat(n.errors),u=o.length),p===u&&(a=!0,i=0),a)u=l,null!==o&&(l?o.length=l:o=null);else{const n={params:{passingSchemas:i}};null===o?o=[n]:o.push(n),u++}m=t===u}else m=!0;if(m){if(void 0!==e.raw){const n=u;if("boolean"!=typeof e.raw){const n={params:{type:"boolean"}};null===o?o=[n]:o.push(n),u++}m=n===u}else m=!0;if(m){if(void 0!==e.stage){const n=u;if("number"!=typeof e.stage){const n={params:{type:"number"}};null===o?o=[n]:o.push(n),u++}m=n===u}else m=!0;if(m)if(void 0!==e.test){const t=u,l=u;let a=!1,i=null;const p=u;if(n(e.test,{instancePath:s+"/test",parentData:e,parentDataProperty:"test",rootData:r})||(o=null===o?n.errors:o.concat(n.errors),u=o.length),p===u&&(a=!0,i=0),a)u=l,null!==o&&(l?o.length=l:o=null);else{const n={params:{passingSchemas:i}};null===o?o=[n]:o.push(n),u++}m=t===u}else m=!0}}}}}}}}}else{const n={params:{type:"object"}};null===o?o=[n]:o.push(n),u++}if(f=t===u,p=p||f,!p){const n=u;if(!(e instanceof Function)){const n={params:{}};null===o?o=[n]:o.push(n),u++}f=n===u,p=p||f}}if(!p){const n={params:{}};return null===o?o=[n]:o.push(n),u++,t.errors=o,!1}return u=i,null!==o&&(i?o.length=i:o=null),t.errors=o,0===u}module.exports=t,module.exports.default=t;
"use strict";function n(t,{instancePath:s="",parentData:e,parentDataProperty:l,rootData:a=t}={}){let o=null,r=0;const u=r;let i=!1;const p=r;if(r===p)if(Array.isArray(t)){const n=t.length;for(let s=0;s<n;s++){let n=t[s];const e=r,l=r;let a=!1,u=null;const i=r,p=r;let f=!1;const h=r;if(!(n instanceof RegExp)){const n={params:{}};null===o?o=[n]:o.push(n),r++}var c=h===r;if(f=f||c,!f){const t=r;if(r===t)if("string"==typeof n){if(n.length<1){const n={params:{}};null===o?o=[n]:o.push(n),r++}}else{const n={params:{type:"string"}};null===o?o=[n]:o.push(n),r++}if(c=t===r,f=f||c,!f){const t=r;if(!(n instanceof Function)){const n={params:{}};null===o?o=[n]:o.push(n),r++}c=t===r,f=f||c}}if(f)r=p,null!==o&&(p?o.length=p:o=null);else{const n={params:{}};null===o?o=[n]:o.push(n),r++}if(i===r&&(a=!0,u=0),a)r=l,null!==o&&(l?o.length=l:o=null);else{const n={params:{passingSchemas:u}};null===o?o=[n]:o.push(n),r++}if(e!==r)break}}else{const n={params:{type:"array"}};null===o?o=[n]:o.push(n),r++}var f=p===r;if(i=i||f,!i){const n=r,s=r;let e=!1;const l=r;if(!(t instanceof RegExp)){const n={params:{}};null===o?o=[n]:o.push(n),r++}var h=l===r;if(e=e||h,!e){const n=r;if(r===n)if("string"==typeof t){if(t.length<1){const n={params:{}};null===o?o=[n]:o.push(n),r++}}else{const n={params:{type:"string"}};null===o?o=[n]:o.push(n),r++}if(h=n===r,e=e||h,!e){const n=r;if(!(t instanceof Function)){const n={params:{}};null===o?o=[n]:o.push(n),r++}h=n===r,e=e||h}}if(e)r=s,null!==o&&(s?o.length=s:o=null);else{const n={params:{}};null===o?o=[n]:o.push(n),r++}f=n===r,i=i||f}if(!i){const t={params:{}};return null===o?o=[t]:o.push(t),r++,n.errors=o,!1}return r=u,null!==o&&(u?o.length=u:o=null),n.errors=o,0===r}function t(s,{instancePath:e="",parentData:l,parentDataProperty:a,rootData:o=s}={}){let r=null,u=0;const i=u;let p=!1;const c=u;if(u===c)if("string"==typeof s){if(s.length<1){const n={params:{}};null===r?r=[n]:r.push(n),u++}}else{const n={params:{type:"string"}};null===r?r=[n]:r.push(n),u++}var f=c===u;if(p=p||f,!p){const t=u;if(u===t)if(s&&"object"==typeof s&&!Array.isArray(s)){let t;if(void 0===s.banner&&(t="banner")){const n={params:{missingProperty:t}};null===r?r=[n]:r.push(n),u++}else{const t=u;for(const n in s)if("banner"!==n&&"entryOnly"!==n&&"exclude"!==n&&"footer"!==n&&"include"!==n&&"raw"!==n&&"stage"!==n&&"test"!==n){const t={params:{additionalProperty:n}};null===r?r=[t]:r.push(t),u++;break}if(t===u){if(void 0!==s.banner){let n=s.banner;const t=u,e=u;let l=!1;const a=u;if("string"!=typeof n){const n={params:{type:"string"}};null===r?r=[n]:r.push(n),u++}var h=a===u;if(l=l||h,!l){const t=u;if(!(n instanceof Function)){const n={params:{}};null===r?r=[n]:r.push(n),u++}h=t===u,l=l||h}if(l)u=e,null!==r&&(e?r.length=e:r=null);else{const n={params:{}};null===r?r=[n]:r.push(n),u++}var m=t===u}else m=!0;if(m){if(void 0!==s.entryOnly){const n=u;if("boolean"!=typeof s.entryOnly){const n={params:{type:"boolean"}};null===r?r=[n]:r.push(n),u++}m=n===u}else m=!0;if(m){if(void 0!==s.exclude){const t=u,l=u;let a=!1,i=null;const p=u;if(n(s.exclude,{instancePath:e+"/exclude",parentData:s,parentDataProperty:"exclude",rootData:o})||(r=null===r?n.errors:r.concat(n.errors),u=r.length),p===u&&(a=!0,i=0),a)u=l,null!==r&&(l?r.length=l:r=null);else{const n={params:{passingSchemas:i}};null===r?r=[n]:r.push(n),u++}m=t===u}else m=!0;if(m){if(void 0!==s.footer){const n=u;if("boolean"!=typeof s.footer){const n={params:{type:"boolean"}};null===r?r=[n]:r.push(n),u++}m=n===u}else m=!0;if(m){if(void 0!==s.include){const t=u,l=u;let a=!1,i=null;const p=u;if(n(s.include,{instancePath:e+"/include",parentData:s,parentDataProperty:"include",rootData:o})||(r=null===r?n.errors:r.concat(n.errors),u=r.length),p===u&&(a=!0,i=0),a)u=l,null!==r&&(l?r.length=l:r=null);else{const n={params:{passingSchemas:i}};null===r?r=[n]:r.push(n),u++}m=t===u}else m=!0;if(m){if(void 0!==s.raw){const n=u;if("boolean"!=typeof s.raw){const n={params:{type:"boolean"}};null===r?r=[n]:r.push(n),u++}m=n===u}else m=!0;if(m){if(void 0!==s.stage){const n=u;if("number"!=typeof s.stage){const n={params:{type:"number"}};null===r?r=[n]:r.push(n),u++}m=n===u}else m=!0;if(m)if(void 0!==s.test){const t=u,l=u;let a=!1,i=null;const p=u;if(n(s.test,{instancePath:e+"/test",parentData:s,parentDataProperty:"test",rootData:o})||(r=null===r?n.errors:r.concat(n.errors),u=r.length),p===u&&(a=!0,i=0),a)u=l,null!==r&&(l?r.length=l:r=null);else{const n={params:{passingSchemas:i}};null===r?r=[n]:r.push(n),u++}m=t===u}else m=!0}}}}}}}}}else{const n={params:{type:"object"}};null===r?r=[n]:r.push(n),u++}if(f=t===u,p=p||f,!p){const n=u;if(!(s instanceof Function)){const n={params:{}};null===r?r=[n]:r.push(n),u++}f=n===u,p=p||f}}if(!p){const n={params:{}};return null===r?r=[n]:r.push(n),u++,t.errors=r,!1}return u=i,null!==r&&(i?r.length=i:r=null),t.errors=r,0===u}module.exports=t,module.exports.default=t;

View File

@ -15,6 +15,10 @@
{
"type": "string",
"minLength": 1
},
{
"instanceof": "Function",
"tsType": "((str: string) => boolean)"
}
]
},

File diff suppressed because one or more lines are too long

View File

@ -10,6 +10,10 @@
{
"type": "string",
"minLength": 1
},
{
"instanceof": "Function",
"tsType": "((str: string) => boolean)"
}
]
},

View File

@ -3,6 +3,15 @@ import fs from "fs/promises";
import { Session } from "inspector";
import path from "path";
import { fileURLToPath, pathToFileURL } from "url";
import {
InstrumentHooks,
getCodspeedRunnerMode,
getGitDir,
getV8Flags,
mongoMeasurement,
setupCore,
teardownCore
} from "@codspeed/core";
import { simpleGit } from "simple-git";
import { Bench, hrtimeNow } from "tinybench";
@ -12,32 +21,6 @@ const git = simpleGit(rootPath);
const REV_LIST_REGEXP = /^([a-f0-9]+)\s*([a-f0-9]+)\s*([a-f0-9]+)?\s*$/;
const getV8Flags = () => {
const nodeVersionMajor = Number.parseInt(
process.version.slice(1).split(".")[0],
10
);
const flags = [
"--hash-seed=1",
"--random-seed=1",
"--no-opt",
"--predictable",
"--predictable-gc-schedule",
"--interpreted-frames-native-stack",
"--allow-natives-syntax",
"--expose-gc",
"--no-concurrent-sweeping",
"--max-old-space-size=4096"
];
if (nodeVersionMajor < 18) {
flags.push("--no-randomize-hashes");
}
if (nodeVersionMajor < 20) {
flags.push("--no-scavenge-task");
}
return flags;
};
const checkV8Flags = () => {
const requiredFlags = getV8Flags();
const actualFlags = process.execArgv;
@ -248,6 +231,8 @@ for (const baselineInfo of baselineRevisions) {
}
}
const baseOutputPath = path.join(__dirname, "js", "benchmark");
function buildConfiguration(
test,
baseline,
@ -385,105 +370,239 @@ const scenarios = [
}
];
const baseOutputPath = path.join(__dirname, "js", "benchmark");
function getStackTrace(belowFn) {
const oldLimit = Error.stackTraceLimit;
Error.stackTraceLimit = Infinity;
const dummyObject = {};
const v8Handler = Error.prepareStackTrace;
Error.prepareStackTrace = (dummyObject, v8StackTrace) => v8StackTrace;
Error.captureStackTrace(dummyObject, belowFn || getStackTrace);
const v8StackTrace = dummyObject.stack;
Error.prepareStackTrace = v8Handler;
Error.stackTraceLimit = oldLimit;
return v8StackTrace;
}
function getCallingFile() {
const stack = getStackTrace();
let callingFile = stack[2].getFileName(); // [here, withCodSpeed, actual caller]
const gitDir = getGitDir(callingFile);
if (gitDir === undefined) {
throw new Error("Could not find a git repository");
}
if (callingFile.startsWith("file://")) {
callingFile = fileURLToPath(callingFile);
}
return path.relative(gitDir, callingFile);
}
const taskUriMap = new WeakMap();
function getOrCreateUriMap(bench) {
let uriMap = taskUriMap.get(bench);
if (!uriMap) {
uriMap = new Map();
taskUriMap.set(bench, uriMap);
}
return uriMap;
}
function getTaskUri(bench, taskName, rootCallingFile) {
const uriMap = taskUriMap.get(bench);
return uriMap?.get(taskName) || `${rootCallingFile}::${taskName}`;
}
const withCodSpeed = async (/** @type {import("tinybench").Bench} */ bench) => {
const { Measurement, getGitDir, mongoMeasurement, setupCore, teardownCore } =
await import("@codspeed/core");
const codspeedRunnerMode = getCodspeedRunnerMode();
if (!Measurement.isInstrumented()) {
const rawRun = bench.run;
bench.run = async () => {
console.warn(
`[CodSpeed] ${bench.tasks.length} benches detected but no instrumentation found, falling back to tinybench`
);
return await rawRun.bind(bench)();
};
if (codspeedRunnerMode === "disabled") {
return bench;
}
const getStackTrace = (belowFn) => {
const oldLimit = Error.stackTraceLimit;
Error.stackTraceLimit = Infinity;
const dummyObject = {};
const v8Handler = Error.prepareStackTrace;
Error.prepareStackTrace = (dummyObject, v8StackTrace) => v8StackTrace;
Error.captureStackTrace(dummyObject, belowFn || getStackTrace);
const v8StackTrace = dummyObject.stack;
Error.prepareStackTrace = v8Handler;
Error.stackTraceLimit = oldLimit;
return v8StackTrace;
};
const getCallingFile = () => {
const stack = getStackTrace();
let callingFile = stack[2].getFileName(); // [here, withCodSpeed, actual caller]
const gitDir = getGitDir(callingFile);
if (gitDir === undefined) {
throw new Error("Could not find a git repository");
}
if (callingFile.startsWith("file://")) {
callingFile = fileURLToPath(callingFile);
}
return path.relative(gitDir, callingFile);
};
const rawAdd = bench.add;
const uriMap = getOrCreateUriMap(bench);
bench.add = (name, fn, opts) => {
const callingFile = getCallingFile();
const uri = `${callingFile}::${name}`;
const options = { ...opts, uri };
return rawAdd.bind(bench)(name, fn, options);
let uri = callingFile;
if (bench.name !== undefined) {
uri += `::${bench.name}`;
}
uri += `::${name}`;
uriMap.set(name, uri);
return rawAdd.bind(bench)(name, fn, opts);
};
const rootCallingFile = getCallingFile();
bench.run = async function run() {
const iterations = bench.opts.iterations - 1;
console.log("[CodSpeed] running");
setupCore();
for (const task of bench.tasks) {
await bench.opts.setup?.(task, "run");
await task.fnOpts.beforeAll?.call(task);
const samples = [];
async function iteration() {
try {
await task.fnOpts.beforeEach?.call(task, "run");
const start = bench.opts.now();
await task.fn();
samples.push(bench.opts.now() - start || 0);
await task.fnOpts.afterEach?.call(this, "run");
} catch (err) {
if (bench.opts.throws) {
throw err;
}
if (codspeedRunnerMode === "instrumented") {
const setupBenchRun = () => {
setupCore();
console.log(
"[CodSpeed] running with @codspeed/tinybench (instrumented mode)"
);
};
const finalizeBenchRun = () => {
teardownCore();
console.log(`[CodSpeed] Done running ${bench.tasks.length} benches.`);
return bench.tasks;
};
const wrapFunctionWithFrame = (fn, isAsync) => {
if (isAsync) {
return async function __codspeed_root_frame__() {
await fn();
};
}
return function __codspeed_root_frame__() {
fn();
};
};
const logTaskCompletion = (uri, status) => {
console.log(`[CodSpeed] ${status} ${uri}`);
};
const taskCompletionMessage = () =>
InstrumentHooks.isInstrumented() ? "Measured" : "Checked";
const iterationAsync = async (task) => {
try {
await task.fnOpts.beforeEach?.call(task, "run");
const start = bench.opts.now();
await task.fn();
const end = bench.opts.now() - start || 0;
await task.fnOpts.afterEach?.call(this, "run");
return [start, end];
} catch (err) {
if (bench.opts.throws) {
throw err;
}
}
while (samples.length < iterations) {
await iteration();
}
// Codspeed Measure
const uri =
task.opts && "uri" in task.options
? task.opts.uri
: `${rootCallingFile}::${task.name}`;
await task.fnOpts.beforeEach?.call(task);
await mongoMeasurement.start(uri);
await (async function __codspeed_root_frame__() {
Measurement.startInstrumentation();
await task.fn();
Measurement.stopInstrumentation(uri);
})();
await mongoMeasurement.stop(uri);
await task.fnOpts.afterEach?.call(task);
console.log(`[Codspeed] ✔ Measured ${uri}`);
await task.fnOpts.afterAll?.call(task);
};
const wrapWithInstrumentHooksAsync = async (fn, uri) => {
InstrumentHooks.startBenchmark();
const result = await fn();
InstrumentHooks.stopBenchmark();
InstrumentHooks.setExecutedBenchmark(process.pid, uri);
return result;
};
const runTaskAsync = async (task, uri) => {
const { fnOpts, fn } = task;
// Custom setup
await bench.opts.setup?.(task, "run");
await fnOpts?.beforeAll?.call(task, "run");
// Custom warmup
// We don't run `optimizeFunction` because our function is never optimized, instead we just warmup webpack
const samples = [];
while (samples.length < bench.opts.iterations - 1) {
samples.push(await iterationAsync(task));
}
await fnOpts?.beforeEach?.call(task, "run");
await mongoMeasurement.start(uri);
global.gc?.();
await wrapWithInstrumentHooksAsync(wrapFunctionWithFrame(fn, true), uri);
await mongoMeasurement.stop(uri);
await fnOpts?.afterEach?.call(task, "run");
console.log(`[Codspeed] ✔ Measured ${uri}`);
await fnOpts?.afterAll?.call(task, "run");
// Custom teardown
await bench.opts.teardown?.(task, "run");
task.processRunResult({ latencySamples: samples });
}
teardownCore();
console.log(`[CodSpeed] Done running ${bench.tasks.length} benches.`);
return bench.tasks;
};
logTaskCompletion(uri, taskCompletionMessage());
};
const iteration = (task) => {
try {
task.fnOpts.beforeEach?.call(task, "run");
const start = bench.opts.now();
task.fn();
const end = bench.opts.now() - start || 0;
task.fnOpts.afterEach?.call(this, "run");
return [start, end];
} catch (err) {
if (bench.opts.throws) {
throw err;
}
}
};
const wrapWithInstrumentHooks = (fn, uri) => {
InstrumentHooks.startBenchmark();
const result = fn();
InstrumentHooks.stopBenchmark();
InstrumentHooks.setExecutedBenchmark(process.pid, uri);
return result;
};
const runTaskSync = (task, uri) => {
const { fnOpts, fn } = task;
// Custom setup
bench.opts.setup?.(task, "run");
fnOpts?.beforeAll?.call(task, "run");
// Custom warmup
const samples = [];
while (samples.length < bench.opts.iterations - 1) {
samples.push(iteration(task));
}
fnOpts?.beforeEach?.call(task, "run");
wrapWithInstrumentHooks(wrapFunctionWithFrame(fn, false), uri);
fnOpts?.afterEach?.call(task, "run");
console.log(`[Codspeed] ✔ Measured ${uri}`);
fnOpts?.afterAll?.call(task, "run");
// Custom teardown
bench.opts.teardown?.(task, "run");
logTaskCompletion(uri, taskCompletionMessage());
};
const finalizeAsyncRun = () => {
finalizeBenchRun();
};
const finalizeSyncRun = () => {
finalizeBenchRun();
};
bench.run = async () => {
setupBenchRun();
for (const task of bench.tasks) {
const uri = getTaskUri(task.bench, task.name, rootCallingFile);
await runTaskAsync(task, uri);
}
return finalizeAsyncRun();
};
bench.runSync = () => {
setupBenchRun();
for (const task of bench.tasks) {
const uri = getTaskUri(task.bench, task.name, rootCallingFile);
runTaskSync(task, uri);
}
return finalizeSyncRun();
};
} else if (codspeedRunnerMode === "walltime") {
// We don't need it
}
return bench;
};
@ -495,7 +614,6 @@ const bench = await withCodSpeed(
warmupIterations: 2,
iterations: 8,
setup(task, mode) {
global.gc();
console.log(`Setup (${mode} mode): ${task.name}`);
},
teardown(task, mode) {

View File

@ -208,6 +208,25 @@ describe("Compiler", () => {
});
});
it("compiles top-level await to es5", done => {
compile(
"./topLevelAwait1",
{
target: ["web", "es5"],
experiments: {
topLevelAwait: true
}
},
(stats, files) => {
expect(Object.keys(files)).toEqual(["/main.js"]);
const bundle = files["/main.js"];
expect(bundle).not.toContain("await");
expect(bundle).not.toContain("async");
done();
}
);
});
describe("methods", () => {
let compiler;

View File

@ -232,6 +232,12 @@ describe("snapshots", () => {
"type": "text",
},
},
Object {
"type": "asset/bytes",
"with": Object {
"type": "bytes",
},
},
],
"generator": Object {
"json": Object {
@ -2903,12 +2909,6 @@ describe("Targets", () => {
- Expected
+ Received
@@ ... @@
- "dynamicImportInWorker": true,
+ "dynamicImportInWorker": false,
@@ ... @@
- "dynamicImportInWorker": true,
+ "dynamicImportInWorker": false,
@@ ... @@
- "target": "node12.17",
+ "target": "browserslist: node 12.17",

View File

@ -609,6 +609,12 @@ You can also set it to 'none' to disable any default behavior. Learn more: https
webpack x.x.x compiled with 1 warning in X ms"
`;
exports[`StatsTestCases should print correct stats for chunk-assets 1`] = `
"asset bundle.js X bytes [emitted] (name: main) 1 related asset
./index.js X bytes [built] [code generated]
webpack x.x.x compiled successfully in X ms"
`;
exports[`StatsTestCases should print correct stats for chunk-module-id-range 1`] = `
"PublicPath: auto
asset main1.js X KiB [emitted] (name: main1)

View File

@ -31,6 +31,37 @@ Object {
}
`;
exports[`browserslist target ["and_chr 140","and_ff 142","and_qq 14.9","and_uc 15.5","android 140","chrome 140","chrome 139","chrome 138","chrome 137","chrome 112","chrome 109","chrome 105","edge 140","edge 139","edge 138","firefox 143","firefox 142","firefox 141","firefox 140","ios_saf 26.0","ios_saf 18.5-18.6","kaios 3.0-3.1","node 24.8.0","node 22.19.0","node 20.19.0","op_mob 80","opera 122","opera 121","opera 120","safari 26.0","safari 18.5-18.6","samsung 28","samsung 27"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": true,
"bigIntLiteral": true,
"browser": null,
"const": true,
"destructuring": true,
"document": null,
"dynamicImport": true,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": null,
"forOf": true,
"global": null,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": false,
"module": true,
"node": null,
"nodeBuiltins": null,
"nodePrefixForCoreModules": null,
"nwjs": false,
"optionalChaining": true,
"require": null,
"templateLiteral": true,
"web": null,
"webworker": false,
}
`;
exports[`browserslist target ["and_ff 68"] 1`] = `
Object {
"arrowFunction": true,
@ -41,7 +72,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -65,17 +96,17 @@ Object {
exports[`browserslist target ["and_qq 10.4"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": false,
"asyncFunction": true,
"bigIntLiteral": false,
"browser": true,
"const": true,
"destructuring": false,
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": true,
"forOf": false,
"forOf": true,
"global": false,
"globalThis": false,
"importScripts": false,
@ -93,37 +124,6 @@ Object {
}
`;
exports[`browserslist target ["and_uc 12.12"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": false,
"bigIntLiteral": false,
"browser": true,
"const": true,
"destructuring": false,
"document": true,
"dynamicImport": false,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": false,
"global": false,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"module": false,
"node": false,
"nodeBuiltins": false,
"nodePrefixForCoreModules": false,
"nwjs": false,
"optionalChaining": false,
"require": false,
"templateLiteral": true,
"web": true,
"webworker": false,
}
`;
exports[`browserslist target ["android 4"] 1`] = `
Object {
"arrowFunction": false,
@ -320,14 +320,45 @@ Object {
"destructuring": true,
"document": null,
"dynamicImport": true,
"dynamicImportInWorker": false,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": null,
"forOf": true,
"global": null,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": true,
"node": null,
"nodeBuiltins": null,
"nodePrefixForCoreModules": null,
"nwjs": false,
"optionalChaining": false,
"require": null,
"templateLiteral": true,
"web": null,
"webworker": false,
}
`;
exports[`browserslist target ["chrome 80","node 13.12.0"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": true,
"bigIntLiteral": true,
"browser": null,
"const": true,
"destructuring": true,
"document": null,
"dynamicImport": true,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": null,
"forOf": true,
"global": null,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": false,
"module": true,
"node": null,
"nodeBuiltins": null,
@ -382,7 +413,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -413,7 +444,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -444,7 +475,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -537,7 +568,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -606,7 +637,7 @@ Object {
"global": true,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": false,
"node": true,
"nodeBuiltins": true,
@ -637,7 +668,7 @@ Object {
"global": true,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": false,
"node": true,
"nodeBuiltins": true,
@ -668,7 +699,7 @@ Object {
"global": true,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": false,
"node": true,
"nodeBuiltins": true,
@ -699,7 +730,7 @@ Object {
"global": true,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": false,
"node": true,
"nodeBuiltins": true,
@ -723,14 +754,45 @@ Object {
"destructuring": true,
"document": false,
"dynamicImport": true,
"dynamicImportInWorker": false,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": false,
"forOf": true,
"global": true,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": true,
"node": true,
"nodeBuiltins": true,
"nodePrefixForCoreModules": false,
"nwjs": false,
"optionalChaining": false,
"require": true,
"templateLiteral": true,
"web": false,
"webworker": false,
}
`;
exports[`browserslist target ["node 13.12.0"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": true,
"bigIntLiteral": true,
"browser": false,
"const": true,
"destructuring": true,
"document": false,
"dynamicImport": true,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": false,
"forOf": true,
"global": true,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": false,
"module": true,
"node": true,
"nodeBuiltins": true,
@ -785,7 +847,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -816,7 +878,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -909,7 +971,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -940,7 +1002,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -971,7 +1033,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -1064,7 +1126,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -1095,7 +1157,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,

View File

@ -1,2 +0,0 @@
exports.a = 1;
exports.b = 2;

View File

@ -1,2 +0,0 @@
exports.a = 1;
exports.b = 2;

View File

@ -1,36 +0,0 @@
it("should load only used exports", async (done) => {
const { default: def, usedExports } = await import("./dir1/a");
expect(def).toBe(3);
expect(usedExports).toEqual(["default", "usedExports"]);
done();
});
it("should get warning on using 'webpackExports' with destructuring assignment", async (done) => {
const { default: def } = await import(/* webpackExports: ["a"] */"./dir1/a?2");
expect(def).toBe(3);
done();
});
it("should not tree-shake default export for exportsType=default module", async () => {
const { default: object } = await import("./dir2/json/object.json");
const { default: array } = await import("./dir2/json/array.json");
const { default: primitive } = await import("./dir2/json/primitive.json");
expect(object).toEqual({ a: 1 });
expect(array).toEqual(["a"]);
expect(primitive).toBe("a");
const { default: a } = await import("./dir2/a");
expect(a).toEqual({ a: 1, b: 2 });
});
it("should not tree-shake default export for exportsType=default context module", async () => {
const dir = "json";
const { default: object } = await import(`./dir3/${dir}/object.json`);
const { default: array } = await import(`./dir3/${dir}/array.json`);
const { default: primitive } = await import(`./dir3/${dir}/primitive.json`);
expect(object).toEqual({ a: 1 });
expect(array).toEqual(["a"]);
expect(primitive).toBe("a");
const file = "a";
const { default: a } = await import(`./dir3/${file}`);
expect(a).toEqual({ a: 1, b: 2 });
});

View File

@ -0,0 +1,51 @@
it("should load only used exports", async (done) => {
const { default: def, usedExports } = await import("../statical-dynamic-import/dir1/a");
expect(def).toBe(3);
expect(usedExports).toEqual(["default", "usedExports"]);
done();
});
it("should get warning on using 'webpackExports' with destructuring assignment", async (done) => {
const { default: def } = await import(/* webpackExports: ["a"] */"../statical-dynamic-import/dir1/a?2");
expect(def).toBe(3);
done();
});
it("should not tree-shake default export for exportsType=default module", async () => {
const { default: object } = await import("../statical-dynamic-import/dir2/json/object.json");
const { default: array } = await import("../statical-dynamic-import/dir2/json/array.json");
const { default: primitive } = await import("../statical-dynamic-import/dir2/json/primitive.json");
expect(object).toEqual({ a: 1 });
expect(array).toEqual(["a"]);
expect(primitive).toBe("a");
const { default: a } = await import("../statical-dynamic-import/dir2/a");
expect(a).toEqual({ a: 1, b: 2 });
});
it("should not tree-shake default export for exportsType=default context module", async () => {
const dir = "json";
const { default: object } = await import(`../statical-dynamic-import/dir3/${dir}/object.json`);
const { default: array } = await import(`../statical-dynamic-import/dir3/${dir}/array.json`);
const { default: primitive } = await import(`../statical-dynamic-import/dir3/${dir}/primitive.json`);
expect(object).toEqual({ a: 1 });
expect(array).toEqual(["a"]);
expect(primitive).toBe("a");
const file = "a";
const { default: a } = await import(`../statical-dynamic-import/dir3/${file}`);
expect(a).toEqual({ a: 1, b: 2 });
});
it("should static analyze dynamic import variable destructuring assignment", async () => {
const m = await import("../statical-dynamic-import/dir1/a?3");
const { default: def, usedExports } = m;
expect(def).toBe(3);
expect(usedExports).toEqual(["default", "usedExports"]);
});
it("expect support of \"deep\" tree-shaking for destructuring assignment dynamic import", async () => {
const { a: { aaa, usedExports: usedExportsA }, b: { bbb, usedExports: usedExportsB } } = await import("./lib");
expect(aaa).toBe(1);
expect(bbb).toBe(2);
expect(usedExportsA).toEqual(["aaa", "usedExports"]);
expect(usedExportsB).toEqual(["bbb", "usedExports"]);
});

View File

@ -1,3 +1,3 @@
export const a = 1;
export default 3;
export const aaa = 1;
export const bbb = 2;
export const usedExports = __webpack_exports_info__.usedExports;

View File

@ -0,0 +1,3 @@
export const aaa = 1;
export const bbb = 2;
export const usedExports = __webpack_exports_info__.usedExports;

View File

@ -0,0 +1,2 @@
export * as a from "./a";
export * as b from "./b";

View File

@ -53,12 +53,36 @@ it("should walk with correct order", async () => {
});
it("should analyze arguments in call member chain", async () => {
import("../statical-dynamic-import/dir4/lib?2").then(({ b }) => {
await import("../statical-dynamic-import/dir4/lib?2").then(({ b }) => {
b.f((async () => {
import("../statical-dynamic-import/dir4/a?2").then(({ a, usedExports }) => {
await import("../statical-dynamic-import/dir4/a?2").then(({ a, usedExports }) => {
expect(a).toBe(1);
expect(usedExports).toEqual(["a", "usedExports"]);
});
})());
});
});
it("should static analyze dynamic import variable destructuring assignment", async () => {
await import("../statical-dynamic-import/dir1/a?3").then(m => {
const { default: def, usedExports } = m;
expect(def).toBe(3);
expect(usedExports).toEqual(["default", "usedExports"]);
});
});
it("expect support of \"deep\" tree-shaking for destructuring assignment dynamic import", async () => {
await import("../statical-dynamic-import-destructuring/lib").then(({ a: { aaa, usedExports: usedExportsA }, b: { bbb, usedExports: usedExportsB } }) => {
expect(aaa).toBe(1);
expect(bbb).toBe(2);
expect(usedExportsA).toEqual(["aaa", "usedExports"]);
expect(usedExportsB).toEqual(["bbb", "usedExports"]);
});
await import("../statical-dynamic-import-destructuring/lib?2").then(m => {
const { a: { aaa, usedExports: usedExportsA }, b: { bbb, usedExports: usedExportsB } } = m;
expect(aaa).toBe(1);
expect(bbb).toBe(2);
expect(usedExportsA).toEqual(["aaa", "usedExports"]);
expect(usedExportsB).toEqual(["bbb", "usedExports"]);
});
});

View File

@ -73,12 +73,21 @@ it("should walk with correct order", async () => {
});
it("should analyze arguments in call member chain", async () => {
import("../statical-dynamic-import/dir4/lib?2").then(m => {
await import("../statical-dynamic-import/dir4/lib?2").then(m => {
m.b.f((async () => {
import("../statical-dynamic-import/dir4/a?2").then(m2 => {
await import("../statical-dynamic-import/dir4/a?2").then(m2 => {
expect(m2.a).toBe(1);
expect(m2.usedExports).toEqual(["a", "usedExports"]);
});
})());
});
});
it("should analyze then arguments", async () => {
await import("../statical-dynamic-import/dir4/lib?3").then(() => {
return import("../statical-dynamic-import/dir4/a?3").then(m2 => {
expect(m2.a).toBe(1);
expect(m2.usedExports).toEqual(["a", "usedExports"]);
});
});
})

View File

@ -60,3 +60,13 @@ it("should analyze arguments in call member chain", async () => {
expect(m2.usedExports).toEqual(["a", "usedExports"]);
})());
})
it("should analyze usage of variable that in correct scope", async () => {
var m = { b: 1 };
expect(m.b).toBe(1);
await (async () => {
var m = await import("./dir4/a?3");
expect(m.a).toBe(1);
expect(m.usedExports).toEqual(["a", "usedExports"]);
})();
})

View File

@ -1,3 +1,7 @@
"use strict";
module.exports = [[/Critical dependency: Accessing import\.meta/]];
module.exports = [
[
/Critical dependency: 'import\.meta' cannot be used as a standalone expression\. For static analysis, its properties must be accessed directly \(e\.g\., 'import\.meta\.url'\) or through destructuring\./
]
];

View File

@ -47,9 +47,9 @@ it("expect tree-shake bailout when rest element is used", () => {
expect(rest.exportsInfo.counter).toBe(true);
});
it("expect no support of \"deep\" tree-shaking", () => {
it("expect support of \"deep\" tree-shaking", () => {
const { counter2: { d } } = C;
expect(d).toBe(1);
expect(exportsInfo2.d).toBe(true);
expect(exportsInfo2.counter).toBe(true);
expect(exportsInfo2.counter).toBe(false);
});

Some files were not shown because too many files have changed in this diff Show More