Commit Graph

175 Commits

Author SHA1 Message Date
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
Joe Lencioni 8fdf411b84 Simplify identifier creation in ConcatenatedModules
This was implemented in #5997 to fix some memory issues, but I think we
can make this a little more efficient. By using a single forEach instead
of a map, filter, and join, we avoid unnecessary array creations and
iterations.
2017-11-23 07:47:18 -08: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 a0ef93f939 aggregate all crypto hash usages into util/createHash
try to avoid calling hash.update with short strings
2017-11-23 11:09:17 +01:00
Tobias Koppers f55547ca6a Merge branch 'master' into next
# Conflicts:
#	lib/Compiler.js
2017-11-23 09:14:58 +01:00
Filipe Silva aef6f19a60 Use shorter identifier for ConcatenatedModules
See https://github.com/webpack/webpack/issues/5992#issuecomment-346384896 for rationale.

Fixes #5992
2017-11-22 16:33:36 +00:00
Tobias Koppers 00f2b5ede7 advanced module type refactoring
added json type
.mjs default to javascript/esm type
adjusted parser plugins to react on module type
2017-11-11 19:27:19 +01:00
Tobias Koppers 41a1d602e1 added WebAssembly Proof of Concept 2017-11-10 09:17:11 +01:00
Tobias Koppers 860da9baaa
Merge branch 'next' into refactor/sets 2017-11-08 21:28:51 +01:00
Tobias Koppers f7c2f8e470 Update code style to arrow functions 2017-11-08 11:56:01 +01:00
Tobias Koppers 447d85ad79 Merge branch 'next' into refactor/sets
# Conflicts:
#	lib/ContextModule.js
#	lib/NormalModule.js
#	lib/optimize/ConcatenatedModule.js
2017-11-08 06:01:24 +01:00
Tobias Koppers 51c572c4f5 refactor more properties to Sets 2017-11-07 09:17:12 +01:00
Tobias Koppers 0339d4da49 Refactor weird things
* Declare used properties in constructor
* Module.(re)building moved into Compilation._(re)buildingModules (Map)
* Make NormalModule.error private
* Move Module.cacheable logic into needRebuild
* More stable implemention of rebuildModule
* addModuleChain waits for Module building finished before returning
* Set built and cacheable flags correctly in Modules
* More portableId into WeakMap
* Add ModuleReason for entrypoints
* cacheable can be true/false/null in Stats
* added Stats module issuerPath
* fixes profile in stats output
2017-11-06 13:16:09 +01:00
Tobias Koppers 4c2f9e724b Merge branch 'master' into next
# Conflicts:
#	lib/dependencies/HarmonyExportImportedSpecifierDependency.js
2017-10-12 11:28:25 +02:00
Tobias Koppers 1381f6745b fix crashes when imported module fails compiling 2017-10-11 17:22:11 +02:00
Tobias Koppers 5a814c09d3 Merge branch 'master' into next
# Conflicts:
#	lib/FunctionModuleTemplatePlugin.js
#	lib/dependencies/HarmonyExportDependencyParserPlugin.js
#	lib/dependencies/HarmonyExportImportedSpecifierDependency.js
#	lib/dependencies/HarmonyModulesHelpers.js
#	lib/optimize/ConcatenatedModule.js
#	test/HarmonyModulesHelpers.test.js
2017-10-09 21:13:18 +02:00
Tobias Koppers 9357ae0254 Refactor precendence rules for harmony exports for better performance
fixes #5763
2017-10-09 15:28:59 +02: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 f83c913e53 Merge branch 'master' into refactor/cleanups 2017-09-06 09:39:28 +02:00
Tobias Koppers af470a504e handle inner non-harmony dependencies correctly in ConcatenatedModule
add async as keyword

