Commit Graph

55 Commits

Author SHA1 Message Date
Alexander Akait bc258291f6
fix: a lot of types (#19486) 2025-05-01 17:36:51 +03:00
Alexander Akait e5c3f95b84
feat: added ability to generate custom error content for generators (#19385)
Github Actions / lint (push) Waiting to run Details
Github Actions / basic (push) Waiting to run Details
Github Actions / validate-legacy-node (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 (18.x, ubuntu-latest, b) (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 (23.x, ubuntu-latest, a) (push) Blocked by required conditions Details
Github Actions / integration (23.x, ubuntu-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-04-05 17:37:35 +03:00
Alexander Akait b8b90d6ee9
fix: less `any` types (#19382) 2025-04-04 16:38:51 +03:00
Qingyu Wang 8ab85e29bb feat: implement `module.generator.json.JSONParse`
For large `.json` modules, webpack will generate `JSON.parse` by default for
better performance. But there are some circumstances that `JSON.parse` is not a
good choice (e.g.: when doing AOT compilation).

Thus, a new generator option `module.generator.json.JSONParse` is added to
disable generating `JSON.parse` for `.json` module.

The default value is kept as `true` and can be opt-out by custom rules.

fix: #19319
2025-03-13 22:24:10 +08:00
alexander-akait 9abab772ea fix: types 2025-03-07 19:02:26 +03:00
Alexander Akait 7168389ac6
fix: JSON generator now preserves `__proto__` property (#19232) 2025-02-14 23:57:39 +03:00
alexander.akait a86bff2874 fix: `JsonExportsDependency` cache 2024-12-19 05:07:45 +03:00
hai-x 3de7b0d330 refactor: use `module.parser.json.exportsDepth` 2024-12-14 01:24:31 +08:00
hai-x 38df65df32 perf: improve FlagDependencyExportsPlugin for large JSON by depth 2024-12-12 19:57:02 +08:00
alexander.akait b07142f672 refactor: module source types code 2024-11-01 00:14:05 +03:00
alexander.akait 8b864dbe81 fix: types 2024-10-23 23:30:31 +03:00
alexander.akait 93743d233a refactor: code 2024-08-02 19:32:31 +03:00
alexander.akait 40151be78e refactor: improve code 2024-08-02 19:32:29 +03:00
alexander.akait 9943f3506a style: improve style of code 2024-08-02 19:32:14 +03:00
alexander.akait 423e89b2c7 style: improve style of code 2024-08-02 19:32:13 +03:00
alexander.akait 4ee703f647 chore: improve jsdoc rules 2024-07-30 17:07:14 +03:00
Naru 2053d2d4a4 fix: add /*#__PURE__*/ to generated JSON.parse() call in JsonGenerator 2023-08-26 19:20:19 +09:00
alexander.akait e0c7b6c48f refactor: errors and lazy loading 2023-06-01 22:55:49 +03:00
alexander.akait fb7c0c637a refactor: strict types for assets and json and other 2023-05-25 01:09:00 +03:00
alexander.akait 0ff50f40e6 refactor(types): some more types 2023-04-28 21:09:46 +03:00
alexander.akait 2e23e67163 feat: more types for JSON type 2023-04-28 21:03:16 +03:00
Sean Larkin 4bcc0f0ed5 yarn lint fix 2023-03-31 09:45:36 -07:00
Sean Larkin 844fc55b36 refactor(moduletypes): introduce module type constants, reduce memory footprint define/json plugins 2023-03-31 09:26:38 -07:00
Ivan Kopeykin aa76e823b0 fix discussions 2022-05-13 16:32:24 +03:00
Ivan Kopeykin 575a5da70d refactor json modules 2022-05-09 14:00:18 +03:00
Dmitry Semigradsky ba95d08875 chore(deps): replace `json-parse-better-errors` to `json-parse-even-better-errors` 2022-04-16 15:01:53 +03:00
Tobias Koppers b42d94e42f serialize json data as buffer and decode on demand 2021-07-06 15:00:01 +02:00
Tobias Koppers e6f098903f fixes #13691 2021-07-05 11:22:13 +02:00
Tobias Koppers e21b1d46fe precompile schemas for improved startup performance 2021-04-16 16:02:58 +02:00
David Fong b01d694740 fix backslash-escaping string replace
Thanks, sokra!

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2021-02-10 18:25:18 +01:00
david-fong 68aca0a86d handle escaping + update jest snapshot 2021-02-10 18:23:52 +01:00
David Fong 9a8e6c8c24 Use single-quoted string for JSON marshalling
See #12641
2021-02-10 18:23:04 +01:00
Tobias Koppers 92fba2d346 fix json related tree shaking and caching problems
json with constructor property now caches correctly
json generation with object prototype property now works correctly
tree shaking json array when accessing length property now works correctly
fix incorrect call context when calling properties on imports from CommonJS modules

fixes #12615
2021-02-07 16:43:44 +01:00
highonweb bc1911bf78 Changed name of memorize function to memoize 2020-12-27 03:02:57 +05:30
evilebottnawi 8c19efb7fd chore(deps): update `schema-utils` 2020-10-05 21:58:54 +03:00
Tobias Koppers bd2106b512 implement module concatenation for json modules 2020-09-15 12:36:26 +02:00
Tobias Koppers e16bdfda6c refactor used exports analysis, hashing, code generation, optimizations
to keep track of runtimes, used exports depending on runtime

modules can have different hashes and generated code depending on runtime
chunks are only considered as equal for MergeDuplicateChunks and SplitChunks when exports used in contained modules are equal
added `optimization.usedExports: "global"` to opt-out from used exports analysis per runtime
added `splitChunks.usedExports` and `splitChunks.cacheGroups[x].usedExports` to enable/disable used exports comparing for modules
`splitChunks.usedExports` defaults to `true` in production
2020-07-27 22:40:44 +02:00
Tobias Koppers a643278726 refactor exports info logic always represent exports object instead of namespace object
improve test case
2020-04-22 21:01:29 +02:00
Tobias Koppers 567ff7f026 Don't use JSON.parse when json is a string 2019-12-20 12:53:17 +01:00
Tobias Koppers 782e4535ac Refactor how exportsType work
add flagged exportsType for __esModule flagged
add getExportsType to merge strict with exportsType
move CommonJsStuffPlugin into CommonJsPlugin
split CommonJsPlugin into imports and exports part
enable minimal tree shaking for CommonJs imports and exports
2019-12-06 11:13:08 +01:00
Tobias Koppers ae261ed4c1 move default object redirect logic into separate meta property 2019-12-06 11:12:26 +01:00
Ivan Kopeykin 1b3c667fd7 run lint fix 2019-12-03 20:48:31 +03:00
Ivan Kopeykin faea05d195 fix: use memorize util instead of lazyRequire 2019-12-03 20:31:39 +03:00
Ivan Kopeykin 4598ea539b feat(util/lazyRequire): tool for loading CommonJS modules lazily 2019-12-02 18:37:55 +03:00
Tobias Koppers 7abd77d8d4 fix typings for parse option 2019-11-30 21:56:21 +01:00
Tobias Koppers fa9ec727ba strings are also valid json data
simplify code
remove incorrect test case
2019-11-30 21:56:17 +01:00
Sergey Melyukov fce234f6b9 Merge remote-tracking branch 'upstream/master' into custom-json-parser 2019-11-30 14:17:48 +03:00
Tobias Koppers 2f3da77d38 Introduce a Parser base class to improve Parser types
Parser.parse must be always sync
make JSON and WASM modules strict

fix inherit-types tooling to omit static methods
2019-11-30 01:36:28 +01:00
Sergey Melyukov 39519c5187 remove a second parameter from Rule.parser.parse for Rule.type = 'json' 2019-11-29 22:26:12 +03:00
Sergey Melyukov e934792b2a support custom parser for json modules 2019-11-28 20:12:11 +03:00