Commit Graph

217 Commits

Author SHA1 Message Date
Tobias Koppers cc34ea42b0 add type argument to Module.size
add getSize to Generator
2018-12-05 20:18:59 +01:00
Tobias Koppers 7c37a6a972 handle runtime requirements 2018-11-29 16:07:17 +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 d5479d8fa7 move reserved names to top of module 2018-11-29 16:01:37 +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
Tobias Koppers 4f1905aa5a Merge tag 'v4.20.2' into next
4.20.2
2018-09-25 23:13:58 +02:00
Tobias Koppers aab3afbef8 fixes #8085 2018-09-25 21:52:03 +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 239ce7fcd9 Use ChunkGraph instead of Compilation in updateHash 2018-08-24 12:02:42 +02:00
Tobias Koppers eb63cf80d6 move built flag into Compilation 2018-08-22 15:33:16 +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 a92c23ef76 fixes #7930 2018-08-22 11:11:37 +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 c21d59f783 Merge tag 'v4.17.0' into next
4.17.0
2018-08-21 11:02:16 +02:00
Tobias Koppers ed9691585e
Merge pull request #7907 from Connormiha/simplify-context-replacmnet-plugin
Get rid of typeof for checking undefined
2018-08-21 10:21:29 +02:00
Mihail Bodrov 1f954b4f12 Get rid typeof undef in all lib 2018-08-21 03:26:50 +03:00
Tobias Koppers 9315ce29aa fix exporting globals in scope-hoisted modules
fixes #7905
2018-08-20 10:54:05 +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 1345ab252d fixes #7887 2018-08-14 11:25:59 +02:00
Tobias Koppers 34427c1845 migrate to init fragments in ConcatenatedModule 2018-08-09 15:45:45 +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 ec1329a7d4 make libIdent required
add types
2018-08-02 16:29:20 +02:00
Tobias Koppers 831e71c797 make argument of DependencyTemplate an object 2018-08-02 16:07:29 +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
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 c5c4f6bdd3 remove DependencyTemplate.getInitFragments.source 2018-07-30 22:42:01 +02:00
Florent Cailhol 6ea5a4ad22 Add types 2018-07-30 22:37:10 +02:00
Florent Cailhol 55b73a54af Return null when no InitFragment is required 2018-07-30 22:36:23 +02:00
Florent Cailhol 9b7d9eb96f Fix review comments 2018-07-30 22:36:06 +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
Florent Cailhol 60ef6a6a30 Make DependencyReference dynamic 2018-07-26 15:31:04 +02:00
Tobias Koppers ea96c6bc93 type templates in ConcatenatedModule 2018-07-25 13:16:08 +02:00
Tobias Koppers bc10939096 add types for Module and subclasses
better way to handle "optional" methods
2018-07-25 12:12:17 +02:00
Tobias Koppers 66d3f319a6 Merge tag 'v4.16.2' into next
4.16.2
2018-07-23 12:19:16 +02:00
Tobias Koppers 8614c75f11 run inherit types tool on existing code 2018-07-21 13:50:18 +02:00
Tobias Koppers e0abce0dd8 make DependencyTemplates a new class 2018-07-11 13:11:08 +02:00
Tobias Koppers 0a06f19fd8 Merge tag 'v4.15.0' into next
4.15.0
2018-07-04 22:19:50 +02:00
Tobias Koppers bd2e3448ec Merge tag 'v4.14.0' into next
4.14.0
2018-07-04 22:10:53 +02:00
Tobias Koppers 994675c4fe Merge tag 'v4.12.2' into next
4.12.2
2018-07-04 21:55:42 +02:00
Florent Cailhol d33f49d96f Rename Parser into JavascriptParser 2018-07-03 14:08:43 +02:00
Tobias Koppers 949df5bb5a update webpack-sources types and remove second argument 2018-06-29 19:12:33 +02:00
Tobias Koppers 6e68f96d16
Merge branch 'master' into feature/type-compiler-compilation-save 2018-06-29 19:02:35 +02:00
Tobias Koppers d0c89618f3
Merge branch 'master' into feature/type-compiler-compilation-save 2018-06-27 14:58:10 +02:00
Tobias Koppers 7beac3c645
Merge branch 'master' into feature/hook-into-get-reference 2018-06-27 14:34:28 +02:00
Tobias Koppers ab7ecb30ee fixes #7499 2018-06-26 15:27:44 +02:00
Tobias Koppers 41343d1763 add TODO comments 2018-06-25 16:18:21 +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 50fe2e79ee add Compilation.getDependencyReference and hooks to override it
expose DependencyReference class
2018-06-23 15:13:14 +02:00
Tobias Koppers e1f0a66fd9 add note about webpack 5 refactoring 2018-06-23 14:47:09 +02:00
Sean Larkin c3ebef7f25
Merge branch 'master' into feature/type-compiler-compilation-save 2018-06-21 11:07:33 +03:00
Tobias Koppers 6f90257b5b
Merge pull request #7507 from webpack/feature/dependency-order
add order to dependency reference
2018-06-20 12:17:26 +02:00
Tobias Koppers 3f6450410a improve error message for circular reexports
fixes #7547
2018-06-19 23:19:28 +02:00
Tobias Koppers b4699c0657 add order for DependencyReference
and add types for touched code
2018-06-08 13:20:57 +02:00
Sean Larkin 1bae93852a
Merge branch 'master' into feature/type-compiler-compilation-save 2018-05-30 19:35:36 -07: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
Sean Larkin 761d73b4e7 chore(types): add Compiler and Compilation type support 2018-05-15 15:04:38 +02:00
Tobias Koppers a926a19715 create better namespace objects
avoid using Object.assign (fixes #7162)
2018-05-03 12:55:00 +02:00
Kevin Decker bd7652823c Invalidate concatenated module on dep change
When the moduleSet for a given concatenated module changed, the source for the embedded modules would not necessarily, which lead to caching mismatch between the source and the modulesWithInfo structure.

Fixes #6168
2018-04-28 15:32:28 -05:00
Tobias Koppers 2fa104f73a avoid walking scopes multiple times for performance reasons 2018-04-03 22:21:04 +02:00
Tobias Koppers 8d8da4cdff Merge branch 'master' into bump_prettier 2018-03-29 11:48:02 +02:00
Mohsen Azimi 77afc92c5f
Remove extra argument sent to HarmonyExportExpressionDependencyConcatenatedTemplate 2018-03-28 22:06:44 -07:00
Florent Cailhol f1092ad516 Update prettier toolchain 2018-03-26 16:56:10 +02:00
Florent Cailhol 3983803d30 Destructure 'require' to improve readability 2018-03-22 12:05:58 +01:00
Tobias Koppers 800e7f967b fix #6688 2018-03-06 15:03:33 +01:00
Tobias Koppers 5238159d21 run prettier on existing code 2018-02-25 02:00:20 +01:00
Florent Cailhol 40ee8c76d2 Use MD4 for hashing 2018-02-22 11:27:11 +01:00
Tobias Koppers edd8daf1d7 Merge branch 'master' into next
# Conflicts:
#	lib/optimize/ConcatenatedModule.js
#	package.json
#	yarn.lock
2018-02-09 17:04:33 +01:00
Florent Cailhol 63b4523a15 Pass 'context' as constructor argument 2018-01-30 21:40:44 +01:00
Olivier Combe 2aebfbe48c fix(ConcatenatedModule): don't throw on arrays with empty values
Fixes #6407
Fixes #5415
Ref https://github.com/angular/angular/issues/21809
2018-01-29 15:52:01 +01:00
Tobias Koppers 7a1b357aad
Merge branch 'next' into for_of_loops 2018-01-24 09:01:31 +01:00
Florent Cailhol d4811b0d37 Use for-of loops instead of forEach 2018-01-23 22:53:18 +01:00
Florent Cailhol 7f303e5260 Use Buffer.from instead of new Buffer 2018-01-22 17:23:34 +01:00
Florent Cailhol 86e6edf1ab Refactor how source type is handled by the parser 2018-01-22 09:30:43 +01:00
Tobias Koppers 87fdb61c0a better names for interop properties 2018-01-05 22:35:54 +01:00
Tobias Koppers bde926605c fix a bug with json modules in concatenated modules 2018-01-05 22:27:42 +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 ba00d7495a fix unnecessary module concatenation
allow to display nested modules in stats
2017-12-20 20:35:16 +01:00
Tobias Koppers cc63d51f6a shorter code in concatenated module 2017-12-13 11:17:39 +01:00
Tobias Koppers c68f224272 move providedExports into buildMeta 2017-12-12 17:01:03 +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 aa212a61d0 Merge branch 'master' into next
# Conflicts:
#	lib/optimize/ConcatenatedModule.js
2017-11-24 22:07:20 +01:00
Tobias Koppers c772e51f2d
Merge branch 'next' into eslint-scope 2017-11-24 07:58:23 +01:00
Tobias Koppers 9c25669e47
Merge pull request #6012 from webpack/feature/mjs-import-non-esm
process imports from mjs to non-esm correctly
2017-11-24 07:36:28 +01:00
wtgtybhertgeghgtwtg fe46ac1356 Switch from `escope` to `eslint-scope`. 2017-11-23 16:47:01 -07:00
Joe Lencioni 37d70bd0c6 Avoid calling hash.update multiple times in ConcatenatedModules
@sokra did some profiling and it seems that calling crypto.update
multiple times is slower than calling it once with a large string.

> As explanation I would guess update calls into node.js C++ + OpenSSL
> while concatenating strings is very optimized in JIT.

To take better advantage of this information, I have rewritten this
performance-sensitive code to build up a concatenated string and then
hash it at the end.

Since we are thinking about performance here, I opted for a regular for
loop instead of using the forEach iterator. I also did some basic
benchmarking of string concatenation strategies and discovered that
separating out the addition of the extra space into its own
concatenation line instead of tacking it on to the end of a single
concatenation might just barely have the edge in terms of performance. I
think it is also very readable this way, so it seems like a good
tradeoff to make: a little lost conciseness for speed.
2017-11-23 08:31:16 -08:00