Commit Graph

154 Commits

Author SHA1 Message Date
Tobias Koppers 4ec418c8ee allow inner graph shaking for new URL()
fixes #11818
2021-01-19 13:31:55 +01:00
Tobias Koppers 7cc206974c upgrade typescript major version 2020-11-30 08:42:35 +01:00
Tobias Koppers c7ea63875c improve side effects analysis to report imported and reexports symbols as side-effect-free
add bailout messages for side effects
2020-11-28 18:10:27 +01:00
Tobias Koppers e1a405e3c2 prettier 2020-11-26 10:52:55 +01:00
Tobias Koppers 19f51535ca merge multiple import statements with different conditions correctly
improve hashing when conditional runtime evaluation is involved
add test cases
2020-10-27 06:48:54 +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 8db617db80 avoid error when target module failed 2020-09-25 10:53:12 +02:00
Tobias Koppers 39e1a7e4c7 move magic names to constants in ConcatenationScope
improve types
2020-09-15 12:36:06 +02:00
Tobias Koppers 21e202eb24 move concatenation logic to HarmonyImportSpecifierDependency 2020-09-15 12:35:30 +02:00
Ivan Kopeykin a3fc25cadb refactor asiSafe flag in dependencies 2020-08-29 17:00:03 +03: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 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
Pushkar DK 31e3369a73 Add 'webpackExports' & make only referenced exports available in import() 2020-06-06 00:11:21 +05:30
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 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 84b6817f60 consistency and bugfixes for reexporting json 2019-11-05 10:39:12 +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 a5b3177fc0 conditional import specifiers do not generate import statements when exports are unused 2019-09-06 14:49:05 +02:00
Tobias Koppers 2e37731988 add analysis for top level symbols, exports and imports
integrates the work of Vincent Chan for GSoC 2018

Co-authored-by: Vincent Chan <cdzos97@gmail.com>
2019-09-03 14:18:40 +02:00
Tobias Koppers ab169893a1 refactor Parser to allow variable tagging
use variable tagging in harmony pluging (instead of magic renaming)
Parser no longer calls hooks.expression for x in `x = ...`, hooks.pattern is called instead
remove rootName argument from hooks.expressionMemberChain and hooks.callMemberChain
2019-09-03 14:17:46 +02:00
Tobias Koppers 0bce5fd8d5 detect ASI and generate more efficient code when no semicolon need to be inserted 2019-08-22 23:03:38 +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 2c02db6b81 Avoid JSON.stringify for performance reasons 2019-07-26 13:59:11 +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 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 979e6e40a8 fix edgecase with script this context 2019-05-29 21:59:09 +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 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 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 bf1fc171ba runtime requirement for RuntimeGlobals.moduleFactories 2018-11-29 16:08:52 +01:00
Tobias Koppers a09b9a5b8f refactor call and callArgs for HarmonyImportSpecifierDependency 2018-10-17 21:25:41 +02:00
Tobias Koppers a852828279 add persistent caching prototype 2018-10-17 21:25:39 +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 0f1f69a9d6 hide id overriding in HarmonyImportSpecifierDependency 2018-08-21 11:06:59 +02:00
Tobias Koppers 3bb5263bfd move methods from Module into ModuleGraph 2018-08-21 11:04:40 +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 78f01763a2 add getNumberofIdOccurrences to Dependency as override-able method 2018-08-02 16:07:29 +02:00
Tobias Koppers 831e71c797 make argument of DependencyTemplate an object 2018-08-02 16:07:29 +02:00
Tobias Koppers f68c1f7ab6 add additional arguments to updateHash 2018-08-02 16:04:10 +02:00
Tobias Koppers cf5f1d723c format existing code 2018-07-30 21:29:21 +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 fcf3f63f0e add DependencyTemplate base class and inherit types from this
fix a few typing issues
2018-07-23 20:11:59 +02:00
Tobias Koppers b4699c0657 add order for DependencyReference
and add types for touched code
2018-06-08 13:20:57 +02:00
Tobias Koppers 115a72ce50 SideEffectsPlugin don't modify cache entries
fixes #7400
2018-05-27 21:53:21 +02:00
Mohsen Azimi 589f40b26a Add missing class member initializations found by TypeScript 2018-04-11 16:48:44 +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 8570165c1f Use a class for dependency references 2018-04-04 09:17:10 +02: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
Florent Cailhol f1092ad516 Update prettier toolchain 2018-03-26 16:56:10 +02:00
rhysd 81e47b6eaf Fix typos 2018-03-13 18:05:58 +09:00
Tobias Koppers 5238159d21 run prettier on existing code 2018-02-25 02:00:20 +01:00
Tobias Koppers 4d77f847db fix a crash with buildMeta of null 2018-02-09 17:35:28 +01:00
Tobias Koppers da5c8d87aa add tree-shaking for json modules 2017-12-22 19:49:43 +01:00
Tobias Koppers 53a1d6c7b5 replace harmonyModule flag with exportsType 3-state
exportsType falsy: It's non-harmony module
exportsType "namespace": It's a harmony module, the exports is the namespace object
exportsType "default": It's a harmony module, the exports is the default exports, named exports are properties of the default export
2017-12-22 19:42:41 +01:00
Tobias Koppers 2aac6badd5 move generated runtime code to RuntimeTemplate 2017-12-22 19:41:28 +01:00
Tobias Koppers ffb977fed4 refactor meta -> buildMeta, add factoryMeta
add compat layer to Module.meta
2017-12-12 16:57:50 +01:00
Tobias Koppers 758a388f69 pass runtimeTemplate to DependencyTemplate
move outputOptions and requestShortener into runtimeTemplate
2017-12-11 17:59:32 +01:00
Tobias Koppers 21cdc84b71 process imports from mjs to non-esm correctly
give nice error messages when importing non-esm the wrong way
It also disallows using namespace object from non-esm modules

