Compare commits

...

45 Commits

Author SHA1 Message Date
xiaoxiaojx 4c30c3ee83 update 2025-10-03 20:18:49 +08:00
xiaoxiaojx cf1065c50c update 2025-10-03 20:18:47 +08:00
xiaoxiaojx c7fc38d76f update 2025-10-03 20:18:18 +08:00
xiaoxiaojx 4cccfafaeb update 2025-10-03 20:18:18 +08:00
xiaoxiaojx 29feac18a4 feat: add DotenvPlugin 2025-10-03 20:18:16 +08: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
Alexander Akait cf17a41259
fix: external function types (#19920) 2025-09-19 17:37:56 +03:00
Alexander Akait 898c48042d
refactor: fix merge (#19919) 2025-09-19 15:44:12 +03:00
Alexander Akait ab9f78b8f6
perf: avoid extra jobs for build dependencies (#19905) 2025-09-19 04:17:25 +03:00
Alexander Akait a796d25769
feat: added support for `import file from "./file.ext" with { type: "text" }` to get text content (#19918) 2025-09-19 04:16:25 +03:00
Alexander Akait 8e94386ee4
fix: property handle external modules for CSS (#19917) 2025-09-19 03:37:26 +03:00
Alexander Akait 3ac31e24e3
fix: support umd web workers loading 2025-09-19 01:25:38 +03:00
Even Stensberg 7fc28f1e53
chore: typo in IRP naming (#19915) 2025-09-18 16:14:10 +03:00
Gengkun 6e6d0442ae
feat: static analyse `import(...)_.then(...)` for tree shaking (#19903) 2025-09-18 15:46:16 +03:00
Alexander Akait 3799e931af
test: avoid extra output (#19901) 2025-09-18 15:41:17 +03:00
Even Stensberg 480bb3b91d
docs: add working group charter (#19911) 2025-09-18 15:40:48 +03:00
Alexander Akait c90f405abd
perf: move import attributes to own dependencies (#19892) 2025-09-18 15:37:40 +03:00
Even Stensberg 4fabb754de
Merge pull request #19912 from webpack/fix/redundant
chore: remove unused terms from cspell
2025-09-16 01:33:34 +02:00
Even Stensberg 2a76ea2192
chore: remove unused terms from cspell 2025-09-15 21:49:03 +02:00
Even Stensberg ffcbedddd4
Merge pull request #19910 from UlisesGascon/sec-add-threat-model
docs(security): add reference to webpack threat model
2025-09-15 20:45:53 +02:00
Ulises Gascón 36b322ad23
docs(security): add reference to webpack threat model
ref: https://github.com/webpack/security-wg/pull/9
2025-09-15 07:34:25 +02:00
253 changed files with 6890 additions and 1904 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') }}
@ -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,18 +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>Core Collaborators</h3>
### Maintenance
- [jhnns](https://github.com/jhnns) -
**Johannes Ewald** <<mail@johannesewald.de>>
- [sokra](https://github.com/sokra) -
**Tobias Koppers** <<jackworks@protonmail.co>>
- [spacek33z](https://github.com/spacek33z) -
**Kees Kluskens** <<kees@webduck.nl>>
- [TheLarkInn](https://github.com/TheLarkInn) -
**Sean T. Larkin** <<selarkin@microsoft.com>>
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.
@ -336,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">
@ -345,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.
@ -357,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.
@ -396,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.
@ -435,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.
@ -545,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.
@ -651,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,14 +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.
## 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).

48
WORKING_GROUP.md Normal file
View File

@ -0,0 +1,48 @@
# Webpack Core Working Group
This document outlines the webpack core working group.
---
## Working Group Name
Webpack Core Working Group
## Purpose and Responsibilities
The purpose of this working group is to facilitate, implement and fix problems and features within the core of webpack. This core includes tasking such as bugfixes, feature implementation and in general maintaining the main logic of webpack.
Each member of the working group is required to adhere to the [governance model of webpack](https://github.com/webpack/governance). In addition to having responsibility of the main part of webpack, the working group will manage other parts of the webpack organization repositories in such way they see fit.
## Goals & Objectives
- Develop features within the webpack organization and core areas.
- Fix bugs within webpack organization and core areas.
- Maintain and steer webpack in general together with the Technical Steering Committee.
- Ensure performance and code coverage is sustained and top-notch.
## Members
- [snitin315](https://github.com/snitin315) -
**Nitin Kumar** <<snitin315@gmail.com>> (he/him)
- [thelarkinn](https://github.com/thelarkinn) -
**Sean Larkin** <<selarkin@microsoft.com>> (he/him)
- [jhnns](https://github.com/jhnns) -
**Johannes Ewald** <<mail@johannesewald.de>>
- [sokra](https://github.com/sokra) -
**Tobias Koppers** <<jackworks@protonmail.co>>
- [spacek33z](https://github.com/spacek33z) -
**Kees Kluskens** <<kees@webduck.nl>>
## Communication
Meetings are hosted on an as-needed basis and private discussions are held in the #core-wg channel. For public feedback and communication, please use an appropriate channel within the webpack discord (e.g `#development-general`).
## Resources
- https://github.com/webpack
- https://github.com/webpack/governance
## Reporting & Updates
- The working group can choose to involve the webpack TSC for feedback and updates, but has full autonomy of making changes to any codebase within webpack.

View File

@ -305,9 +305,6 @@
"formaters",
"akait",
"Akait",
"ematipico",
"Emanuele",
"Stoppa",
"evenstensberg",
"Stensberg",
"ovflowd",
@ -317,7 +314,9 @@
"Kumar",
"spacek",
"thelarkinn",
"behaviour"
"behaviour",
"WHATWG",
"systemvars"
],
"ignoreRegExpList": [
"/Author.+/",

View File

@ -47,6 +47,21 @@ export type DevServer =
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
*/
export type DevTool = (false | "eval") | string;
/**
* Enable and configure the Dotenv plugin to load environment variables from .env files.
*/
export type Dotenv =
| boolean
| {
/**
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
*/
envDir?: string;
/**
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
*/
prefixes?: string[] | string;
};
/**
* The entry point(s) of the compilation.
*/
@ -191,16 +206,13 @@ export type ExternalItemFunction =
/**
* The function is called on each dependency (`function(context, request, callback(err, result))`).
*/
export type ExternalItemFunctionCallback = (
data: ExternalItemFunctionData,
callback: (err?: Error | null, result?: ExternalItemValue) => void
) => void;
export type ExternalItemFunctionCallback =
import("../lib/ExternalModuleFactoryPlugin").ExternalItemFunctionCallback;
/**
* The function is called on each dependency (`function(context, request)`).
*/
export type ExternalItemFunctionPromise = (
data: ExternalItemFunctionData
) => Promise<ExternalItemValue>;
export type ExternalItemFunctionPromise =
import("../lib/ExternalModuleFactoryPlugin").ExternalItemFunctionPromise;
/**
* Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value).
*/
@ -807,33 +819,6 @@ export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
*/
export type ExperimentsNormalized = ExperimentsCommon &
ExperimentsNormalizedExtra;
/**
* Get a resolve function with the current resolver options.
*/
export type ExternalItemFunctionDataGetResolve = (
options?: ResolveOptions
) =>
| ExternalItemFunctionDataGetResolveCallbackResult
| ExternalItemFunctionDataGetResolveResult;
/**
* Result of get a resolve function with the current resolver options.
*/
export type ExternalItemFunctionDataGetResolveCallbackResult = (
context: string,
request: string,
callback: (
err?: Error | null,
result?: string | false,
resolveRequest?: import("enhanced-resolve").ResolveRequest
) => void
) => void;
/**
* Callback result of get a resolve function with the current resolver options.
*/
export type ExternalItemFunctionDataGetResolveResult = (
context: string,
request: string
) => Promise<string>;
/**
* The dependency used for the external.
*/
@ -914,6 +899,10 @@ export interface WebpackOptions {
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
*/
devtool?: DevTool;
/**
* Enable and configure the Dotenv plugin to load environment variables from .env files.
*/
dotenv?: Dotenv;
/**
* The entry point(s) of the compilation.
*/
@ -3091,6 +3080,19 @@ export interface CssParserOptions {
*/
url?: CssParserUrl;
}
/**
* Options for Dotenv plugin.
*/
export interface DotenvPluginOptions {
/**
* The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.
*/
envDir?: string;
/**
* Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.
*/
prefixes?: string[] | string;
}
/**
* No generator options are supported for this module type.
*/
@ -3186,31 +3188,6 @@ export interface ExperimentsCommon {
*/
syncWebAssembly?: boolean;
}
/**
* Data object passed as argument when a function is set for 'externals'.
*/
export interface ExternalItemFunctionData {
/**
* The directory in which the request is placed.
*/
context?: string;
/**
* Contextual information.
*/
contextInfo?: import("../lib/ModuleFactory").ModuleFactoryCreateDataContextInfo;
/**
* The category of the referencing dependencies.
*/
dependencyType?: string;
/**
* Get a resolve function with the current resolver options.
*/
getResolve?: ExternalItemFunctionDataGetResolve;
/**
* The request as written by the user in the require/import expression/statement.
*/
request?: string;
}
/**
* Options for building http resources.
*/
@ -3853,6 +3830,10 @@ export interface WebpackOptionsNormalized {
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
*/
devtool?: DevTool;
/**
* Enable and configure the Dotenv plugin to load environment variables from .env files.
*/
dotenv?: Dotenv;
/**
* The entry point(s) of the compilation.
*/
@ -4032,6 +4013,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.
*/
@ -4040,6 +4025,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.
*/
@ -4096,6 +4085,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 {
/**

36
declarations/plugins/DotenvPlugin.d.ts vendored Normal file
View File

@ -0,0 +1,36 @@
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn fix:special` to update
*/
export interface DotenvPluginOptions {
/**
* Whether to allow empty strings in safe mode. If false, will throw an error if any env variables are empty (but only if safe mode is enabled).
*/
allowEmptyValues?: boolean;
/**
* Adds support for dotenv-defaults. If set to true, uses ./.env.defaults. If a string, uses that location for a defaults file.
*/
defaults?: boolean | string;
/**
* Allows your variables to be "expanded" for reusability within your .env file.
*/
expand?: boolean;
/**
* The path to your environment variables. This same path applies to the .env.example and .env.defaults files.
*/
path?: string;
/**
* The prefix to use before the name of your env variables.
*/
prefix?: string;
/**
* If true, load '.env.example' to verify the '.env' variables are all set. Can also be a string to a different file.
*/
safe?: boolean | string;
/**
* Set to true if you would rather load all system variables as well (useful for CI purposes).
*/
systemvars?: boolean;
}

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

423
lib/DotenvPlugin.js Normal file
View File

@ -0,0 +1,423 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Natsu @xiaoxiaojx
*/
"use strict";
const createSchemaValidation = require("./util/create-schema-validation");
const { join } = require("./util/fs");
/** @typedef {import("../declarations/WebpackOptions").DotenvPluginOptions} DotenvPluginOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
const DEFAULT_OPTIONS = {
prefixes: "WEBPACK_",
envDir: true
};
// Regex for parsing .env files
// ported from https://github.com/motdotla/dotenv/blob/master/lib/main.js#L32
const LINE =
/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
const PLUGIN_NAME = "DotenvPlugin";
const validate = createSchemaValidation(
undefined,
() => {
const { definitions } = require("../schemas/WebpackOptions.json");
return {
definitions,
oneOf: [{ $ref: "#/definitions/DotenvPluginOptions" }]
};
},
{
name: "Dotenv Plugin",
baseDataPath: "options"
}
);
/**
* Parse .env file content
* ported from https://github.com/motdotla/dotenv/blob/master/lib/main.js#L49
* @param {string|Buffer} src the source content to parse
* @returns {Record<string, string>} parsed environment variables object
*/
function parse(src) {
const obj = /** @type {Record<string, string>} */ ({});
// Convert buffer to string
let lines = src.toString();
// Convert line breaks to same format
lines = lines.replace(/\r\n?/gm, "\n");
let match;
while ((match = LINE.exec(lines)) !== null) {
const key = match[1];
// Default undefined or null to empty string
let value = match[2] || "";
// Remove whitespace
value = value.trim();
// Check if double quoted
const maybeQuote = value[0];
// Remove surrounding quotes
value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
// Expand newlines if double quoted
if (maybeQuote === '"') {
value = value.replace(/\\n/g, "\n");
value = value.replace(/\\r/g, "\r");
}
// Add to object
obj[key] = value;
}
return obj;
}
/**
* Resolve escape sequences
* ported from https://github.com/motdotla/dotenv-expand
* @param {string} value value to resolve
* @returns {string} resolved value
*/
function _resolveEscapeSequences(value) {
return value.replace(/\\\$/g, "$");
}
/**
* Expand environment variable value
* ported from https://github.com/motdotla/dotenv-expand
* @param {string} value value to expand
* @param {Record<string, string | undefined>} processEnv process.env object
* @param {Record<string, string>} runningParsed running parsed object
* @returns {string} expanded value
*/
function expandValue(value, processEnv, runningParsed) {
const env = { ...runningParsed, ...processEnv }; // process.env wins
const regex = /(?<!\\)\$\{([^{}]+)\}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;
let result = value;
let match;
const seen = new Set(); // self-referential checker
while ((match = regex.exec(result)) !== null) {
seen.add(result);
const [template, bracedExpression, unbracedExpression] = match;
const expression = bracedExpression || unbracedExpression;
// match the operators `:+`, `+`, `:-`, and `-`
const opRegex = /(:\+|\+|:-|-)/;
// find first match
const opMatch = expression.match(opRegex);
const splitter = opMatch ? opMatch[0] : null;
const r = expression.split(/** @type {string} */ (splitter));
// const r = splitter ? expression.split(splitter) : [expression];
let defaultValue;
let value;
const key = r.shift();
if ([":+", "+"].includes(splitter || "")) {
defaultValue = env[key || ""] ? r.join(splitter || "") : "";
value = null;
} else {
defaultValue = r.join(splitter || "");
value = env[key || ""];
}
if (value) {
// self-referential check
result = seen.has(value)
? result.replace(template, defaultValue)
: result.replace(template, value);
} else {
result = result.replace(template, defaultValue);
}
// if the result equaled what was in process.env and runningParsed then stop expanding
if (result === runningParsed[key || ""]) {
break;
}
regex.lastIndex = 0; // reset regex search position to re-evaluate after each replacement
}
return result;
}
/**
* Expand environment variables in parsed object
* ported from https://github.com/motdotla/dotenv-expand
* @param {{ parsed: Record<string, string>, processEnv?: Record<string, string | undefined> }} options expand options
* @returns {{ parsed: Record<string, string> }} expanded options
*/
function expand(options) {
// for use with progressive expansion
const runningParsed = /** @type {Record<string, string>} */ ({});
let processEnv = process.env;
if (
options &&
options.processEnv !== null &&
options.processEnv !== undefined
) {
processEnv = options.processEnv;
}
// dotenv.config() ran before this so the assumption is process.env has already been set
for (const key in options.parsed) {
let value = options.parsed[key];
// short-circuit scenario: process.env was already set prior to the file value
value =
processEnv[key] && processEnv[key] !== value
? /** @type {string} */ (processEnv[key])
: expandValue(value, processEnv, runningParsed);
options.parsed[key] = _resolveEscapeSequences(value);
// for use with progressive expansion
runningParsed[key] = _resolveEscapeSequences(value);
}
for (const processKey in options.parsed) {
if (processEnv) {
processEnv[processKey] = options.parsed[processKey];
}
}
return options;
}
/**
* Resolve and validate env prefixes
* Similar to Vite's resolveEnvPrefix
* @param {string | string[] | undefined} rawPrefixes raw prefixes option
* @returns {string[]} normalized prefixes array
*/
const resolveEnvPrefix = (rawPrefixes) => {
const prefixes = Array.isArray(rawPrefixes)
? rawPrefixes
: [rawPrefixes || "WEBPACK_"];
// Check for empty prefix (security issue like Vite does)
if (prefixes.includes("")) {
throw new Error(
"prefixes option contains value '', which could lead to unexpected exposure of sensitive information."
);
}
return prefixes;
};
/**
* Get list of env files to load based on mode
* Similar to Vite's getEnvFilesForMode
* @param {InputFileSystem} inputFileSystem the input file system
* @param {string} envDir the directory containing .env files
* @param {string | undefined} mode the mode (e.g., 'production', 'development')
* @returns {string[]} array of file paths to load
*/
const getEnvFilesForMode = (inputFileSystem, envDir, mode) => {
if (envDir) {
return [
/** default file */ ".env",
/** local file */ ".env.local",
/** mode file */ `.env.${mode}`,
/** mode local file */ `.env.${mode}.local`
].map((file) => join(inputFileSystem, envDir, file));
}
return [];
};
/**
* Format environment variables as DefinePlugin definitions
* @param {Record<string, string>} env environment variables
* @returns {Record<string, string>} formatted definitions
*/
const formatDefinitions = (env) => {
const definitions = /** @type {Record<string, string>} */ ({});
for (const [key, value] of Object.entries(env)) {
// Always use process.env. prefix for DefinePlugin
definitions[`process.env.${key}`] = JSON.stringify(value);
}
return definitions;
};
class DotenvPlugin {
/**
* @param {DotenvPluginOptions=} options options object
*/
constructor(options = {}) {
validate(options);
this.config = { ...DEFAULT_OPTIONS, ...options };
}
/**
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
/** @type {string[] | undefined} */
let fileDependenciesCache;
compiler.hooks.beforeCompile.tapAsync(PLUGIN_NAME, (_params, callback) => {
const inputFileSystem = /** @type {InputFileSystem} */ (
compiler.inputFileSystem
);
const context = compiler.context;
// Use webpack mode or fallback to NODE_ENV
const mode = /** @type {string | undefined} */ (
compiler.options.mode || process.env.NODE_ENV
);
this.loadEnv(
inputFileSystem,
mode,
context,
(err, env, fileDependencies) => {
if (err) return callback(err);
const definitions = formatDefinitions(env || {});
const DefinePlugin = compiler.webpack.DefinePlugin;
new DefinePlugin(definitions).apply(compiler);
fileDependenciesCache = fileDependencies;
callback();
}
);
});
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
compilation.fileDependencies.addAll(fileDependenciesCache || []);
});
}
/**
* Load environment variables from .env files
* Similar to Vite's loadEnv implementation
* @param {InputFileSystem} fs the input file system
* @param {string | undefined} mode the mode
* @param {string} context the compiler context
* @param {(err: Error | null, env?: Record<string, string>, fileDependencies?: string[]) => void} callback callback function
* @returns {void}
*/
loadEnv(fs, mode, context, callback) {
const { envDir: rawEnvDir, prefixes: rawPrefixes } =
/** @type {DotenvPluginOptions} */ (this.config);
let prefixes;
try {
prefixes = resolveEnvPrefix(rawPrefixes);
} catch (err) {
return callback(/** @type {Error} */ (err));
}
const getEnvDir = () => {
if (typeof rawEnvDir === "string") {
return join(fs, context, rawEnvDir);
}
if (rawEnvDir === true) {
return context;
}
return "";
};
const envDir = getEnvDir();
// Get env files to load
const envFiles = getEnvFilesForMode(fs, envDir, mode);
/** @type {string[]} */
const fileDependencies = [];
// Read all files
const readPromises = envFiles.map((filePath) =>
this.loadFile(fs, filePath).then(
(content) => {
fileDependencies.push(filePath);
return { content, filePath };
},
() =>
// File doesn't exist, skip it (this is normal)
({ content: "", filePath })
)
);
Promise.all(readPromises)
.then((results) => {
// Parse all files and merge (later files override earlier ones)
// Similar to Vite's implementation
const parsed = /** @type {Record<string, string>} */ ({});
for (const { content } of results) {
if (!content) continue;
const entries = parse(content);
for (const key in entries) {
parsed[key] = entries[key];
}
}
// Always expand environment variables (like Vite does)
// Make a copy of process.env so that dotenv-expand doesn't modify global process.env
const processEnv = { ...process.env };
expand({ parsed, processEnv });
// Filter by prefixes and prioritize process.env (like Vite)
const env = /** @type {Record<string, string>} */ ({});
// First, add filtered vars from parsed .env files
for (const [key, value] of Object.entries(parsed)) {
if (prefixes.some((prefix) => key.startsWith(prefix))) {
env[key] = value;
}
}
// Then, prioritize actual env variables starting with prefixes
// These are typically provided inline and should be prioritized (like Vite)
for (const key in process.env) {
if (prefixes.some((prefix) => key.startsWith(prefix))) {
env[key] = /** @type {string} */ (process.env[key]);
}
}
callback(null, env, fileDependencies);
})
.catch((err) => {
callback(err);
});
}
/**
* Load a file with proper path resolution
* @param {InputFileSystem} fs the input file system
* @param {string} file the file to load
* @returns {Promise<string>} the content of the file
*/
loadFile(fs, file) {
return new Promise((resolve, reject) => {
fs.readFile(file, "utf8", (err, content) => {
if (err) reject(err);
else resolve(content || "");
});
});
}
}
module.exports = DotenvPlugin;

View File

@ -15,13 +15,32 @@ const ImportDependency = require("./dependencies/ImportDependency");
const { cachedSetProperty, resolveByProperty } = require("./util/cleverMerge");
/** @typedef {import("enhanced-resolve").ResolveContext} ResolveContext */
/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} ResolveOptions */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemValue} ExternalItemValue */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectKnown} ExternalItemObjectKnown */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectUnknown} ExternalItemObjectUnknown */
/** @typedef {import("../declarations/WebpackOptions").Externals} Externals */
/** @typedef {import("./ExternalModule").DependencyMeta} DependencyMeta */
/** @typedef {import("./ModuleFactory").IssuerLayer} IssuerLayer */
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */
/** @typedef {import("./NormalModuleFactory")} NormalModuleFactory */
/** @typedef {((context: string, request: string, callback: (err?: Error | null, result?: string | false, resolveRequest?: import('enhanced-resolve').ResolveRequest) => void) => void)} ExternalItemFunctionDataGetResolveCallbackResult */
/** @typedef {((context: string, request: string) => Promise<string>)} ExternalItemFunctionDataGetResolveResult */
/** @typedef {(options?: ResolveOptions) => ExternalItemFunctionDataGetResolveCallbackResult | ExternalItemFunctionDataGetResolveResult} ExternalItemFunctionDataGetResolve */
/**
* @typedef {object} ExternalItemFunctionData
* @property {string} context the directory in which the request is placed
* @property {ModuleFactoryCreateDataContextInfo} contextInfo contextual information
* @property {string} dependencyType the category of the referencing dependency
* @property {ExternalItemFunctionDataGetResolve} getResolve get a resolve function with the current resolver options
* @property {string} request the request as written by the user in the require/import expression/statement
*/
/** @typedef {((data: ExternalItemFunctionData, callback: (err?: (Error | null), result?: ExternalItemValue) => void) => void)} ExternalItemFunctionCallback */
/** @typedef {((data: import("../lib/ExternalModuleFactoryPlugin").ExternalItemFunctionData) => Promise<ExternalItemValue>)} ExternalItemFunctionPromise */
const UNSPECIFIED_EXTERNAL_TYPE_REGEXP = /^[a-z0-9-]+ /;
const EMPTY_RESOLVE_OPTIONS = {};
@ -157,7 +176,7 @@ class ExternalModuleFactoryPlugin {
: undefined;
dependencyMeta = {
attributes: dependency.assertions,
attributes: dependency.attributes,
externalType
};
} else if (dependency instanceof CssImportDependency) {
@ -306,7 +325,9 @@ class ExternalModuleFactoryPlugin {
},
cb
);
if (promise && promise.then) promise.then((r) => cb(null, r), cb);
if (promise && promise.then) {
promise.then((r) => cb(null, r), cb);
}
}
return;
} else if (typeof externals === "object") {

View File

@ -45,8 +45,8 @@ let FS_ACCURACY = 2000;
const EMPTY_SET = new Set();
const RBDT_RESOLVE_CJS = 0;
const RBDT_RESOLVE_ESM = 1;
const RBDT_RESOLVE_INITIAL = 0;
const RBDT_RESOLVE_FILE = 1;
const RBDT_RESOLVE_DIRECTORY = 2;
const RBDT_RESOLVE_CJS_FILE = 3;
const RBDT_RESOLVE_CJS_FILE_AS_CHILD = 4;
@ -56,7 +56,7 @@ const RBDT_FILE = 7;
const RBDT_DIRECTORY_DEPENDENCIES = 8;
const RBDT_FILE_DEPENDENCIES = 9;
/** @typedef {RBDT_RESOLVE_CJS | RBDT_RESOLVE_ESM | RBDT_RESOLVE_DIRECTORY | RBDT_RESOLVE_CJS_FILE | RBDT_RESOLVE_CJS_FILE_AS_CHILD | RBDT_RESOLVE_ESM_FILE | RBDT_DIRECTORY | RBDT_FILE | RBDT_DIRECTORY_DEPENDENCIES | RBDT_FILE_DEPENDENCIES} JobType */
/** @typedef {RBDT_RESOLVE_INITIAL | RBDT_RESOLVE_FILE | RBDT_RESOLVE_DIRECTORY | RBDT_RESOLVE_CJS_FILE | RBDT_RESOLVE_CJS_FILE_AS_CHILD | RBDT_RESOLVE_ESM_FILE | RBDT_DIRECTORY | RBDT_FILE | RBDT_DIRECTORY_DEPENDENCIES | RBDT_FILE_DEPENDENCIES} JobType */
const INVALID = Symbol("invalid");
@ -1623,16 +1623,12 @@ class FileSystemInfo {
/**
* @param {Job} job job
* @returns {`resolve commonjs file ${string}${string}`|`resolve esm file ${string}${string}`|`resolve esm ${string}${string}`|`resolve directory ${string}`|`file ${string}`|`unknown ${string} ${string}`|`resolve commonjs ${string}${string}`|`directory ${string}`|`file dependencies ${string}`|`directory dependencies ${string}`} result
* @returns {string} result
*/
const jobToString = (job) => {
switch (job.type) {
case RBDT_RESOLVE_CJS:
return `resolve commonjs ${job.path}${expectedToString(
job.expected
)}`;
case RBDT_RESOLVE_ESM:
return `resolve esm ${job.path}${expectedToString(job.expected)}`;
case RBDT_RESOLVE_FILE:
return `resolve file ${job.path}${expectedToString(job.expected)}`;
case RBDT_RESOLVE_DIRECTORY:
return `resolve directory ${job.path}`;
case RBDT_RESOLVE_CJS_FILE:
@ -1674,7 +1670,7 @@ class FileSystemInfo {
deps,
(dep) =>
/** @type {Job} */ ({
type: RBDT_RESOLVE_CJS,
type: RBDT_RESOLVE_INITIAL,
context,
path: dep,
expected: undefined,
@ -1778,27 +1774,23 @@ class FileSystemInfo {
}
);
};
switch (type) {
case RBDT_RESOLVE_CJS: {
const isDirectory = /[\\/]$/.test(path);
if (isDirectory) {
resolveDirectory(path.slice(0, -1));
} else {
resolveFile(path, "f", resolveCjs);
}
break;
}
case RBDT_RESOLVE_ESM: {
const isDirectory = /[\\/]$/.test(path);
if (isDirectory) {
resolveDirectory(path.slice(0, -1));
} else {
resolveFile(path);
}
const resolvedType =
type === RBDT_RESOLVE_INITIAL
? /[\\/]$/.test(path)
? RBDT_RESOLVE_DIRECTORY
: RBDT_RESOLVE_FILE
: type;
switch (resolvedType) {
case RBDT_RESOLVE_FILE: {
resolveFile(
path,
"f",
/\.mjs$/.test(path) ? resolveEsm : resolveCjs
);
break;
}
case RBDT_RESOLVE_DIRECTORY: {
resolveDirectory(path);
resolveDirectory(RBDT_RESOLVE_INITIAL ? path.slice(0, -1) : path);
break;
}
case RBDT_RESOLVE_CJS_FILE: {
@ -1962,6 +1954,7 @@ class FileSystemInfo {
const context = dirname(this.fs, path);
const source = /** @type {Buffer} */ (content).toString();
const [imports] = lexer.parse(source);
const added = new Set();
for (const imp of imports) {
try {
let dependency;
@ -1979,9 +1972,11 @@ class FileSystemInfo {
continue;
}
// we should not track Node.js build dependencies
// We should not track Node.js build dependencies
if (dependency.startsWith("node:")) continue;
if (builtinModules.has(dependency)) continue;
// Avoid extra jobs for identical imports
if (added.has(dependency)) continue;
push({
type: RBDT_RESOLVE_ESM_FILE,
@ -1990,6 +1985,7 @@ class FileSystemInfo {
expected: imp.d > -1 ? false : undefined,
issuer: job
});
added.add(dependency);
} catch (err1) {
logger.warn(
`Parsing of ${path} for build dependencies failed at 'import(${source.slice(

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

@ -70,7 +70,7 @@ const {
* @property {ModuleFactoryCreateData["resolveOptions"]} resolveOptions
* @property {string} context
* @property {string} request
* @property {ImportAttributes | undefined} assertions
* @property {ImportAttributes | undefined} attributes
* @property {ModuleDependency[]} dependencies
* @property {string} dependencyType
* @property {CreateData} createData
@ -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 */
@ -242,7 +243,7 @@ const ruleSetCompiler = new RuleSetCompiler([
new BasicMatcherRulePlugin("issuer"),
new BasicMatcherRulePlugin("compiler"),
new BasicMatcherRulePlugin("issuerLayer"),
new ObjectMatcherRulePlugin("assert", "assertions", (value) => {
new ObjectMatcherRulePlugin("assert", "attributes", (value) => {
if (value) {
return (
/** @type {ImportAttributes} */ (value)._isLegacyAssert !== undefined
@ -251,7 +252,7 @@ const ruleSetCompiler = new RuleSetCompiler([
return false;
}),
new ObjectMatcherRulePlugin("with", "assertions", (value) => {
new ObjectMatcherRulePlugin("with", "attributes", (value) => {
if (value) {
return !(/** @type {ImportAttributes} */ (value)._isLegacyAssert);
}
@ -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"])
),
@ -444,7 +515,7 @@ class NormalModuleFactory extends ModuleFactory {
dependencies,
dependencyType,
request,
assertions,
attributes,
resolveOptions,
fileDependencies,
missingDependencies,
@ -615,7 +686,7 @@ class NormalModuleFactory extends ModuleFactory {
resourceQuery: resourceDataForRules.query,
resourceFragment: resourceDataForRules.fragment,
scheme,
assertions,
attributes,
mimetype: matchResourceData
? ""
: resourceData.data.mimetype || "",
@ -896,7 +967,9 @@ class NormalModuleFactory extends ModuleFactory {
const resolveOptions = data.resolveOptions || EMPTY_RESOLVE_OPTIONS;
const dependency = dependencies[0];
const request = dependency.request;
const assertions = dependency.assertions;
const attributes =
/** @type {ModuleDependency & { attributes: ImportAttributes }} */
(dependency).attributes;
const dependencyType = dependency.category || "";
const contextInfo = data.contextInfo;
const fileDependencies = new LazySet();
@ -908,7 +981,7 @@ class NormalModuleFactory extends ModuleFactory {
resolveOptions,
context,
request,
assertions,
attributes,
dependencies,
dependencyType,
fileDependencies,

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

@ -110,35 +110,86 @@ class WebpackOptionsApply extends OptionsApply {
const NodeTargetPlugin = require("./node/NodeTargetPlugin");
new NodeTargetPlugin().apply(compiler);
}
if (options.externalsPresets.electronMain) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin("main").apply(compiler);
}
if (options.externalsPresets.electronPreload) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
// Handle external CSS `@import` and `url()`
if (options.experiments.css) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin");
new ElectronTargetPlugin("preload").apply(compiler);
}
if (options.externalsPresets.electronRenderer) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ExternalsPlugin(
"module",
({ request, dependencyType, contextInfo }, callback) => {
if (
/\.css(\?|$)/.test(contextInfo.issuer) &&
/^(\/\/|https?:\/\/|#)/.test(request)
) {
if (dependencyType === "url") {
return callback(null, `asset ${request}`);
} else if (
dependencyType === "css-import" &&
options.experiments.css
) {
return callback(null, `css-import ${request}`);
}
}
new ElectronTargetPlugin("renderer").apply(compiler);
callback();
}
).apply(compiler);
}
}
if (
options.externalsPresets.electron &&
!options.externalsPresets.electronMain &&
!options.externalsPresets.electronPreload &&
!options.externalsPresets.electronRenderer
) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
if (options.externalsPresets.webAsync || options.externalsPresets.web) {
const type = options.externalsPresets.webAsync ? "import" : "module";
new ElectronTargetPlugin().apply(compiler);
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin");
new ExternalsPlugin(type, ({ request, dependencyType }, callback) => {
if (/^(\/\/|https?:\/\/|#|std:|jsr:|npm:)/.test(request)) {
if (dependencyType === "url") {
return callback(null, `asset ${request}`);
} else if (
dependencyType === "css-import" &&
options.experiments.css
) {
return callback(null, `css-import ${request}`);
} else if (/^(\/\/|https?:\/\/|std:|jsr:|npm:)/.test(request)) {
return callback(null, `${type} ${request}`);
}
}
callback();
}).apply(compiler);
}
if (options.externalsPresets.electron) {
if (options.externalsPresets.electronMain) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin("main").apply(compiler);
}
if (options.externalsPresets.electronPreload) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin("preload").apply(compiler);
}
if (options.externalsPresets.electronRenderer) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin("renderer").apply(compiler);
}
if (
!options.externalsPresets.electronMain &&
!options.externalsPresets.electronPreload &&
!options.externalsPresets.electronRenderer
) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin().apply(compiler);
}
}
if (options.externalsPresets.nwjs) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
@ -146,80 +197,6 @@ class WebpackOptionsApply extends OptionsApply {
new ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler);
}
if (options.externalsPresets.webAsync) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin");
new ExternalsPlugin("import", ({ request, dependencyType }, callback) => {
if (dependencyType === "url") {
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
return callback(null, `asset ${request}`);
}
} else if (options.experiments.css && dependencyType === "css-import") {
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
return callback(null, `css-import ${request}`);
}
} else if (
options.experiments.css &&
/^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request))
) {
if (/^\.css(\?|$)/.test(/** @type {string} */ (request))) {
return callback(null, `css-import ${request}`);
}
return callback(null, `import ${request}`);
}
callback();
}).apply(compiler);
} else if (options.externalsPresets.web) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin");
new ExternalsPlugin("module", ({ request, dependencyType }, callback) => {
if (dependencyType === "url") {
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
return callback(null, `asset ${request}`);
}
} else if (options.experiments.css && dependencyType === "css-import") {
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
return callback(null, `css-import ${request}`);
}
} else if (
/^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request))
) {
if (
options.experiments.css &&
/^\.css((\?)|$)/.test(/** @type {string} */ (request))
) {
return callback(null, `css-import ${request}`);
}
return callback(null, `module ${request}`);
}
callback();
}).apply(compiler);
} else if (options.externalsPresets.node && options.experiments.css) {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin");
new ExternalsPlugin("module", ({ request, dependencyType }, callback) => {
if (dependencyType === "url") {
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
return callback(null, `asset ${request}`);
}
} else if (dependencyType === "css-import") {
if (/^(\/\/|https?:\/\/|#)/.test(/** @type {string} */ (request))) {
return callback(null, `css-import ${request}`);
}
} else if (
/^(\/\/|https?:\/\/|std:)/.test(/** @type {string} */ (request))
) {
if (/^\.css(\?|$)/.test(/** @type {string} */ (request))) {
return callback(null, `css-import ${request}`);
}
return callback(null, `module ${request}`);
}
callback();
}).apply(compiler);
}
new ChunkPrefetchPreloadPlugin().apply(compiler);
@ -317,6 +294,14 @@ class WebpackOptionsApply extends OptionsApply {
).apply(compiler);
}
if (options.dotenv) {
const DotenvPlugin = require("./DotenvPlugin");
new DotenvPlugin(
typeof options.dotenv === "boolean" ? {} : options.dotenv
).apply(compiler);
}
if (options.devtool) {
if (options.devtool.includes("source-map")) {
const hidden = options.devtool.includes("hidden");

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,8 +9,10 @@ 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,
CSS_MODULE_TYPE,
CSS_MODULE_TYPE_AUTO,
CSS_MODULE_TYPE_GLOBAL,
@ -200,6 +202,7 @@ const {
* & { performance: NonNullable<WebpackOptionsNormalized["performance"]> }
* & { recordsInputPath: NonNullable<WebpackOptionsNormalized["recordsInputPath"]> }
* & { recordsOutputPath: NonNullable<WebpackOptionsNormalized["recordsOutputPath"]>
* & { dotenv: NonNullable<WebpackOptionsNormalized["dotenv"]> }
* }} WebpackOptionsNormalizedWithDefaults
*/
@ -1054,13 +1057,21 @@ const applyModuleDefaults = (
}
]
},
{
with: { type: JSON_MODULE_TYPE },
type: JSON_MODULE_TYPE
},
{
assert: { type: JSON_MODULE_TYPE },
type: JSON_MODULE_TYPE
},
{
with: { type: JSON_MODULE_TYPE },
type: JSON_MODULE_TYPE
with: { type: "text" },
type: ASSET_MODULE_TYPE_SOURCE
},
{
with: { type: "bytes" },
type: ASSET_MODULE_TYPE_BYTES
}
);
return rules;
@ -1316,8 +1327,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

@ -178,6 +178,9 @@ const getNormalizedWebpackOptions = (config) => ({
return { ...devServer };
}),
devtool: config.devtool,
dotenv: optionalNestedConfig(config.dotenv, (dotenv) =>
dotenv === true ? {} : dotenv
),
entry:
config.entry === undefined
? { main: {} }

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

@ -39,16 +39,16 @@ class ContextElementDependency extends ModuleDependency {
attributes
) {
super(request);
this.referencedExports = referencedExports;
this._typePrefix = typePrefix;
this._category = category;
this._context = context || undefined;
if (userRequest) {
this.userRequest = userRequest;
}
this.assertions = attributes;
this._typePrefix = typePrefix;
this._category = category;
this.referencedExports = referencedExports;
this._context = context || undefined;
this.attributes = attributes;
}
get type() {
@ -63,6 +63,17 @@ class ContextElementDependency extends ModuleDependency {
return this._category;
}
/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier() {
let str = super.getResourceIdentifier();
if (this.attributes !== undefined) {
str += JSON.stringify(this.attributes);
}
return str;
}
/**
* Returns list of exports referenced by this dependency
* @param {ModuleGraph} moduleGraph module graph
@ -110,7 +121,7 @@ class ContextElementDependency extends ModuleDependency {
write(this._typePrefix);
write(this._category);
write(this.referencedExports);
write(this.assertions);
write(this.attributes);
super.serialize(context);
}
@ -122,7 +133,7 @@ class ContextElementDependency extends ModuleDependency {
this._typePrefix = read();
this._category = read();
this.referencedExports = read();
this.assertions = read();
this.attributes = read();
super.deserialize(context);
}
}

View File

@ -66,7 +66,7 @@ class HarmonyImportDependency extends ModuleDependency {
constructor(request, sourceOrder, attributes, defer) {
super(request);
this.sourceOrder = sourceOrder;
this.assertions = attributes;
this.attributes = attributes;
this.defer = defer;
}
@ -74,6 +74,17 @@ class HarmonyImportDependency extends ModuleDependency {
return "esm";
}
/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier() {
let str = super.getResourceIdentifier();
if (this.attributes !== undefined) {
str += JSON.stringify(this.attributes);
}
return str;
}
/**
* Returns list of exports referenced by this dependency
* @param {ModuleGraph} moduleGraph module graph
@ -276,7 +287,7 @@ class HarmonyImportDependency extends ModuleDependency {
serialize(context) {
const { write } = context;
write(this.sourceOrder);
write(this.assertions);
write(this.attributes);
write(this.defer);
super.serialize(context);
}
@ -287,7 +298,7 @@ class HarmonyImportDependency extends ModuleDependency {
deserialize(context) {
const { read } = context;
this.sourceOrder = read();
this.assertions = read();
this.attributes = read();
this.defer = read();
super.deserialize(context);
}

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

@ -34,7 +34,7 @@ class ImportDependency extends ModuleDependency {
super(request);
this.range = range;
this.referencedExports = referencedExports;
this.assertions = attributes;
this.attributes = attributes;
}
get type() {
@ -45,6 +45,17 @@ class ImportDependency extends ModuleDependency {
return "esm";
}
/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier() {
let str = super.getResourceIdentifier();
if (this.attributes !== undefined) {
str += JSON.stringify(this.attributes);
}
return str;
}
/**
* Returns list of exports referenced by this dependency
* @param {ModuleGraph} moduleGraph module graph
@ -88,7 +99,7 @@ class ImportDependency extends ModuleDependency {
serialize(context) {
context.write(this.range);
context.write(this.referencedExports);
context.write(this.assertions);
context.write(this.attributes);
super.serialize(context);
}
@ -98,7 +109,7 @@ class ImportDependency extends ModuleDependency {
deserialize(context) {
this.range = context.read();
this.referencedExports = context.read();
this.assertions = context.read();
this.attributes = context.read();
super.deserialize(context);
}
}

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");
@ -27,6 +31,11 @@ const ImportWeakDependency = require("./ImportWeakDependency");
/** @typedef {import("../javascript/JavascriptParser").ParserState} ParserState */
/** @typedef {import("../javascript/JavascriptParser").Members} Members */
/** @typedef {import("../javascript/JavascriptParser").MembersOptionals} MembersOptionals */
/** @typedef {import("../javascript/JavascriptParser").ArrowFunctionExpression} ArrowFunctionExpression */
/** @typedef {import("../javascript/JavascriptParser").FunctionExpression} FunctionExpression */
/** @typedef {import("../javascript/JavascriptParser").Identifier} Identifier */
/** @typedef {import("../javascript/JavascriptParser").ObjectPattern} ObjectPattern */
/** @typedef {import("../javascript/JavascriptParser").CallExpression} CallExpression */
/** @typedef {{ references: RawReferencedExports, expression: ImportExpression }} ImportSettings */
/** @typedef {WeakMap<ImportExpression, RawReferencedExports>} State */
@ -46,6 +55,113 @@ function getState(parser) {
return /** @type {State} */ (parserStateMap.get(parser.state));
}
/**
* @param {JavascriptParser} parser javascript parser
* @param {ImportExpression} importCall import expression
* @param {string} variableName variable name
*/
function tagDynamicImportReferenced(parser, importCall, variableName) {
const state = getState(parser);
/** @type {RawReferencedExports} */
const references = state.get(importCall) || [];
state.set(importCall, references);
parser.tagVariable(
variableName,
dynamicImportTag,
/** @type {ImportSettings} */ ({
references,
expression: importCall
})
);
}
/**
* @param {CallExpression} importThen import().then() call
* @returns {Identifier | ObjectPattern | undefined} the dynamic imported namespace obj
*/
function getFulfilledCallbackNamespaceObj(importThen) {
const fulfilledCallback = importThen.arguments[0];
if (
fulfilledCallback &&
(fulfilledCallback.type === "ArrowFunctionExpression" ||
fulfilledCallback.type === "FunctionExpression") &&
fulfilledCallback.params[0] &&
(fulfilledCallback.params[0].type === "Identifier" ||
fulfilledCallback.params[0].type === "ObjectPattern")
) {
return fulfilledCallback.params[0];
}
}
/**
* @param {JavascriptParser} parser javascript parser
* @param {ImportExpression} importCall import expression
* @param {ArrowFunctionExpression | FunctionExpression} fulfilledCallback the fulfilled callback
* @param {Identifier | ObjectPattern} namespaceObjArg the argument of namespace object=
*/
function walkImportThenFulfilledCallback(
parser,
importCall,
fulfilledCallback,
namespaceObjArg
) {
const arrow = fulfilledCallback.type === "ArrowFunctionExpression";
const wasTopLevel = parser.scope.topLevelScope;
parser.scope.topLevelScope = arrow ? (wasTopLevel ? "arrow" : false) : false;
const scopeParams = [...fulfilledCallback.params];
// Add function name in scope for recursive calls
if (!arrow && fulfilledCallback.id) {
scopeParams.push(fulfilledCallback.id);
}
parser.inFunctionScope(!arrow, scopeParams, () => {
if (namespaceObjArg.type === "Identifier") {
tagDynamicImportReferenced(parser, importCall, namespaceObjArg.name);
} else {
parser.enterDestructuringAssignment(namespaceObjArg, importCall);
const referencedPropertiesInDestructuring =
parser.destructuringAssignmentPropertiesFor(importCall);
if (referencedPropertiesInDestructuring) {
const state = getState(parser);
const references = /** @type {RawReferencedExports} */ (
state.get(importCall)
);
/** @type {RawReferencedExports} */
const refsInDestructuring = [];
traverseDestructuringAssignmentProperties(
referencedPropertiesInDestructuring,
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
);
for (const ids of refsInDestructuring) {
references.push(ids);
}
}
}
for (const param of fulfilledCallback.params) {
parser.walkPattern(param);
}
if (fulfilledCallback.body.type === "BlockStatement") {
parser.detectMode(fulfilledCallback.body.body);
const prev = parser.prevStatement;
parser.preWalkStatement(fulfilledCallback.body);
parser.prevStatement = prev;
parser.walkStatement(fulfilledCallback.body);
} else {
parser.walkExpression(fulfilledCallback.body);
}
});
parser.scope.topLevelScope = wasTopLevel;
}
/**
* @template T
* @param {Iterable<T>} enumerable enumerable
* @returns {T[][]} array of array
*/
const exportsFromEnumerable = (enumerable) =>
Array.from(enumerable, (e) => [e]);
const PLUGIN_NAME = "ImportParserPlugin";
class ImportParserPlugin {
@ -61,14 +177,6 @@ class ImportParserPlugin {
* @returns {void}
*/
apply(parser) {
/**
* @template T
* @param {Iterable<T>} enumerable enumerable
* @returns {T[][]} array of array
*/
const exportsFromEnumerable = (enumerable) =>
Array.from(enumerable, (e) => [e]);
/**
* @param {Members} members members
* @param {MembersOptionals} membersOptionals members Optionals
@ -84,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) => {
@ -93,24 +210,27 @@ class ImportParserPlugin {
decl.init.argument.type === "ImportExpression" &&
decl.id.type === "Identifier"
) {
const importCall = decl.init.argument;
const state = getState(parser);
/** @type {RawReferencedExports} */
const references = [];
state.set(importCall, references);
parser.tagVariable(
decl.id.name,
dynamicImportTag,
/** @type {ImportSettings} */ ({
references,
expression: importCall
})
);
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
@ -123,7 +243,8 @@ class ImportParserPlugin {
});
parser.hooks.callMemberChain
.for(dynamicImportTag)
.tap(PLUGIN_NAME, (_expression, members, membersOptionals) => {
.tap(PLUGIN_NAME, (expression, members, membersOptionals) => {
const { arguments: args } = expression;
const settings = /** @type {ImportSettings} */ (parser.currentTagData);
let ids = getNonOptionalPart(members, membersOptionals);
const directImport = members.length === 0;
@ -134,9 +255,10 @@ class ImportParserPlugin {
ids = ids.slice(0, -1);
}
settings.references.push(ids);
if (args) parser.walkExpressions(args);
return true;
});
parser.hooks.importCall.tap(PLUGIN_NAME, (expr) => {
parser.hooks.importCall.tap(PLUGIN_NAME, (expr, importThen) => {
const param = parser.evaluateExpression(expr.source);
let chunkName = null;
@ -367,7 +489,13 @@ class ImportParserPlugin {
parser.destructuringAssignmentPropertiesFor(expr);
const state = getState(parser);
const referencedPropertiesInMember = state.get(expr);
if (referencedPropertiesInDestructuring || referencedPropertiesInMember) {
const fulfilledNamespaceObj =
importThen && getFulfilledCallbackNamespaceObj(importThen);
if (
referencedPropertiesInDestructuring ||
referencedPropertiesInMember ||
fulfilledNamespaceObj
) {
if (exports) {
parser.state.module.addWarning(
new UnsupportedFeatureWarning(
@ -378,11 +506,22 @@ 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 {
/** @type {RawReferencedExports} */
const references = [];
state.set(expr, references);
exports = references;
}
}
@ -425,39 +564,53 @@ class ImportParserPlugin {
depBlock.addDependency(dep);
parser.state.current.addBlock(depBlock);
}
return true;
} else {
if (mode === "weak") {
mode = "async-weak";
}
const dep = ContextDependencyHelpers.create(
ImportContextDependency,
/** @type {Range} */ (expr.range),
param,
expr,
this.options,
{
chunkName,
groupOptions,
include,
exclude,
mode,
namespaceObject:
/** @type {BuildMeta} */
(parser.state.module.buildMeta).strictHarmonyModule
? "strict"
: true,
typePrefix: "import()",
category: "esm",
referencedExports: exports,
attributes: getImportAttributes(expr)
},
parser
);
if (!dep) return;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = Boolean(parser.scope.inTry);
parser.state.current.addDependency(dep);
}
if (mode === "weak") {
mode = "async-weak";
if (fulfilledNamespaceObj) {
walkImportThenFulfilledCallback(
parser,
expr,
/** @type {ArrowFunctionExpression | FunctionExpression} */
(importThen.arguments[0]),
fulfilledNamespaceObj
);
parser.walkExpressions(importThen.arguments.slice(1));
} else if (importThen) {
parser.walkExpressions(importThen.arguments);
}
const dep = ContextDependencyHelpers.create(
ImportContextDependency,
/** @type {Range} */ (expr.range),
param,
expr,
this.options,
{
chunkName,
groupOptions,
include,
exclude,
mode,
namespaceObject:
/** @type {BuildMeta} */
(parser.state.module.buildMeta).strictHarmonyModule
? "strict"
: true,
typePrefix: "import()",
category: "esm",
referencedExports: exports,
attributes: getImportAttributes(expr)
},
parser
);
if (!dep) return;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = Boolean(parser.scope.inTry);
parser.state.current.addDependency(dep);
return true;
});
}

View File

@ -25,10 +25,6 @@ class ModuleDependency extends Dependency {
this.userRequest = request;
/** @type {Range | undefined} */
this.range = undefined;
// TODO move it to subclasses and rename
// assertions must be serialized by subclasses that use it
/** @type {ImportAttributes | undefined} */
this.assertions = undefined;
this._context = undefined;
}
@ -43,11 +39,7 @@ class ModuleDependency extends Dependency {
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier() {
let str = `context${this._context || ""}|module${this.request}`;
if (this.assertions !== undefined) {
str += JSON.stringify(this.assertions);
}
return str;
return `context${this._context || ""}|module${this.request}`;
}
/**

View File

@ -13,12 +13,6 @@ const memoize = require("./util/memoize");
/** @typedef {import("../declarations/WebpackOptions").EntryObject} EntryObject */
/** @typedef {import("../declarations/WebpackOptions").ExternalItem} ExternalItem */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemFunction} ExternalItemFunction */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionCallback} ExternalItemFunctionCallback */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionData} ExternalItemFunctionData */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionDataGetResolve} ExternalItemFunctionDataGetResolve */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionDataGetResolveCallbackResult} ExternalItemFunctionDataGetResolveCallbackResult */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionDataGetResolveResult} ExternalItemFunctionDataGetResolveResult */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemFunctionPromise} ExternalItemFunctionPromise */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectKnown} ExternalItemObjectKnown */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemObjectUnknown} ExternalItemObjectUnknown */
/** @typedef {import("../declarations/WebpackOptions").ExternalItemValue} ExternalItemValue */
@ -49,6 +43,12 @@ const memoize = require("./util/memoize");
/** @typedef {import("./Compilation").PathData} PathData */
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
/** @typedef {import("./Entrypoint")} Entrypoint */
/** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionCallback} ExternalItemFunctionCallback */
/** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionData} ExternalItemFunctionData */
/** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionDataGetResolve} ExternalItemFunctionDataGetResolve */
/** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionDataGetResolveCallbackResult} ExternalItemFunctionDataGetResolveCallbackResult */
/** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionDataGetResolveResult} ExternalItemFunctionDataGetResolveResult */
/** @typedef {import("./ExternalModuleFactoryPlugin").ExternalItemFunctionPromise} ExternalItemFunctionPromise */
/** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */
/** @typedef {import("./MultiCompiler").MultiWebpackOptions} MultiConfiguration */
/** @typedef {import("./MultiStats")} MultiStats */
@ -232,6 +232,9 @@ module.exports = mergeExports(fn, {
get DynamicEntryPlugin() {
return require("./DynamicEntryPlugin");
},
get DotenvPlugin() {
return require("./DotenvPlugin");
},
get EntryOptionPlugin() {
return require("./EntryOptionPlugin");
},

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
*/
@ -550,8 +551,8 @@ class JavascriptParser extends Parser {
),
/** @type {HookMap<SyncBailHook<[Expression], boolean | void>>} */
typeof: new HookMap(() => new SyncBailHook(["expression"])),
/** @type {SyncBailHook<[ImportExpression], boolean | void>} */
importCall: new SyncBailHook(["expression"]),
/** @type {SyncBailHook<[ImportExpression, CallExpression?], boolean | void>} */
importCall: new SyncBailHook(["expression", "importThen"]),
/** @type {SyncBailHook<[Expression | ForOfStatement], boolean | void>} */
topLevelAwait: new SyncBailHook(["expression"]),
/** @type {HookMap<SyncBailHook<[CallExpression], boolean | void>>} */
@ -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
*/
@ -3842,6 +3886,18 @@ class JavascriptParser extends Parser {
);
if (result === true) return;
}
// import("./m").then(m => { ... })
if (
expression.callee.object.type === "ImportExpression" &&
expression.callee.property.type === "Identifier" &&
expression.callee.property.name === "then"
) {
const result = this.hooks.importCall.call(
expression.callee.object,
expression
);
if (result === true) return;
}
}
const callee = this.evaluateExpression(expression.callee);
if (callee.isIdentifier()) {

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,
@ -1710,9 +1711,11 @@ class ConcatenatedModule extends Module {
// add harmony compatibility flag (must be first because of possible circular dependencies)
let shouldAddHarmonyFlag = false;
const rootExportsInfo = moduleGraph.getExportsInfo(this);
if (
moduleGraph.getExportsInfo(this).otherExportsInfo.getUsed(runtime) !==
UsageState.Unused
rootExportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused ||
rootExportsInfo.getReadOnlyExportInfo("__esModule").getUsed(runtime) !==
UsageState.Unused
) {
shouldAddHarmonyFlag = true;
}
@ -1830,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>[]} */
@ -1853,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(
@ -1885,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

@ -38,7 +38,7 @@ const { SyncHook } = require("tapable");
* @property {string=} resourceQuery
* @property {string=} resourceFragment
* @property {string=} scheme
* @property {ImportAttributes=} assertions
* @property {ImportAttributes=} attributes
* @property {string=} mimetype
* @property {string} dependency
* @property {ResolveRequest["descriptionFileData"]=} descriptionData

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.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"
@ -111,16 +111,16 @@
"@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",
"@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

@ -629,6 +629,50 @@
"description": "Module namespace to use when interpolating filename template string for the sources array in a generated SourceMap. Defaults to `output.library` if not set. It's useful for avoiding runtime collisions in sourcemaps from multiple webpack projects built as libraries.",
"type": "string"
},
"Dotenv": {
"description": "Enable and configure the Dotenv plugin to load environment variables from .env files.",
"cli": {
"exclude": false
},
"anyOf": [
{
"description": "Enable Dotenv plugin with default options.",
"type": "boolean"
},
{
"$ref": "#/definitions/DotenvPluginOptions",
"description": "Options for Dotenv plugin."
}
]
},
"DotenvPluginOptions": {
"description": "Options for Dotenv plugin.",
"type": "object",
"additionalProperties": false,
"properties": {
"envDir": {
"description": "The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.",
"type": "string",
"minLength": 1
},
"prefixes": {
"description": "Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
"anyOf": [
{
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
},
{
"type": "string",
"minLength": 1
}
]
}
}
},
"EmptyGeneratorOptions": {
"description": "No generator options are supported for this module type.",
"type": "object",
@ -1186,54 +1230,12 @@
"ExternalItemFunctionCallback": {
"description": "The function is called on each dependency (`function(context, request, callback(err, result))`).",
"instanceof": "Function",
"tsType": "((data: ExternalItemFunctionData, callback: (err?: (Error | null), result?: ExternalItemValue) => void) => void)"
},
"ExternalItemFunctionData": {
"description": "Data object passed as argument when a function is set for 'externals'.",
"type": "object",
"additionalProperties": false,
"properties": {
"context": {
"description": "The directory in which the request is placed.",
"type": "string"
},
"contextInfo": {
"description": "Contextual information.",
"type": "object",
"tsType": "import('../lib/ModuleFactory').ModuleFactoryCreateDataContextInfo"
},
"dependencyType": {
"description": "The category of the referencing dependencies.",
"type": "string"
},
"getResolve": {
"$ref": "#/definitions/ExternalItemFunctionDataGetResolve"
},
"request": {
"description": "The request as written by the user in the require/import expression/statement.",
"type": "string"
}
}
},
"ExternalItemFunctionDataGetResolve": {
"description": "Get a resolve function with the current resolver options.",
"instanceof": "Function",
"tsType": "((options?: ResolveOptions) => ExternalItemFunctionDataGetResolveCallbackResult | ExternalItemFunctionDataGetResolveResult)"
},
"ExternalItemFunctionDataGetResolveCallbackResult": {
"description": "Result of get a resolve function with the current resolver options.",
"instanceof": "Function",
"tsType": "((context: string, request: string, callback: (err?: Error | null, result?: string | false, resolveRequest?: import('enhanced-resolve').ResolveRequest) => void) => void)"
},
"ExternalItemFunctionDataGetResolveResult": {
"description": "Callback result of get a resolve function with the current resolver options.",
"instanceof": "Function",
"tsType": "((context: string, request: string) => Promise<string>)"
"tsType": "(import(\"../lib/ExternalModuleFactoryPlugin\").ExternalItemFunctionCallback)"
},
"ExternalItemFunctionPromise": {
"description": "The function is called on each dependency (`function(context, request)`).",
"instanceof": "Function",
"tsType": "((data: ExternalItemFunctionData) => Promise<ExternalItemValue>)"
"tsType": "(import(\"../lib/ExternalModuleFactoryPlugin\").ExternalItemFunctionPromise)"
},
"ExternalItemValue": {
"description": "The dependency used for the external.",
@ -1563,12 +1565,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"
},
@ -3929,6 +3937,9 @@
"asset": {
"$ref": "#/definitions/AssetParserOptions"
},
"asset/bytes": {
"$ref": "#/definitions/EmptyParserOptions"
},
"asset/inline": {
"$ref": "#/definitions/EmptyParserOptions"
},
@ -5833,6 +5844,9 @@
"devtool": {
"$ref": "#/definitions/DevTool"
},
"dotenv": {
"$ref": "#/definitions/Dotenv"
},
"entry": {
"$ref": "#/definitions/EntryNormalized"
},
@ -5983,6 +5997,9 @@
"devtool": {
"$ref": "#/definitions/DevTool"
},
"dotenv": {
"$ref": "#/definitions/Dotenv"
},
"entry": {
"$ref": "#/definitions/Entry"
},

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

@ -214,6 +214,12 @@ describe("snapshots", () => {
},
],
},
Object {
"type": "json",
"with": Object {
"type": "json",
},
},
Object {
"assert": Object {
"type": "json",
@ -221,9 +227,15 @@ describe("snapshots", () => {
"type": "json",
},
Object {
"type": "json",
"type": "asset/source",
"with": Object {
"type": "json",
"type": "text",
},
},
Object {
"type": "asset/bytes",
"with": Object {
"type": "bytes",
},
},
],
@ -2897,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

@ -465,6 +465,58 @@ Object {
"multiple": false,
"simpleType": "string",
},
"dotenv": Object {
"configs": Array [
Object {
"description": "Enable Dotenv plugin with default options.",
"multiple": false,
"path": "dotenv",
"type": "boolean",
},
],
"description": "Enable Dotenv plugin with default options.",
"multiple": false,
"simpleType": "boolean",
},
"dotenv-env-dir": Object {
"configs": Array [
Object {
"description": "The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.",
"multiple": false,
"path": "dotenv.envDir",
"type": "string",
},
],
"description": "The directory from which .env files are loaded. Defaults to the webpack context. Loads .env, .env.local, .env.[mode], .env.[mode].local in order.",
"multiple": false,
"simpleType": "string",
},
"dotenv-prefixes": Object {
"configs": Array [
Object {
"description": "Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
"multiple": true,
"path": "dotenv.prefixes[]",
"type": "string",
},
],
"description": "Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
"multiple": true,
"simpleType": "string",
},
"dotenv-prefixes-reset": Object {
"configs": Array [
Object {
"description": "Clear all items provided in 'dotenv.prefixes' configuration. Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
"multiple": false,
"path": "dotenv.prefixes",
"type": "reset",
},
],
"description": "Clear all items provided in 'dotenv.prefixes' configuration. Only expose environment variables that start with these prefixes. Defaults to 'WEBPACK_'.",
"multiple": false,
"simpleType": "boolean",
},
"entry": Object {
"configs": Array [
Object {

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)
@ -847,14 +853,14 @@ exports[`StatsTestCases should print correct stats for context-independence 1`]
sourceMap main-XXXXXXXXXXXXXXXXXXXX.js.map X KiB [emitted] [dev] (auxiliary name: main)
asset 977-XXXXXXXXXXXXXXXXXXXX.js X bytes [emitted] [immutable]
sourceMap 977-XXXXXXXXXXXXXXXXXXXX.js.map X bytes [emitted] [dev]
runtime modules X KiB 9 modules
runtime modules X KiB 8 modules
orphan modules X bytes [orphan] 1 module
built modules X bytes [built]
modules by path ./a/*.js X bytes
./a/index.js (in my-layer) X bytes [built] [code generated]
./a/chunk.js + 1 modules (in my-layer) X bytes [built] [code generated]
modules by path ./a/c/ X bytes
./a/c/ ./a/cc/ eager ^\\\\.\\\\/.*$ namespace object (in my-layer) X bytes [built] [code generated]
./a/c/ ./a/cc/ eager ^\\\\.\\\\/.*$ referencedExports: default namespace object (in my-layer) X bytes [built] [code generated]
./a/c/a.js (in my-layer) X bytes [optional] [built] [code generated]
./a/cc/b.js (in my-layer) X bytes [optional] [built] [code generated]
webpack x.x.x compiled successfully in X ms
@ -863,70 +869,70 @@ asset main-XXXXXXXXXXXXXXXXXXXX.js X KiB [emitted] [immutable] (name: main)
sourceMap main-XXXXXXXXXXXXXXXXXXXX.js.map X KiB [emitted] [dev] (auxiliary name: main)
asset 977-XXXXXXXXXXXXXXXXXXXX.js X bytes [emitted] [immutable]
sourceMap 977-XXXXXXXXXXXXXXXXXXXX.js.map X bytes [emitted] [dev]
runtime modules X KiB 9 modules
runtime modules X KiB 8 modules
orphan modules X bytes [orphan] 1 module
built modules X bytes [built]
modules by path ./b/*.js X bytes
./b/index.js (in my-layer) X bytes [built] [code generated]
./b/chunk.js + 1 modules (in my-layer) X bytes [built] [code generated]
modules by path ./b/c/ X bytes
./b/c/ ./b/cc/ eager ^\\\\.\\\\/.*$ namespace object (in my-layer) X bytes [built] [code generated]
./b/c/ ./b/cc/ eager ^\\\\.\\\\/.*$ referencedExports: default namespace object (in my-layer) X bytes [built] [code generated]
./b/c/a.js (in my-layer) X bytes [optional] [built] [code generated]
./b/cc/b.js (in my-layer) X bytes [optional] [built] [code generated]
webpack x.x.x compiled successfully in X ms
asset main-XXXXXXXXXXXXXXXXXXXX.js X KiB [emitted] [immutable] (name: main)
asset 977-XXXXXXXXXXXXXXXXXXXX.js X KiB [emitted] [immutable]
runtime modules X KiB 9 modules
runtime modules X KiB 8 modules
orphan modules X bytes [orphan] 1 module
built modules X bytes [built]
modules by path ./a/*.js X bytes
./a/index.js (in my-layer) X bytes [built] [code generated]
./a/chunk.js + 1 modules (in my-layer) X bytes [built] [code generated]
modules by path ./a/c/ X bytes
./a/c/ ./a/cc/ eager ^\\\\.\\\\/.*$ namespace object (in my-layer) X bytes [built] [code generated]
./a/c/ ./a/cc/ eager ^\\\\.\\\\/.*$ referencedExports: default namespace object (in my-layer) X bytes [built] [code generated]
./a/c/a.js (in my-layer) X bytes [optional] [built] [code generated]
./a/cc/b.js (in my-layer) X bytes [optional] [built] [code generated]
webpack x.x.x compiled successfully in X ms
asset main-XXXXXXXXXXXXXXXXXXXX.js X KiB [emitted] [immutable] (name: main)
asset 977-XXXXXXXXXXXXXXXXXXXX.js X KiB [emitted] [immutable]
runtime modules X KiB 9 modules
runtime modules X KiB 8 modules
orphan modules X bytes [orphan] 1 module
built modules X bytes [built]
modules by path ./b/*.js X bytes
./b/index.js (in my-layer) X bytes [built] [code generated]
./b/chunk.js + 1 modules (in my-layer) X bytes [built] [code generated]
modules by path ./b/c/ X bytes
./b/c/ ./b/cc/ eager ^\\\\.\\\\/.*$ namespace object (in my-layer) X bytes [built] [code generated]
./b/c/ ./b/cc/ eager ^\\\\.\\\\/.*$ referencedExports: default namespace object (in my-layer) X bytes [built] [code generated]
./b/c/a.js (in my-layer) X bytes [optional] [built] [code generated]
./b/cc/b.js (in my-layer) X bytes [optional] [built] [code generated]
webpack x.x.x compiled successfully in X ms
asset main-XXXXXXXXXXXXXXXXXXXX.js X KiB [emitted] [immutable] (name: main)
asset 977-XXXXXXXXXXXXXXXXXXXX.js X bytes [emitted] [immutable]
runtime modules X KiB 9 modules
runtime modules X KiB 8 modules
orphan modules X bytes [orphan] 1 module
built modules X bytes [built]
modules by path ./a/*.js X bytes
./a/index.js (in my-layer) X bytes [built] [code generated]
./a/chunk.js + 1 modules (in my-layer) X bytes [built] [code generated]
modules by path ./a/c/ X bytes
./a/c/ ./a/cc/ eager ^\\\\.\\\\/.*$ namespace object (in my-layer) X bytes [built] [code generated]
./a/c/ ./a/cc/ eager ^\\\\.\\\\/.*$ referencedExports: default namespace object (in my-layer) X bytes [built] [code generated]
./a/c/a.js (in my-layer) X bytes [optional] [built] [code generated]
./a/cc/b.js (in my-layer) X bytes [optional] [built] [code generated]
webpack x.x.x compiled successfully in X ms
asset main-XXXXXXXXXXXXXXXXXXXX.js X KiB [emitted] [immutable] (name: main)
asset 977-XXXXXXXXXXXXXXXXXXXX.js X bytes [emitted] [immutable]
runtime modules X KiB 9 modules
runtime modules X KiB 8 modules
orphan modules X bytes [orphan] 1 module
built modules X bytes [built]
modules by path ./b/*.js X bytes
./b/index.js (in my-layer) X bytes [built] [code generated]
./b/chunk.js + 1 modules (in my-layer) X bytes [built] [code generated]
modules by path ./b/c/ X bytes
./b/c/ ./b/cc/ eager ^\\\\.\\\\/.*$ namespace object (in my-layer) X bytes [built] [code generated]
./b/c/ ./b/cc/ eager ^\\\\.\\\\/.*$ referencedExports: default namespace object (in my-layer) X bytes [built] [code generated]
./b/c/a.js (in my-layer) X bytes [optional] [built] [code generated]
./b/cc/b.js (in my-layer) X bytes [optional] [built] [code generated]
webpack x.x.x compiled successfully in X ms"
@ -1148,7 +1154,7 @@ built modules X MiB [built]
../../../node_modules/scheduler/cjs/scheduler.development.js X KiB [built] [code generated]
modules by path ./src/ X KiB
./src/index.js X bytes [built] [code generated]
./src/pages/ lazy ^\\\\.\\\\/.*$ chunkName: pages/[request] namespace object X bytes [built] [code generated]
./src/pages/ lazy ^\\\\.\\\\/.*$ referencedExports: default chunkName: pages/[request]...(truncated) X bytes [built] [code generated]
./src/pages/home.js X KiB [optional] [built] [code generated]
webpack x.x.x compiled successfully in X ms"
`;
@ -3561,6 +3567,7 @@ cacheable modules X bytes
| [inactive] harmony export imported specifier ./CompAB ./components/src/index.js 1:0-40 (skipped side-effect-free modules)
| harmony import specifier ./components ./main.js 4:15-20 (skipped side-effect-free modules)
./foo.js X bytes [built] [code generated]
[only some exports used: default]
import() ./foo ./main.js + 1 modules ./main.js 6:0-15
webpack x.x.x compiled successfully in X ms"
`;
@ -4957,7 +4964,7 @@ chunk (runtime: main) 672.bundle.js X bytes (javascript) X bytes (webassembly) [
chunk (runtime: main) 787.bundle.js (id hint: vendors) X bytes [rendered] split chunk (cache group: defaultVendors)
./node_modules/env.js X bytes [built] [code generated]
chunk (runtime: main) bundle.js (main) X bytes (javascript) X KiB (runtime) [entry] [rendered]
runtime modules X KiB 11 modules
runtime modules X KiB 10 modules
./index.js X bytes [built] [code generated]
chunk (runtime: main) 836.bundle.js X KiB (javascript) X bytes (webassembly) [rendered]
./testFunction.wasm X bytes (javascript) X bytes (webassembly) [dependent] [built] [code generated]
@ -4967,7 +4974,7 @@ chunk (runtime: main) 946.bundle.js X bytes (javascript) X bytes (webassembly) [
./fast-math.wasm X bytes (javascript) X bytes (webassembly) [built] [code generated]
chunk (runtime: main) 989.bundle.js X bytes (javascript) X bytes (webassembly) [rendered]
./popcnt.wasm X bytes (javascript) X bytes (webassembly) [built] [code generated]
runtime modules X KiB 11 modules
runtime modules X KiB 10 modules
cacheable modules X KiB (javascript) X KiB (webassembly)
webassembly modules X bytes (javascript) X KiB (webassembly)
./Q_rsqrt.wasm X bytes (javascript) X bytes (webassembly) [built] [code generated]

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;

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