fixes #5604
fixes #5615
2017-09-04 14:09:55 +02:00
Tobias Koppers c5deb595c5 set compatiblity flag correctly even after incremental build
fixes #5510
2017-08-16 14:59:09 +02:00
Tobias Koppers e5f4eb147a Merge branch 'master' into refactor/cleanups 2017-08-12 10:03:51 +02:00
kisenka 3d272aceea fix: restore `modules` property of ConcatenatedModule (fixes #5477) 2017-08-12 01:01:50 +03:00
kisenka 7a36951aa8 Merge branch 'master' of https://github.com/webpack/webpack into concatenated-module-in-3.5-compat 2017-08-12 00:58:43 +03:00
Tobias Koppers 0e73a2458a also generate a new identifier for interop name
fixes #5481
2017-08-10 12:14:31 +02:00
kisenka 438fd14ae5 fix: restore backwards compatibility of ConcatenatedModule (fixes #5477) 2017-08-10 00:23:40 +03:00
Tobias Koppers bc67522c74 fixes stack overflow with circular dependencies
fixes #5462
2017-08-09 10:31:01 +02:00
Tobias Koppers b05b49b0f0 fix invalid generated code with scope hoisting and non-number ids 2017-08-08 13:09:47 +02:00
Tobias Koppers 91bfd4559a move pathinfo comment into Template helper function
change toIdentifier to generate less underscores
2017-08-08 09:42:43 +02:00
Tobias Koppers 7619c43d26 generate more pretty names for nested concatenation 2017-08-07 21:21:53 +02:00
Tobias Koppers 9f5bffaa61 beautify 2017-08-07 16:15:49 +02:00
Tobias Koppers 334c1c49aa remove unused variable 2017-08-07 16:05:17 +02:00
Tobias Koppers 8835751cb3 fix conflict handling
remove unused code
2017-08-07 15:43:17 +02:00
Tobias Koppers b77a52b43a add reserved words to avoid syntax errors 2017-08-07 14:47:45 +02:00
Tobias Koppers 16a5831620 use old new Buffer api for node 4 2017-08-07 14:39:07 +02:00
Tobias Koppers 2be9c526e4 better names, added export comment 2017-08-07 14:38:54 +02:00
Tobias Koppers a553c3d15d tests and fixes 2017-08-07 14:12:31 +02:00
Tobias Koppers 795f6fcbba fix remaining issues and edge cases 2017-08-07 13:56:50 +02:00
Tobias Koppers abff6b7805 use all imports in a concatenated module 2017-08-07 13:19:24 +02:00
Tobias Koppers ec3aa7be5d Fix import order 2017-08-07 11:53:07 +02:00
Tobias Koppers a167a7ecf5 allow to use default export of root module in concatenated module in inner modules
better error messages when parsing fails

fixes #5314
#5304
2017-07-21 23:32:47 +02:00
Tobias Koppers c1a02446ac store hash in depndencyTemplates Map instead of comparing identify
This restores original performance on incremental builds

fixes #5289
fixes #5277
2017-07-14 13:03:30 +02:00
Tobias Koppers 6842d50cf9 Call imports with the correct context.
Parse arguments of an import call.
Support strictThisContextOnImports in ConcatenatedModules

fixes #5246
fixes #5135
fixes #5111
2017-07-11 19:08:23 +02:00
Tobias Koppers 4e90f43596 add hash method to concatenated module
fixes #5184
2017-07-07 11:48:52 +02:00
Tobias Koppers a6e4cddb79 Merge pull request #5137 from mzgoddard/concatenated-file-dependencies
Include module file and context dependencies in ConcatenatedModule
2017-07-01 14:51:07 +02:00
Michael "Z" Goddard 9ea40f0eea
Include module file and context dependencies in ConcatenatedModule
As ModuleConcatenationPlugin removes the concatenated modules from a
compilation, the file and context dependencies of those modules needs
to be stored in the ConcatenatedModule for webpack to be able to watch
those paths.
2017-06-22 10:43:28 -04:00
jeonghwan Lee ab9e938367 Preserve assets from concatenated module 2017-06-22 12:32:59 +09:00
Tobias Koppers 2d82b00767 Merge pull request #5113 from webpack/feature/better-error-message
better error message for missing internal names
2017-06-21 23:23:25 +02:00
Tobias Koppers 25a904bf88 Merge pull request #5083 from timse/sortable-set
Sortable set
2017-06-21 22:50:47 +02:00
Tim Sebastian 8f3d65aa5d fix linting/formatting issues 2017-06-21 08:12:22 +10:00
Tim Sebastian f7ffed8f3e allow to set chunks and use it in ConcatenatedModule 2017-06-21 08:12:22 +10:00
Tobias Koppers 245dcc3047 better error message for missing internal names 2017-06-20 16:13:32 +02:00
Tim Sebastian fc20348f97 unite iteration through modules into one loop 2017-06-18 22:46:06 +10:00
Tim Sebastian 083843e0ad remove code that pushes arrays of dependencies into dependencies
the actua dep population is done in lines 155-159
2017-06-18 22:45:08 +10:00
Tim Sebastian bd8c6cf158 make sure ConcatenatedModules also uses SortedSet
fix tests that was falsy - per default chunks are flagged as sorted in module
however this only holds true as they are initialized empty. Concatenated module however
has initial modules and therefore is not guaranteed to be ordered, the flags should therfor be false.
Using SortedSet fixes this as a sideeffect
2017-06-18 14:34:32 +10:00
Tobias Koppers ec966354ca rename shorthand properties correctly
fixes #5027
2017-06-13 13:38:12 +02:00
Tobias Koppers 8c7808991c fix lint error 2017-06-07 13:14:13 +02:00
Tobias Koppers 9060137035 generate nicer names 2017-06-07 12:57:15 +02:00
Tobias Koppers 9b58b7a705 generate correct namespace objects
fixes #5020
2017-06-07 12:56:53 +02:00
Tobias Koppers 1c538f9d84 fixes #5000 2017-06-06 11:18:34 +02:00
Tobias Koppers 4372819de1 libIdent should be rootModule 2017-06-05 14:01:19 +02:00
Tobias Koppers cc8e729ff4 detect conflicts with other variables
fixes #4967
2017-05-31 16:46:25 +02:00
Tobias Koppers 44bf6c245f update graph correctly 2017-05-28 17:18:41 +02:00
Tobias Koppers d8539561fd add optimization bailout info
track optimization bailout in concat plugin
2017-05-28 15:25:07 +02:00
Tobias Koppers 1c3bef901c merge PR #4884 again
by @filipesilva
2017-05-22 20:04:23 +02:00
Tobias Koppers 4a25a17bb6 improvements from review 2017-05-21 09:15:42 +02:00
Tobias Koppers c41ab084f6 fix export mangling in concatenated modules 2017-05-21 09:15:42 +02:00
Tobias Koppers 9b2a9fa786 Scope Hoisting 2017-05-21 09:15:41 +02:00