fixes #5686
2017-11-23 14:10:52 +01:00
Tobias Koppers 5c489b6c5d Refactor harmony modules
separate side effects from specifier
fixes TDZ for export let/const
bigger bundles are caused by correct export const/let behavior

BREAKING CHANGE: Internal have changed. Plugins could rely on them.
2017-09-14 09:44:32 +02:00
Tobias Koppers 1ebca7e55d use `Object` constructor to clear context from functions 2017-05-21 20:16:39 +02:00
Tobias Koppers d967a4623c add `module.strictThisContextOnImports` option
to allow spec-comforming behavior this context on
called imported harmony functions
2017-05-21 09:23:35 +02:00
Joe Haddad fa47a39107
Add strictExportPresence option 2017-02-22 21:06:43 -05:00
Tobias Koppers 8e69a80847 code linting 2017-01-11 12:29:01 +01:00
timse 8fd2957417 refactor HarmonyImportSpecifierDependency to es6 (#3734) 2017-01-04 12:50:35 -06:00
Sean Larkin aa8d01bf8d refactor(eslint): Added no-unsed-vars, env specific .eslintrc's for buildin & hot (#3636)
* refactor(eslint): Added no-unsed-vars, env specific .eslintrc's for buildin & hot

* This change allows for buildin to now be part of the lint test by addition of an extra .eslintrc file which extends existing but sets es6 to false
* Turned on no-unused-vars for eslint, and then removed all warnings from turning that feature on
* Was getting notified of errors in "quote" property in eslintrc, so changed to correct value from error to 2.

* beautify

* swap invalid eslint config val
2016-12-30 09:43:49 -06:00
Tobias Koppers 76efbcf801 hide stack trace in export warnings 2016-09-07 09:46:53 +02:00
Tobias Koppers 65b70bf5ed finished refactory of tree shaking
changes format for dll manifest

#2953
fixes #2959
2016-09-07 09:44:53 +02:00
Tobias Koppers 3a6b649016 star import a non-harmony modules behaves like require
fixes #2732
2016-07-04 10:24:04 +02:00
Tobias Koppers 1ee3585fa1 compilation error don't affect parent module
recover after syntax error
assume es6 module on syntax error

#2117
2016-07-03 13:13:01 +02:00
Tobias Koppers c9143d49c7 warn when name is imported that is not exported 2016-06-24 01:52:28 +02:00
Tobias Koppers f4ba0d0f0a support for importing into object shothand
fixed #2522
2016-06-04 15:22:47 +02:00
Tobias Koppers d382b10683 fixed #2570 2016-06-04 14:19:20 +02:00
Tobias Koppers 75b93a1438 fixes #2455, fixes #2460 2016-05-14 14:33:04 +02:00
Tobias Koppers 9f1564d261 fixed some hashing issues with export renaming 2016-02-17 13:15:58 +01:00
Tobias Koppers 2b94afad33 check for not available module 2016-02-16 16:56:03 +01:00
Tobias Koppers d71d58a355 shorter binding 2016-02-13 10:13:39 +01:00
Tobias Koppers 1cf2cb5fef fixed and test edge cases with this scope in harmony imports 2016-02-13 10:00:47 +01:00
Tobias Koppers 84eb9a2741 fixed this scope in harmony imports 2016-02-13 09:33:30 +01:00
Tobias Koppers 22124e5bd4 fixed a few issues 2016-02-04 09:59:28 +01:00
Tobias Koppers 0eb5b20c58 added more stuff to the hash 2016-02-04 00:06:16 +01:00
Tobias Koppers 8cb0ee7b85 mangle harmony export names 2016-02-03 23:40:41 +01:00
Tobias Koppers 987d718c9c fixed #1833 2016-01-06 23:50:12 +01:00
Tobias Koppers cabe7866fa HMR with harmony modules 2015-11-01 23:27:53 +01:00
Tobias Koppers 03ecbd50f8 allow to use "old" modules from harmony modules 2015-10-31 15:28:13 +01:00