Commit Graph

256 Commits

Author SHA1 Message Date
Tobias Koppers 10aa3daede add experiments.layers
add layers to define different module layers
support module layers in stats

add layer support for NormalModules

fixes #11466
2021-01-05 20:50:59 +01:00
Tobias Koppers 63856cc017 get only readonly version of ExportInfo when determining module export type 2020-12-23 20:39:54 +01:00
Tobias Koppers 4c288fead3 compile typings in strict mode to include undefined and null in types 2020-12-16 18:28:49 +01:00
Tobias Koppers 7f691aacdf enable named exports for commonjs as node.js supports it now
fixes #11878
2020-11-03 09:14:59 +01:00
Tobias Koppers 11a7cac537 add useSimpleSourceMap flag to enable/disable OriginalSource for generated code
pass reduced options object to Source.map() function
2020-10-26 16:33:38 +01:00
Tobias Koppers 8e562aa260 fix some nitpicks with active state 2020-10-07 09:36:41 +02:00
Tobias Koppers fcca1d649d analyse source code for side effects
mark the module as side effects free in such cases
allow 3rd state TRANSITIVE_ONLY to be side-effect-free but dependencies should still be included (for mini-css-extract-plugin)
2020-10-06 14:10:29 +02:00
Tobias Koppers 5f750256f4
Merge pull request #11475 from webpack/bugfix/deprecated-timestamps
Deprecated timestamps performance and deprecation
2020-09-15 15:57:45 +02:00
Tobias Koppers 002d6f7342 deprecate needRebuild 2020-09-15 14:33:50 +02:00
Tobias Koppers 9af1d7526b refactor module concatenation to address discovered bugs/edge cases 2020-09-15 12:36:02 +02:00
Tobias Koppers 23e91dbbac move module concatenation bailout checks to Module and for NormalModule to Generator 2020-09-15 12:35:59 +02:00
Tobias Koppers fdd4a7713f add ConcatenationScope 2020-09-15 12:34:50 +02:00
Tobias Koppers cee47dc867 Store cache dependencies inside of Snapshot to reduce cache size 2020-08-24 18:16:54 +02:00
Tobias Koppers 71cf7f4dc8 add support for reexporting in CommonJS
and necessary refactoring + fixes for that
2020-08-17 21:32:47 +02:00
Ivan Kopeykin 4fc44a3398 add more types 2020-08-02 23:47:54 +03:00
Tobias Koppers 1265765141 polish, types 2020-07-27 22:41:04 +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 49e5ce2812
Merge pull request #11131 from webpack/bugfix/ignore-linking-errors-on-error
ignore linking errors when the imported module has errors
2020-07-09 10:22:35 +02:00
Tobias Koppers 5068909499 Avoid tracking/printing detailed usage info for modules without exportsType
Make ContextModule a static default exporting module
fix provided exports info for ExternalModule
2020-07-08 11:07:03 +02:00
Tobias Koppers 78920aa689 ignore linking errors when the imported module has errors 2020-07-07 17:54:15 +02:00
Tobias Koppers 44882683a9 fix compat for Module.source() method 2020-07-03 09:44:56 +02:00
Tobias Koppers a468cbbd2e add provide shared module plugin 2020-05-23 16:08:51 +02:00
Tobias Koppers 020cedf383 remove weird types
remove SKIP_OVER_NAME
update tooling for fixed "to not edit" comments
2020-05-12 15:58:43 +02:00
Tobias Koppers 952bc11510 fixes typing in ModuleGraph 2020-05-12 14:34:26 +02:00
Mohsen Azimi 1e0ad4ccd2 Upgrade to TypeScript 3.9 2020-05-12 14:34:24 +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 49a6184e20 add tests to increase code coverage 2020-04-16 22:20:04 +02:00
Mohsen Azimi 7b07a8db66 Upgrade to Prettier 2 2020-03-28 18:20:24 -04:00
evilebottnawi dafa4cd69a chore: setup cspell 2020-03-12 19:51:26 +03:00
Nitin Kumar 285529a643
chore: fix typos across the project 2020-03-10 07:29:46 +05:30
evilebottnawi 93dd2b0cfb chore(deps): update eslint plugins 2020-03-04 12:37:14 +03:00
Tobias Koppers 6477ca56f8 Split options defaulting in normalization and defaults
Apply defaults after plugins are applied to allow plugins to feature their own defaults.
This allows to make preset plugins.
2020-02-17 19:12:54 +01:00
Tobias Koppers 522d80f33b allocate less for empty Sets for runtime requirements and file/context/missingDependencies 2020-01-29 21:46:14 +01:00
Tobias Koppers dd4d68ac8f use Symbol to flag skipped export names 2019-12-06 11:13:14 +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
Tobias Koppers 5a01ed8121 rename exportsType named to default
exportsType default doesn't include named exports in strict esm
2019-11-20 12:43:53 +01:00
Tobias Koppers 74074a9b18 add deprecationCode argument to getChunk/ModuleGraphForChunk/Module 2019-11-15 10:07:41 +01:00
Tobias Koppers b90f3e14a1 upgrade webpack-sources
make source maps and source names context independent

