Commit Graph

157 Commits

Author SHA1 Message Date
alexander.akait 8f860a32d7 refactor: `strict` for config 2023-05-24 00:25:06 +03:00
Burhanuddin Udaipurwala ace1d93503 docs: add comment for todo 2023-05-16 10:05:58 +05:30
Burhanuddin Udaipurwala 8d75f3f751 feat: update defaults 2023-05-16 10:02:17 +05:30
Sean Larkin e958ac552b refactor(types): Improve module type strictness and refactor module type string usages in module subclasses 2023-05-04 23:19:11 +00:00
Michael Zlatkovsky 2203e24900 Add option to continue on trusted-types policy-creation failure
Webpack already allows for specifying a trusted-types policy name. However, its current implementation is such that if a call to trustedTypes.createPolicy fails, the code will immediately stop executing. This isn't necessarily desirable, as an application could be in the early phases of rolling out trusted types, and thus have the CSP rule for trusted-types LibraryA LibraryB etc, BUT have require-trusted-types-for 'script' be in "report only" mode (Content-Security-Policy-Report-Only). In such a configuration, and when the webpacked code is dynamically-loaded into an application, adding the policy name to the webpack config will break old versions.

This PR keeps the original behavior, but introduces a new option for onPolicyCreationFailure: "continue" | "stop" (with "stop" remaining the default). If a developer chooses the "continue" option, the policy-creation will be wrapped in a try/catch. There is no security risk to this, since for host applications that DO have strict enforcement of trusted-types, the code will simply fail when the dangerous sink is used (e.g., when doing parseFromString). And likewise, wrapping in try/catch and doing nothing on catch is OK, because the code already deals with the possibility of the trustedTypes API not being available on the browser.
2023-05-02 10:12:56 -07:00
Sean Larkin fa4cbf11a1 add more module type constants, use them across codebase 2023-03-31 10:56:32 -07:00
Thomas Tay 895df2a5a1 Worker public path changes 2022-10-21 16:30:43 -07:00
Ivan Kopeykin 1857792032 fix normalization 2022-07-09 03:23:21 +10:00
Ivan Kopeykin c82dc1eee4 Merge branch 'main' into support-create-require
# Conflicts:
#	declarations/WebpackOptions.d.ts
#	lib/config/defaults.js
#	schemas/WebpackOptions.check.js
#	schemas/WebpackOptions.json
#	test/Defaults.unittest.js
#	test/__snapshots__/Cli.basictest.js.snap
#	types.d.ts
2022-05-10 13:48:43 +03:00
Tobias Koppers e2df0ddd92
Merge pull request #15494 from webpack/feature/global-options-for-dynamic-import
add parser options for dynamic import
2022-05-10 12:44:52 +02:00
Ivan Kopeykin ee911c6aae add createRequire javascript parser option 2022-03-28 17:16:31 +03:00
Ivan Kopeykin 5a9ead926a fix discussion 2022-03-15 16:47:07 +03:00
Tobias Koppers f43047c4c2
Merge pull request #15002 from TrickyPi/fix-14927
Fix 14927
2022-03-15 11:44:23 +01:00
Ivan Kopeykin 62d50bad4b add parser options for dynamic import
- add dynamicImportMode for ContextModule
- add dynamicImportPrefetch for prefetch order
- add dynamicImportPreload for preload order
2022-03-09 10:27:02 +03:00
Tobias Koppers bd35396503 handle more cases with an regexp 2022-02-10 13:06:10 +01:00
TrickyPi d575996433 fix: exclude [name] placeholder when getting uniqueName 2022-02-09 11:11:46 +08:00
Ivan Kopeykin 75838c3f70 fix discussion 2022-02-04 17:56:47 +03:00
Ivan Kopeykin b254f350a7 update dynamicImport default, add test case 2022-02-03 15:11:43 +03:00
Ivan Kopeykin 3f10a17e2f set output.environment.module=true when output.module enabled 2022-02-02 10:13:20 +03:00
Ivan Kopeykin 232403c5e8 fix discussions 2022-01-28 12:00:53 +03:00
Ivan Kopeykin c09e82fcfe add importMeta to JavascriptParserOptions:
- enable/disable import.meta parsing
- when disabled insert output.importMetaName
2022-01-27 22:54:47 +03:00
pavelsavara 73bb43139d - add new config section importMeta
- use it in ImportMetaPlugin to switch it off as necessary
2022-01-25 16:08:56 +01:00
Tobias Koppers 1489b91a98 allow to generate only exports for css in node
add more options to the DeterministicModuleIdsPlugin to allow to opt-in into a fixed mode

