Commit Graph

206 Commits

Author SHA1 Message Date
Tobias Koppers 9af1d7526b refactor module concatenation to address discovered bugs/edge cases 2020-09-15 12:36:02 +02:00
Tobias Koppers 9941a8a497 create root reexports based on export mappings instead of dependencies 2020-09-15 12:35:55 +02:00
Tobias Koppers 47344e7e77 move concatenation logic to HarmonyExportSpecifierDependency and HarmonyExportImportedSpecifierDependency 2020-09-15 12:35:13 +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
Tobias Koppers 3cf8299602 add test case for conflicting named with namespace reexport
and fix problem
2020-08-13 10:59:56 +02:00
Tobias Koppers 9b80cde76c store multiple targets per ExportInfo
resolve target when reading
2020-08-12 21:41:03 +02:00
Tobias Koppers 163e7674a0 track the target binding of harmony reexports
display target binding in module info header
check conflicting star exports (fixes #7562) when statically known
2020-08-11 20:13:01 +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 25a41fa9bb optimize storage format of ExportMode 2020-07-06 21:40:39 +02:00
Ivan Kopeykin da98e09d13 add more tests 2020-07-04 14:36:17 +03:00
Ivan Kopeykin 407cdd5eb4 fix usedExports issue 2020-07-04 13:24:16 +03:00
Ivan Kopeykin 85715ba2c9 add export * as namespace from "module" 2020-07-03 13:12:58 +03:00
Pushkar DK 31e3369a73 Add 'webpackExports' & make only referenced exports available in import() 2020-06-06 00:11:21 +05:30
Tobias Koppers fde5b3df11 allow to concatenate modules when used exports are known 2020-05-19 14:42:21 +02:00
Tobias Koppers fdf43eab16 Connect more info about exports when using export * 2020-05-19 03:16:21 +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 c94aea82cc enable export mangling for system.js externals
add __esModule flag only when needed
2020-03-05 14:07:55 +01:00
Tobias Koppers aace364df3 avoid crashing when exports info contains a circular reference
e. g. when using

import * as self from "./self";
export { self }
2020-02-21 12:21:29 +01:00
Tobias Koppers 4453c9632c make order of exports determinism for hashing
fixes #10174
2019-12-27 21:31:41 +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
Sergey Melyukov ba306b6f2c Merge remote-tracking branch 'upstream/master' into optimize-webpack-runtime-size 2019-12-02 19:54:21 +03:00
Sergey Melyukov 6b59d113a4 optimize webpack runtime size 2019-12-02 17:59:37 +03: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 84b6817f60 consistency and bugfixes for reexporting json 2019-11-05 10:39:12 +01:00
Tobias Koppers 09d182132a rename reference exports constants 2019-10-30 07:57:55 +01:00
Tobias Koppers 8696017c55 add Dependency.getReferencedExports
remove Dependency.getReference
remove DependencyReference
2019-10-30 07:48:37 +01:00
Tobias Koppers efe3a81325 remove sourceOrder from DependencyReference 2019-10-30 07:48:35 +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
Tobias Koppers 09d6301712 Move weak flag from DependencyReference to Dependency 2019-10-30 07:48:26 +01:00
Tobias Koppers e507392094 add output.ecmaVersion options to set emitted code style
fix a bug with prefetching initial chunks
InitFragments have get[End]Content methods which get a sourceContext
RuntimeModules have implicit chunk and compilation
changed default to `output.ecmaVersion: 2015`
2019-08-26 21:32:29 +02:00
Tobias Koppers f68bb833d2 Merge export getters in a module into single statement 2019-08-23 14:07:01 +02:00
Tobias Koppers 7ba057f787 Reduce memory usage for warnings/errors by avoiding empty arrays 2019-08-07 16:14:02 +02:00
Tobias Koppers 1d72a05fed Merge tag 'v4.36.0' into next
4.36.0
2019-07-17 16:02:33 +02:00
Daniel Ruf bb944d3de6
fix: remove duplicate code blocks in condition and switch-case 2019-06-15 13:31:45 +02:00
Tobias Koppers 6db94536ad Merge tag 'v4.34.0' into next
4.34.0
2019-06-13 10:51:12 +02:00
Tobias Koppers 8d5ad83b32 simplify code 2019-06-12 15:16:54 +02:00
alreadyExisted df5e118da4 fix(mjs): remove unused namespace build errors 2019-06-12 14:46:39 +02:00
Tobias Koppers ba77df23dd add warnings for non-default json module imports
unify linking error generation
2019-06-12 14:33:49 +02:00
Tobias Koppers fd4b3c503a pretty files 2019-06-09 11:23:42 +02:00
Tobias Koppers 1b685d1de8 change DependencyReference.importedNames to be always an string[][] 2019-05-29 11:55:07 +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 abc825d58f Merge tag 'v4.32.0' into next
4.32.0
2019-05-20 14:46:31 +02:00
Tobias Koppers a4bbdae0d2 fix problem with dll and sideEffects
allow to redirect module and id in reexports
SideEffects plugin redirects reexports too
fixes #9146
2019-05-20 11:28:33 +02:00
Tobias Koppers b6ad10b2c1 bugfixes and HarmonyExportImportedSpecifier optimization 2019-02-01 11:45:24 +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
Tobias Koppers 540b9a1c35 remove hasOwnProperty global 2018-11-29 16:12:52 +01:00
Tobias Koppers 32c3fca477 extract definePropertyGetter into RuntimeModule 2018-11-29 16:08:17 +01:00
Tobias Koppers 7c37a6a972 handle runtime requirements 2018-11-29 16:07:17 +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 eb28697419 move magic property names on __webpack_require__ into RuntimeGlobals file 2018-11-05 15:28:34 +01:00
Michael Ciniawsky e144c58142 feat(HarmonyExportImportedSpecifierDependency): make serializable 2018-10-17 21:25:43 +02:00
Tobias Koppers 6d09410a26 remove parserScope
it's not serializable and not needed anyway
2018-09-27 13:40:58 +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 3bb5263bfd move methods from Module into ModuleGraph 2018-08-21 11:04:40 +02:00
Tobias Koppers 34427c1845 migrate to init fragments in ConcatenatedModule 2018-08-09 15:45:45 +02:00
Tobias Koppers 227952c914 put reexports into the correct init section when possible
fixes #7857
2018-08-08 14:12:54 +02:00
Tobias Koppers 3618cc1b3c remove originModule from Dependencies and add parent module to ModuleGraph 2018-08-07 14:20:53 +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 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 831e71c797 make argument of DependencyTemplate an object 2018-08-02 16:07:29 +02:00
Tobias Koppers f5a457ffd4 add ExportsSpec type to getExports 2018-08-02 16:04:10 +02:00
Tobias Koppers f68c1f7ab6 add additional arguments to updateHash 2018-08-02 16:04:10 +02:00
Tobias Koppers d6f8e49c3a refactor getInitFraments to take TemplateContext
add a hack to include the current module as property in source
later we will refactor DependencyTemplate.apply to take a TemplateContext too
2018-07-30 23:07:50 +02:00
Tobias Koppers 5ae9491501 comments, renames 2018-07-30 23:07:30 +02:00
Tobias Koppers c5c4f6bdd3 remove DependencyTemplate.getInitFragments.source 2018-07-30 22:42:01 +02:00
Tobias Koppers e79d4e002b add stage to InitFragment 2018-07-30 22:39:04 +02:00
Florent Cailhol 6ea5a4ad22 Add types 2018-07-30 22:37:10 +02:00
Florent Cailhol 12f3c0f34e Fix TypeError when no import fragments are emitted 2018-07-30 22:36:39 +02:00
Florent Cailhol 55b73a54af Return null when no InitFragment is required 2018-07-30 22:36:23 +02:00
Florent Cailhol dcebd57aa4 Replace harmonyInit calls by InitFragments 2018-07-30 22:34:18 +02:00
Tobias Koppers cf5f1d723c format existing code 2018-07-30 21:29:21 +02:00
Tobias Koppers 2fa351a178 make ExportMode.module a callback function
fix comment
2018-07-26 15:53:11 +02:00
Florent Cailhol 60ef6a6a30 Make DependencyReference dynamic 2018-07-26 15:31:04 +02:00
Tobias Koppers eba85a491d add types to Dependency and subclasses 2018-07-25 09:33:48 +02:00
Tobias Koppers 93a28126a6 fixes order for reexported dependencies
fixes #7665
2018-07-05 20:40:19 +02:00
Tobias Koppers be896f2b34 fix bug 2018-06-23 15:30:04 +02:00
Tobias Koppers 3502287bbb emit correct code for reexport unused exports 2018-06-23 15:13:17 +02:00
Tobias Koppers b4699c0657 add order for DependencyReference
and add types for touched code
2018-06-08 13:20:57 +02:00
Florent Cailhol 2a9452e51b Add brackets for multiline if/for statements 2018-05-29 15:45:44 +02:00
Tobias Koppers 770847171d Merge branch 'master' into bugfix/namespace-object
# Conflicts:
#	lib/RuntimeTemplate.js
2018-05-28 22:42:21 +02:00
Tobias Koppers 115a72ce50 SideEffectsPlugin don't modify cache entries
fixes #7400
2018-05-27 21:53:21 +02:00
Tobias Koppers a926a19715 create better namespace objects
avoid using Object.assign (fixes #7162)
2018-05-03 12:55:00 +02:00
Mohsen Azimi 6f6c12cde2
Add test (I have no idea what I am doing) 2018-04-05 23:18:25 -07:00
Mohsen Azimi 8001f03b14
Merge branch 'set-concat' of github.com:mohsen1/webpack into set-concat 2018-04-05 23:04:57 -07:00
Mohsen Azimi aa536b7be1
Merge branch 'master' of github.com:webpack/webpack into set-concat 2018-04-05 23:03:00 -07:00
Florent Cailhol 5c8a4bb89f Unify Dependency#getExports result 2018-04-04 13:53:55 +02:00
Tobias Koppers f3c9bd01b9
Merge pull request #6953 from webpack/refactor/mode_deopt
Change internal representation of harmony export modes
2018-04-04 12:30:11 +02:00
Tobias Koppers e65751ac6f
Merge pull request #6932 from mohsen1/hideStack
Add HarmonyLinkingError class
2018-04-04 11:06:39 +02:00
Florent Cailhol 24a5699f39 Remove extraneous debug statement 2018-04-04 10:56:02 +02:00
Florent Cailhol 0596346dbc Always pass first argument of 'getMode' 2018-04-04 10:45:27 +02:00
Florent Cailhol 97c6703aab Make 'getReference' monomorphic 2018-04-04 10:45:27 +02:00
Florent Cailhol 8570165c1f Use a class for dependency references 2018-04-04 09:17:10 +02:00
Mohsen Azimi 793bee2007
Update HarmonyExportImportedSpecifierDependency.js 2018-04-03 22:54:22 -07:00
Mohsen Azimi 49637a2507
Update HarmonyExportImportedSpecifierDependency.js 2018-04-03 22:44:37 -07:00
Mohsen Azimi 96b0457ba8
Use add() to append items to activeExports set in HarmonyExportImportedSpecifierDependency 2018-04-03 21:36:14 -07:00
Mohsen Azimi 3e49fcd0a9
CR feedback 2018-04-03 21:10:07 -07:00
Mohsen Azimi 4ae95a6892
Add HideStackError class for errors that have hideStack = true 2018-04-02 09:58:07 -07:00