add enhanced-resolve declarations
add types to Module.build
fix tooling for import order to support import renaming
add support for concatenated modules in eval source maps
2019-11-12 08:59:08 +01:00
Tobias Koppers 5abf55b1af allocate presentationalDependencies array only when needed 2019-11-10 21:05:28 +01:00
Tobias Koppers 14e901225c remove return value of ChunkGraph.connectChunkAndModule 2019-11-10 21:05:26 +01:00
Tobias Koppers 61e8b44fb9 allocate Module.factoryMeta only when needed 2019-11-10 21:05:21 +01:00
Tobias Koppers ed81ad0fa4 allocate warnings and errors arrays only when needed 2019-11-10 21:05:16 +01:00
Tobias Koppers efe0c2e610 avoid creating arrays in getConnections 2019-11-10 21:05:05 +01:00
Tobias Koppers a877cd51d1 add presentational dependencies which are cheaper, but allow only templating 2019-10-30 07:49:20 +01:00
Tobias Koppers 8d46b21fad add Dependency.getCondition and conditional ModuleGraphConnections
getDependencyReference is no longer used to check of connection
2019-10-30 07:48:32 +01:00
Ivan Kopeykin 7a3d9e38de Use AbstractMethodError all over the project 2019-10-20 13:24:28 +02:00
Tobias Koppers ddc3dae0e6 refactor Module.source() and Module.getRuntimeRequirements() into Module.codeGeneration
add code generation phase to Compilation
add `output.iife` options to remove iife wrapper
add `experiments.outputModule` which enabled `output.module`
add `output.module` which sets defaults to `output.iife: false`, `output.libraryTarget: "module"`, `output.jsonpScriptType: "module"`, `terserOptions.module: true`
add `output.module` example
improve runtime requirements needed by ConcatenatedModule
add entry inlining, which inlines entry module code into runtime scope (only when safe)
make whole bundle strict when all modules are strict
2019-10-08 23:59:48 +02:00
Tobias Koppers b80174a069 Improve backward-compat for various things
to enable mini-css-extract-plugin
2019-09-26 22:06:54 +02:00
Tobias Koppers 1d72a05fed Merge tag 'v4.36.0' into next
4.36.0
2019-07-17 16:02:33 +02:00
Tobias Koppers 1977cb1036 move async module flag to ModuleGraph 2019-06-05 11:15:25 +02:00
Tobias Koppers 903084f9aa WIP prototype of top-level-await and async modules based on import await 2019-06-04 23:25:35 +02:00
Tobias Koppers 43bc7a306e Refactor to track nested exports
Harmony dependencies track access to nested properties
Flag nested exports
2019-05-29 11:55:00 +02:00
Tobias Koppers 0c39719729 avoid zero sized modules as they lead to problems 2019-05-13 12:29:29 +02:00
Tobias Koppers 924daa105b Use simpler/faster hash function to get a hash number
Use deterministic mangled names for exports
refactor assignDeterministicIds
rename __webpack_init__ function in wasm to ""
fix bug with incorrectly cached StaticExportsDependency
fix bug in hash logic of Module
2019-02-20 22:41:07 +01:00
Tobias Koppers b6ad10b2c1 bugfixes and HarmonyExportImportedSpecifier optimization 2019-02-01 11:45:24 +01:00
Tobias Koppers 6fc0b96c9c add MangleExportsPlugin and options 2019-01-31 11:41:30 +01:00
Tobias Koppers 739fef4fda move usedExports into ExportsInfo 2019-01-28 08:38:37 +01:00
Tobias Koppers 921b295bc9 Create ExportsInfo and move provided exports and mangle info into this new object 2019-01-28 08:38:34 +01:00
Tobias Koppers d40f7b2642 cache contextify and pass associatedObjectForCache to all calls 2019-01-19 12:40:00 +01:00
Tobias Koppers eac069a46b move isProvided into ModuleGraph 2018-12-31 12:51:35 +01:00
Florent Cailhol a42922f663 Move provided exports to the module graph 2018-12-31 12:28:51 +01:00
Florent Cailhol d0a3c9f774 Update TypeScript 2018-12-31 09:19:05 +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 c1e89c0543 Runtime requirement support in NormalModule, Generators and DependencyTemplate 2018-11-29 16:06:12 +01:00
Tobias Koppers 0232674f9c Initial runtime module work 2018-11-29 16:03:32 +01:00
Tobias Koppers 23b335d902
Merge branch 'next' into types/modules 2018-11-16 14:40:11 +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
Florent Cailhol be8c6bbe71 Add types on module files 2018-11-07 14:03:25 +01:00
Tobias Koppers a852828279 add persistent caching prototype 2018-10-17 21:25:39 +02:00
Tobias Koppers 7340fbb547 refactor Cache
add a new hookable Cache class
removed CachePlugin
add MemoryCachePlugin
refactor timestamps
create FileSystemInfo class
2018-09-27 13:20:19 +02:00
Tobias Koppers 4eab41bd5f refactor Module.needBuild to be async 2018-09-27 11:20:54 +02:00
Tobias Koppers 162ed5f382 add some missing types for validation 2018-09-18 09:53:27 +02:00
Tobias Koppers 5b4cbb5ee0 add queues to Compilation
remove Semaphore and use AsyncQueue instead
deprecate Module.needRebuild, add Module.needBuild
remove Module.unbuild
add Module.invalidateBuild
2018-09-12 13:17:03 +02:00
Tobias Koppers bad9d8a271 move Module.id into ChunkGraph
remove disconnect and unseal from Module
2018-08-28 15:08:52 +02:00
Tobias Koppers 02b15a1b46 pass chunkGraph to updateHash instead of moduleGraph
pass chunkGraph to compareModulesById instead of moduleGraph
pass chunkGraph to methods of RuntimeTemplate
use comparators from module at some places
2018-08-28 12:06:53 +02:00
Tobias Koppers 239ce7fcd9 Use ChunkGraph instead of Compilation in updateHash 2018-08-24 12:02:42 +02:00
Tobias Koppers 3aa2280498 move Module.hash and .renderedHash into ChunkGraph 2018-08-22 19:24:54 +02:00
Tobias Koppers eb63cf80d6 move built flag into Compilation 2018-08-22 15:33:16 +02:00
Tobias Koppers e0f84652c0 remove Module.prefetched
remove prefeteched from Stats
make Compilation.addModuleChain public and remove onModule argument
remove Compilation.prefetch
2018-08-22 15:19:05 +02:00
Tobias Koppers b20556c1ff move profile to ModuleGraph 2018-08-22 14:54:28 +02:00
Tobias Koppers 26022c86a0 move Module.depth into ModuleGraph
nested modules no longer have depth and stay unsorted in stats
2018-08-22 12:45:11 +02:00
Tobias Koppers 5a78e96dc9 add backward-compat layer for ModuleGraph and ChunkGraph 2018-08-21 16:17:02 +02:00
Tobias Koppers 42167db4af move Module.index and index2 into ModuleGraph 2018-08-21 16:16:51 +02:00
Tobias Koppers 3bb5263bfd move methods from Module into ModuleGraph 2018-08-21 11:04:40 +02:00
Tobias Koppers 6d5310fbd6 allow multiple entryModules per chunk
allow to specify ChunkGroup to depend on
move entry modules into ChunkGraph
2018-08-15 11:51:16 +02:00
Tobias Koppers 3cf01999b5 add ChunkGraph
move chunk modules and module chunks into the ChunkGraph
remove outdated unit tests
2018-08-14 15:32:13 +02:00
Tobias Koppers d35e42a14d move Module.issuer into Module.getIssuer(moduleGraph) 2018-08-09 16:44:28 +02:00
Tobias Koppers 3347700225 improve optimization bailout message usefulness 2018-08-09 15:45:30 +02:00
Tobias Koppers 038d056aed add some hints for breaking changes 2018-08-06 21:05:13 +02:00
Tobias Koppers d6cf42e4c2 merge used with usedExports
usedExports = false now means module is not used
2018-08-06 21:05:11 +02:00
Tobias Koppers c4e0a9f72e Move Module.used and Module.usedExports into ModuleGraph 2018-08-06 21:04:01 +02:00
Tobias Koppers 97cc9d7140 Move optimizationBailout into ModuleGraph meta information 2018-08-06 10:42:41 +02:00
Tobias Koppers 381e2db200 replace Module.reasons and Dependency.module with ModuleGraph 2018-08-02 17:54:44 +02:00
Tobias Koppers 11e127d162 pass moduleGraph along with multiple methods 2018-08-02 17:54:42 +02:00
Tobias Koppers ec1329a7d4 make libIdent required
add types
2018-08-02 16:29:20 +02:00
Tobias Koppers 4ce109f8c1 change arguments of Generator.generate and Module.source into a object to be easier extensible
add JavascriptModulesPlugin.getHooks().shouldRender to decide if a module should be rendered
2018-08-02 16:07:29 +02:00