Commit Graph

4486 Commits

Author SHA1 Message Date
Mihail Bodrov ca80248f9c Minor optimization 2018-12-19 02:59:54 +03:00
Mihail Bodrov 1b3d0f6c27 Get rid of string 2018-12-19 02:59:53 +03:00
Mihail Bodrov 12dea1af24 Optimize getHashNumber 2018-12-19 02:59:53 +03:00
Tobias Koppers 123b0a64e7 add plugin system for Stats presets, defaults, creation and printing 2018-12-18 22:07:14 +01:00
Ilya Kantor a9d465f183 IgnorePlugin: add context argument to checkResource, deprecate checkContext 2018-12-18 11:27:06 +03:00
Tobias Koppers 4e653e73c6
Merge pull request #8510 from guybedford/next-tlr
Allow top-level return in script parsing, PR for #8509
2018-12-18 09:25:25 +01:00
Isiah Meadows 18d7396835 Remove a broken hook 2018-12-17 01:23:03 -05:00
guybedford 00c95f36b0 allow top-level return 2018-12-16 21:27:04 +02:00
Tobias Koppers 6c00d3676e
Merge pull request #8484 from webpack/feature/split_chunks_max_size
Add maxAsyncSize and maxInitialSize for SplitChunks
2018-12-16 18:44:15 +01:00
Tobias Koppers 6dd4e53444 ignore is no longer needed 2018-12-15 14:28:47 +01:00
Chuck Dumont d49082a26d Make some AMD dep classes easier to subclass 2018-12-13 21:09:16 -05:00
Florent Cailhol 30fabc10ec Change webpack() callback signature 2018-12-13 10:57:05 +01:00
Florent Cailhol b916ff1491 Improve SplitChunksPlugin typings 2018-12-12 10:49:16 +01:00
Florent Cailhol e06b4853d6 Add compiler typings 2018-12-12 10:26:53 +01:00
Florent Cailhol 2a10b12e09 Add maxAsyncSize and maxInitialSize options 2018-12-11 20:47:50 +01:00
Florent Cailhol 5f26040786 Add types to SplitChunksPlugin 2018-12-10 22:09:27 +01:00
Florent Cailhol 760b1da9f3 Add maxInitialSize and maxAsyncSize options 2018-12-10 21:05:39 +01:00
Florent Cailhol 3d72d6144e Add CompilerStatus type 2018-12-10 11:41:15 +01:00
Florent Cailhol 5923c62fdf Export NodeEnvironmentPlugin 2018-12-10 11:40:59 +01:00
Florent Cailhol 9caaa664f7 Refactor webpack main 2018-12-09 15:32:03 +01:00
Tobias Koppers 0d2faa0d0a
Merge pull request #8460 from webpack/refactor/node_polyfills
Do not polyfill node bindings by default
2018-12-08 12:23:24 +01:00
Tobias Koppers 3c3ec62933 vertical lines in child compiler name will show as space in stats 2018-12-08 09:35:15 +01:00
Tobias Koppers d71fdf0a29 don't split identifier at space, as space could to part of paths 2018-12-08 09:29:21 +01:00
Tobias Koppers 4c965bfbab simplify regex 2018-12-08 09:21:35 +01:00
Tobias Koppers 5563ee9e58 use makePathsRelative instead of contextify
unify contextify and makePathsRelative
separate NormalModuleFactory ignored, ContextModule and ConcatenatedModule identifier with "|"
2018-12-07 18:12:04 +01:00
Tobias Koppers a83e0daca6 replace RequestShortener with contextify in id generation 2018-12-07 16:07:40 +01:00
Tobias Koppers a21bc44345 ignored module no longer contain context path 2018-12-07 15:46:32 +01:00
Tobias Koppers 350817ea4f make identifier of ConcatenatedModule context-independent 2018-12-07 15:36:49 +01:00
Tobias Koppers f60c8d8f0e bugfixes and optimizations
optimize name map for name equals id
bugfixes in named ids assigning
assign name before automatic ids
2018-12-07 15:14:14 +01:00
Tobias Koppers ca46218787 add defaults for deterministic id plugins 2018-12-07 14:47:25 +01:00
Tobias Koppers fe80339d71 use - instead of ~ as default for better compat
fix automaticNameDelimiter in splitChunks
fix test cases
2018-12-07 14:46:49 +01:00
Tobias Koppers 8281667668 improve ids for Long Term Caching
add deterministic chunk ids and make it default
StatsTestCases no longer need to explicitly use natural ids as the defaults are deterministic now too
add concept of id name hints for chunks
add `idHint` option to splitChunks to provide a hint
deduplicated code from different id plugins to IdHelpers
improve behavior of named ids in case of conflicts
remove `name: true` and `automaticNamePrefix` from splitChunks it's not as good as expected
improve named chunk ids to show root modules
2018-12-07 12:26:35 +01:00
Florent Cailhol 3c50dba922 Remove global buildin 2018-12-07 08:59:41 +01:00
Florent Cailhol a68426e925 Add error message 2018-12-07 08:58:55 +01:00
Florent Cailhol 002128c288 Do not polyfill node bindings by default 2018-12-07 08:58:26 +01:00
Florent Cailhol a2ccf34d98 Fix ModuleDecoratorDependency serialization 2018-12-06 22:16:56 +01:00
Florent Cailhol c148033fe9 Remove module.webpackPolyfill guard 2018-12-06 22:16:55 +01:00
Florent Cailhol 74e6346363 Replace module buildins by runtime modules 2018-12-06 22:16:31 +01:00
Tobias Koppers bc667a50b1 algorithm improvements 2018-12-06 21:00:57 +01:00
Tobias Koppers 59e67d8fa4 optimize array operation 2018-12-06 21:00:50 +01:00
Tobias Koppers 2b518a6c67 Wrap chunk ids in table in correct syntax 2018-12-06 21:00:43 +01:00
Tobias Koppers e5e0f44e29 add algorithm to extract graph roots
show only graph roots in chunks by default
2018-12-06 20:57:04 +01:00
Tobias Koppers adb7076609
Merge pull request #8469 from webpack/refactor/amd_buildin
Use RuntimeModule for AMDPlugin
2018-12-06 20:28:57 +01:00
Tobias Koppers 3afdccbe3d
Merge pull request #8459 from webpack/feature/source-type-size
Add support for multiple different sizes per module
2018-12-06 19:52:50 +01:00
Florent Cailhol 1d90704bc7 Replace AMD buildins by runtime modules 2018-12-06 15:14:43 +01:00
Florent Cailhol 82e75b8eb3 Tweak SystemPlugin 2018-12-06 14:54:27 +01:00
Tobias Koppers 6b75ff0dea
Merge pull request #8461 from webpack/refactor/deprecate_asp
Deprecate AggressiveSplittingPlugin
2018-12-06 12:34:07 +01:00
Mihail Bodrov 6f5c5ef33c Use document.head instead of getElementsByTagName
Update snapshot
2018-12-06 03:00:23 +03:00
Tobias Koppers 387803bf3d re-add accidentally removed type 2018-12-05 20:23:47 +01:00
Tobias Koppers 40e4860aef Use correct size of getIntegratedChunksSize 2018-12-05 20:23:45 +01:00
Tobias Koppers a3edfe6ef6 Support sizes for chunk and in stats for chunk 2018-12-05 20:23:43 +01:00
Tobias Koppers 30a68b20c7 support different size types in SplitChunksPlugin 2018-12-05 20:23:40 +01:00
Tobias Koppers 2b68e46906 show all sizes in stats 2018-12-05 20:19:02 +01:00
Tobias Koppers cc34ea42b0 add type argument to Module.size
add getSize to Generator
2018-12-05 20:18:59 +01:00
Tobias Koppers dff9278d6b add Module.getSourceTypes
getSourceTypes declares all source types which can be generated
Remove shouldRender in favor of source type testing
2018-12-05 20:18:57 +01:00
Tobias Koppers 0cd0291011 Merge tag 'v4.27.1' into next
4.27.1
2018-12-05 20:17:58 +01:00
Tobias Koppers b56727ec83 enforce should not prevent using `minChunks` etc. on cacheGroup
Partial revert "enforce doesn't affect minSize for maxSize"
2018-12-05 19:38:10 +01:00
Florent Cailhol 29bfa35cc7 Fix typings 2018-12-05 19:21:18 +01:00
Florent Cailhol bfb9df6c20 Use a runtime module to inject System polyfill 2018-12-05 19:02:22 +01:00
Florent Cailhol 1c4d973be7 Deprecate AggressiveSplittingPlugin 2018-12-05 15:02:45 +01:00
Tobias Koppers e5e648061c
Merge pull request #8448 from sodatea/wasm-resolve
fix: `.wasm` extension should have lower priority when resolving modules
2018-12-05 12:36:11 +01:00
Tobias Koppers 0ff1a4f8f8 Merge tag 'v4.27.0' into next
4.27.0
2018-12-04 11:02:26 +01:00
Tobias Koppers a67ffcda1c
Merge pull request #8452 from webpack/feature/resolveWithOptions
add getResolve method to loader context
2018-12-04 10:18:52 +01:00
Tobias Koppers 2f4296e8d9 fix a bug which causes incorrect providedExports for cached modules
Always update providedExports when they have dependencies