optimize module iterations for module id assignment
2022-01-19 15:17:01 +01:00
Tobias Koppers 16784692d3 add `output.cssChunkFilename` 2021-12-17 12:18:01 +01:00
Tobias Koppers 453e5cac05 add support for :export {} block 2021-12-14 16:21:32 +01:00
Tobias Koppers 77b5589c1a css generation and hmr 2021-12-03 08:46:22 +01:00
Ivan Kopeykin 3feab5bc72 set hashDigestLength=16 for futureDefaults 2021-11-29 22:12:02 +03:00
Tobias Koppers 81f6c5b61c
Merge pull request #14718 from webpack/fix-managed-path
fix regexp in managed paths
2021-11-12 14:42:05 +01:00
Ivan Kopeykin adea157a91 fix regexp in managed paths 2021-11-12 15:36:03 +03:00
Tobias Koppers 9bb5651e6a add `asyncChunks: boolean` option to disable creation of async chunks 2021-11-10 15:04:44 +01:00
Mark Molinaro 0f22db981d Fix names of options to match the exported types 2021-11-06 00:01:21 +00:00
Tobias Koppers f9e6b682ab make exportsPresence strict by default in future 2021-11-05 16:13:49 +01:00
Tobias Koppers 7afcc5d4ff allow to disable some deprecations
add `experiments.backCompat: false` (default in `experiments.futureDefaults`)
remove unused `experiments.asset`
enable `experiments.topLevelAwait` and `experiments.asyncWebAssembly` by default in `experiments.futureDefaults`
2021-11-05 09:54:51 +01:00
Tobias Koppers d9c592738a refactor and add test cases
add `parser.exportPresence`, `parser.importExportPresence`, `parser.reeexportExportPresence` `"error" | "warn" | "auto" | false`
2021-11-02 18:29:47 +01:00
Tobias Koppers e189971705 Merge branch 'main' into mamolin/allow-ignore 2021-11-02 13:46:25 +01:00
Tobias Koppers ae52a74802 improve buildHttp
allow multiple configurations to write to the same lockfile
add allowedUris for allowlisting
add schema validation
2021-10-19 09:21:05 +02:00
Tobias Koppers 5e16d642ad allow RegExp as managed and immutable paths
add all node_modules as managedPaths in futureDefaults
2021-10-18 22:56:41 +02:00
Mark Molinaro b422943d2a Limit scope of changes to just HarmonyExportImportedSpecifierDependencies 2021-10-07 20:55:49 +00:00
Tobias Koppers 3b48429eb5 add MemCache for memory caching per module which is invalidated when module or any referenced modules changes
add `experiments.cacheUnaffected`
add `cache.cacheUnaffected` (type: memory) resp `cache.memoryCacheUnaffected` (type: filesystem)
2021-09-24 15:23:29 +02:00
Tobias Koppers da8e93af33 use xxhash64 for future defaults 2021-09-23 15:04:22 +02:00
Ivan Kopeykin 5592f6616f add experiments.futureDefaults
futureDefaults applies next major defaults
adds node.global=warn
node.__filename=warn-mock
node.__dirname=warn-mock
2021-09-14 11:29:57 +03:00
Tobias Koppers 60408e1136 add importModule to loader context by default
always enable experiments.executeModule and remove it
2021-09-02 16:27:39 +02:00
Tobias Koppers abe5005aec disable cache compression by default
it has a negative performance impact in many cases
2021-08-10 13:04:43 +02:00
Tobias Koppers b6609a4f6b add `experiments.buildHttp`
allows to build remote resources
stores remote resources in a lockfile
2021-08-05 15:47:18 +02:00
Sven Sauleau 6c50c81350 Revert "Revert "Merge pull request #12278 from xtuc/sven/import-assertions""
This reverts commit 61946b7c46.
2021-07-24 23:28:30 +01:00
Tobias Koppers 61946b7c46 Revert "Merge pull request #12278 from xtuc/sven/import-assertions"
This reverts commit df02bc6c0a, reversing
changes made to a6f341e243.
2021-07-16 21:54:21 +02:00
Tobias Koppers 7f22e4721f match on asserts
change Map to Record
improve test case
2021-07-16 13:17:20 +02:00
Sven Sauleau b166f46f2c parse import assertions 2021-07-16 13:14:54 +02:00
Tobias Koppers 492055ae90 add cache compression 2021-07-02 07:05:13 +02:00
Tobias Koppers f7766875bc
Merge pull request #13649 from webpack/cache/automatic-store
store cache after large changes
2021-06-28 17:35:14 +02:00