fixes #8455
2018-12-04 09:51:54 +01:00
Tobias Koppers 162da1c509 add getResolve method to loader context
with allows to pass options
2018-12-03 12:42:28 +01:00
Tobias Koppers 3b46b48fa7 enforce doesn't affect minSize for maxSize
enforce now works as documented
emit warning for minSize > maxSize configuration
performance improvements
bugfix when multiple cacheGroups have the same name

fixes #8407
2018-12-03 11:57:33 +01:00
Haoqun Jiang 8a083ff48c
fix: also change WebpackOptionsDefaulter 2018-12-01 18:40:17 +08:00
Haoqun Jiang 4d24c5e78a
fix: `.wasm` extension should have lower priority when resolving modules
fixes #8445
2018-12-01 00:25:10 +08:00
Tobias Koppers 72a8a1f97e
Merge pull request #8440 from Connormiha/oprimize-chunk-can-be-integrated
Cache hasRunstime in chunk
2018-11-30 14:30:26 +01:00
Tobias Koppers a8e51c322b make hashing more consistent 2018-11-30 13:19:55 +01:00
Tobias Koppers 6388108e0d refactor AMDDefineDependency defintions for better readablility 2018-11-30 12:23:20 +01:00
Tobias Koppers 5656d7d8cd make APIPlugin dependencies consistent 2018-11-30 12:22:36 +01:00
Tobias Koppers 49f79cb702 add types to new hooks 2018-11-30 12:21:57 +01:00
Tobias Koppers 4bc36e80f6 replace context with var 2018-11-30 12:16:38 +01:00
Tobias Koppers 25d286014c fix a memory leak 2018-11-30 11:19:14 +01:00
Mihail Bodrov 537d3e482f Cache hasRunstime in chunk 2018-11-30 02:59:26 +03:00
Tobias Koppers c006675dd9 remove main template hooks for HMRPlugin 2018-11-29 17:14:40 +01:00
Tobias Koppers 48a18948f2 revert id generation changes for runtime modules
They no longer have ids
2018-11-29 17:08:44 +01:00
Tobias Koppers a54645ab5b fix test cases 2018-11-29 16:24:00 +01:00
Tobias Koppers 5c7d6d2db6 change ensureHandlers from array to object 2018-11-29 16:23:36 +01:00
Tobias Koppers 8066eaf299 put runtime modules into separate place in chunks
don't include them in modules array/object
better stats output for runtime moduels
2018-11-29 16:23:31 +01:00
Tobias Koppers 9d91861592 Refactor HMR for runtime modules
fixed a few HMR bugs
allow other module types for HMR
made HMR more flexible
2018-11-29 16:22:29 +01:00
Tobias Koppers fa0ec849bd replace renderCurrentHash with RuntimeGlobals.getFullHash 2018-11-29 16:19:22 +01:00
Tobias Koppers cf626c612a Preparations for HMR refactoring 2018-11-29 16:18:45 +01:00
Tobias Koppers f7f8e0ff0f fixes for SourceMap handling 2018-11-29 16:17:37 +01:00
Tobias Koppers f753f92c28 ensureChunk to RuntimeModule
step 1: non HMR cases
2018-11-29 16:16:39 +01:00
Tobias Koppers 2857ad3ee4 runtime module for getChunkFilename 2018-11-29 16:15:26 +01:00
Tobias Koppers 3292879380 generate runtime module hash later to allow to include chunk hashes 2018-11-29 16:13:56 +01:00
Tobias Koppers 9b72fdcea0 fix runtime source map name 2018-11-29 16:13:30 +01:00
Tobias Koppers 2849281702 remove generateContext from RuntimeModule.generate
add public path runtime module
2018-11-29 16:13:26 +01:00
Tobias Koppers 540b9a1c35 remove hasOwnProperty global 2018-11-29 16:12:52 +01:00
Tobias Koppers b6d4ece8e8 Runtime Module for compatGetDefaultExport 2018-11-29 16:12:21 +01:00
Tobias Koppers 8803f52ce2 Runtime Module for CreateFakeNamespaceObject 2018-11-29 16:11:44 +01:00
Tobias Koppers dcbd67fdfe Runtime Module for MakeNamespaceObject 2018-11-29 16:11:11 +01:00
Tobias Koppers 0500655b63 move runtime modules boostrap into RuntimePlugin 2018-11-29 16:10:35 +01:00
Tobias Koppers 458baa33d4 runtime requirement for RuntimeGlobals.entryModuleId 2018-11-29 16:10:02 +01:00
Tobias Koppers 40dce1fe21 runtime requirement for RuntimeGlobals.moduleCache 2018-11-29 16:09:24 +01:00
Tobias Koppers bf1fc171ba runtime requirement for RuntimeGlobals.moduleFactories 2018-11-29 16:08:52 +01:00
Tobias Koppers 32c3fca477 extract definePropertyGetter into RuntimeModule 2018-11-29 16:08:17 +01:00
Tobias Koppers f770143164 Provide module when using module.hot 2018-11-29 16:07:21 +01:00
Tobias Koppers 7c37a6a972 handle runtime requirements 2018-11-29 16:07:17 +01:00
Tobias Koppers 2525c8b7aa move runtime requirements storage into ChunkGraph
use info for function generation
for noParse default to module and exports requirements
2018-11-29 16:06:44 +01:00
Tobias Koppers c1e89c0543 Runtime requirement support in NormalModule, Generators and DependencyTemplate 2018-11-29 16:06:12 +01:00
Tobias Koppers 507c2a85ce merge ExtendedAPIPlugin into APIPlugin 2018-11-29 16:05:39 +01:00
Tobias Koppers 48958dedd3 convert __webpack_hash__ to runtime module 2018-11-29 16:04:39 +01:00
Tobias Koppers 004a5f6fb4 converted __webpack_chunk_name__ into a runtime module 2018-11-29 16:04:07 +01:00
Tobias Koppers 0232674f9c Initial runtime module work 2018-11-29 16:03:32 +01:00
Tobias Koppers d5479d8fa7 move reserved names to top of module 2018-11-29 16:01:37 +01:00
Tobias Koppers e3e8a68dab
Merge pull request #8405 from xiaoxiaojx/fix-function-plugin-apply
fix parameter missing  when plugin type is a funtion
2018-11-29 15:52:00 +01:00
Tobias Koppers 126b8d752c
Merge pull request #8420 from webpack/refactor/remove_tapable_context
Remove context usage in ProgressPlugin
2018-11-29 15:49:47 +01:00
Tobias Koppers 5fb6c5ea18
Merge pull request #8418 from webpack/types/misc
Preliminary work before typing the parsers
2018-11-29 15:48:56 +01:00
Tobias Koppers fa87116ea1 Merge tag 'v4.26.1' into next
4.26.1
2018-11-29 14:51:27 +01:00
Florent Cailhol 15997e2324 Remove context usage in ProgressPlugin 2018-11-27 08:58:43 +01:00
Florent Cailhol cc739eb83a Minor optimizations 2018-11-26 16:26:18 +01:00
shaw 70b9a1b0b7 fix parameter missing when plugin type is a funtion 2018-11-26 22:37:08 +08:00
Florent Cailhol d35c2159e9 Make tooling happy 2018-11-25 21:29:48 +01:00
Florent Cailhol 57ca3f5fa3 Type internal data structures 2018-11-25 21:12:28 +01:00
Tobias Koppers cbeaf70dfd prevent groups with size < minSize
fixes #8407
2018-11-25 11:41:30 +01:00
Tobias Koppers 32961f2aac while grouping nodes include at least one node on each side
fixes #8407
2018-11-24 08:01:59 +01:00
Florent Cailhol 101b0ebb0f Add typings for JSON parser & deps 2018-11-23 21:52:05 +01:00
Florent Cailhol 66dd4f992a Add missing typings 2018-11-23 21:50:26 +01:00
Tobias Koppers fd2133bc5b handle case when minSize > maxSize
fixes #8407
2018-11-23 09:01:53 +01:00
Shah Kashani 217b2ad7e2 Fix for #8398 - call failed-hook on compilation errors 2018-11-21 11:16:25 -05:00
Tobias Koppers 1ba01f1f31
Merge pull request #8349 from webpack/types/modules
Add types on module files
2018-11-21 11:19:20 +01:00
Ed Morley 311a7285d3 Switch from uglifyjs-webpack-plugin to terser-webpack-plugin
Some history:
* `uglifyjs-webpack-plugin` < v1.0 used the minifier `uglify-js`
* however `uglify-js` does not support ES6, which resulted in a fork
  called `uglify-es` that was developed in the `uglify-js` repository,
  but under the `harmony` branch
* `uglifyjs-webpack-plugin` v1.x switched to `uglify-es` for ES6 support
* however `uglify-es` stopped being maintained:
  https://github.com/mishoo/UglifyJS2/issues/3156#issuecomment-392943058
* which led to a fork called `terser` that has incorporated all of
  the unmerged PRs and will be where all new development occurs:
  https://github.com/fabiosantoscode/terser
* `terser-webpack-plugin` was created, which is the `terser` equivalent
  of `uglifyjs-webpack-plugin`:
  https://github.com/webpack-contrib/terser-webpack-plugin
* `uglifyjs-webpack-plugin` v2.x will be switching back to `uglify-js`,
  so any project that needs to support ES6 now needs to switch to
  `terser-webpack-plugin`.

Fixes #7923.
2018-11-18 22:56:10 +03:00
Tobias Koppers e84115af9b add missing import 2018-11-18 13:26:15 +01:00
Tobias Koppers 96e3d0c058 fix typo 2018-11-18 12:37:08 +01:00
Tobias Koppers 350894ae9e add missing jsdoc comment 2018-11-18 12:36:22 +01:00
Tobias Koppers 722bd25d07 fix bug, which prevented auto accept of harmony dependencies 2018-11-18 11:50:21 +01:00
Tobias Koppers dda3c03b8d Refactor getInitFragments to a property in templateContext and apply method
Having only a single method in DependencyTemplate makes it easier to override
2018-11-16 16:40:03 +01:00
Tobias Koppers 23b335d902
Merge branch 'next' into types/modules 2018-11-16 14:40:11 +01:00
Tobias Koppers 9410954ed1
change TODO to webpack 6 2018-11-14 13:14:05 +01:00
Tobias Koppers c89c9a7dc5 add backwards-compat hook for normalModuleLoader 2018-11-13 17:55:42 +01:00
Florent Cailhol 3157f5dfb4 Add hook map types 2018-11-12 14:26:33 +01:00
Florent Cailhol 3766869c48 Move normalModuleLoader hook 2018-11-12 14:26:32 +01:00
Florent Cailhol 23bd3d7bd4 Add type guard for NormalModule 2018-11-12 14:26:32 +01:00
Florent Cailhol caefde17ab Remove devtoolLineToLine and lineToLine options 2018-11-12 14:26:31 +01:00
Florent Cailhol 8a10ea3c92 Type 'apply' method of plugins 2018-11-12 14:26:31 +01:00
Tobias Koppers 63e15dac11
Merge pull request #8359 from webpack/types/bump-ts
Update TypeScript and fix raised errors
2018-11-11 12:10:14 +01:00
Florent Cailhol 9ffb4e45dc Replace Source#emitted by a WeakSet 2018-11-08 23:26:31 +01:00
Florent Cailhol aa9586a76c Add types to SizeLimitsPlugin 2018-11-08 22:13:56 +01:00
Tobias Koppers 59250743ba
fix message update in ModuleRestoreError 2018-11-08 18:08:12 +01:00
Timur Amirov 7a0af76dac Fix a typo in Chunk#split jsdoc comment 2018-11-07 22:07:51 +01:00
Florent Cailhol 63c9a87af0 Remove unused method from ChunkGroup 2018-11-07 16:17:05 +01:00
Florent Cailhol de41d1fe8b Add missing types on Chunk related classes 2018-11-07 14:10:57 +01:00
Florent Cailhol be8c6bbe71 Add types on module files 2018-11-07 14:03:25 +01:00
Tobias Koppers 4178b18196 Merge tag 'v4.25.1' into next
4.25.1
2018-11-05 19:54:56 +01:00
Tobias Koppers ad6847ce17
Merge pull request #8336 from webpack/feature/progress-use-queue
show module count earlier when they are added to the queue
2018-11-05 18:23:58 +01:00
Tobias Koppers eb28697419 move magic property names on __webpack_require__ into RuntimeGlobals file 2018-11-05 15:28:34 +01:00
Tobias Koppers babe736cfa replace prefix/postfix even when equal for wrapped context
walk inner expressions in wrapped context
add tracking of inner expressions in wrapped BasicEvaluatedExpression
fixes #8293
closes ##8337
2018-11-05 15:17:56 +01:00