Commit Graph

104 Commits

Author SHA1 Message Date
Tobias Koppers 66d3f319a6 Merge tag 'v4.16.2' into next
4.16.2
2018-07-23 12:19:16 +02:00
Abdulrahman Alkhelaifi 80c3e433c4 Handle module.require, require.main.require, and module.parent.require
- Resolve module.require dependencies

- Add require.main.require and module.parent.require as unsupported
2018-07-19 13:41:58 -07:00
Florent Cailhol 5bc6b8d50e Rename ParserHelpers into JavascriptParserHelpers 2018-07-03 14:08:43 +02:00
Florent Cailhol 6097c5f993 Destructure parser helpers 2018-07-03 14:08:43 +02:00
Florent Cailhol 2a9452e51b Add brackets for multiline if/for statements 2018-05-29 15:45:44 +02:00
Tobias Koppers 5238159d21 run prettier on existing code 2018-02-25 02:00:20 +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
Florent Cailhol 9669c9e013 Use Parser#hooks instead of Tapable#plugin 2017-12-21 09:08:10 +01:00
Florent Cailhol 31e0c406b7 Bail out concatenation if module uses module.id or module.loaded 2017-12-19 10:08:43 +01:00
Florent Cailhol c8e60b4322 Update Parser helpers to be compatible with hooks 2017-12-15 17:08:49 +01:00
Florent Cailhol 08ddad2e10 Replace NormalModuleFactory#plugin() calls 2017-12-14 14:42:49 +01:00
Tobias Koppers 30c9dd05b0 remove `__webpack_require__` requirement from some ConstDependencies
fixes #5707
2017-12-13 11:14:00 +01:00
Tobias Koppers ffb977fed4 refactor meta -> buildMeta, add factoryMeta
add compat layer to Module.meta
2017-12-12 16:57:50 +01:00
Florent Cailhol 36c690d37f Use tapable instead of 'plugin' 2017-12-08 14:23:31 +01: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 f7c2f8e470 Update code style to arrow functions 2017-11-08 11:56:01 +01:00
Tobias Koppers 27cc834a49 evaluate some identifiers to truthy values
fixes #4596
2017-06-02 13:24:47 +02:00
SendilKumar N 0d31e0b801 Refactor(ES6): NodeStuffPlugin 2017-04-04 10:12:52 +02:00
Tim Sebastian 82eec175af convert more usages of BasicEvaluatedExpression with ParserHelpers 2017-01-21 13:51:35 +11:00
Tim Sebastian 965b7261fa move more ConstDependencies to `toConstantDependency` 2017-01-21 13:51:35 +11:00
Tim Sebastian afac22f058 introduce ParserHelper.evaluateToBoolean
convert all usages of new BasicEvaluatedExpression().setBoolean to ParserHelper.evaluateToBoolean
2017-01-21 13:41:19 +11:00
Tobias Koppers a7a41848c7 remove error for CommonJs/AMD in ESM
there are too many weird modules

detect harmony modules before parsing
exports is now undefined in ESM
module.exports is now read-only in ESM and returns undefined
define is now undefined in ESM
#3917
2017-01-15 01:44:26 +01:00
timse 86c00207bd Extract to parser helpers (#3843)
* rename ModuleParserHelpers to ParserHelpers

- rename module and file from ModuleParserHelpers to ParserHelpers
- change imports and usages
- rename addParsedVariable to addParsedVariableToModule to add module context again

* introduce setTypeof helper to ParserHelpers

* switch setTypeof in amdplugin - use ParsersHelpers instead

* switch setTypeof in CommonJsPlugin - use ParsersHelpers instead

* switch setTypeof in SystemPlugin - use ParsersHelpers instead

* add ParserHelpers.expressionIsUnsupported method

* use ParserHelpers.expressionIsUnsupported in SystemPlugin and NodeStuffPlugin

* refactor setTypeOf to more atomic helper methods

- reduces sideeffects as parser is called outside of helper
- allows better reuse

* use ParserHelper on more pieces in CommonJsPlugin making BasicEvaluatedExpression obsolete

* switch new BasicEvaluatedExpression().setString(<somestring>).setRange(expr.range) in dependencies to ParserHelpers

* switch other new BasicEvaluatedExpression().setString(<somestring>).setRange(expr.range) to ParserHelpers

* rename wrongly named function - name anonymous functions
2017-01-08 12:11:26 -06:00
Joe Bateson a8bb6cdb1c refactor(es6): Replace object-assign polyfill with native method (#3608) 2016-12-28 13:07:28 -06:00
Markus Kramer 9c5c6df64f replaced calls to Object.assign with objectAssign to support node 0.12.x (#3080) 2016-09-30 09:24:05 -05:00
Tobias Koppers ec262a4007 refactoring: moved parser instancation into NormalModuleFactory
breaking change: compiler.parser must no longer be used. Use this instead:

``` js
compiler.plugin("compilation", function(compilation, params) {
  params.normalModuleFactory.plugin("parser", function(parser, parserOptions) {
    parser.plugin(/* ... */);
  });
});
```

required for #2978
2016-09-15 00:22:10 +02:00
Tobias Koppers ce642eced6 reverted module.e to module.exports
because it causes issues with modules that define
exports on the module object
2016-04-21 23:50:40 +02:00
Tobias Koppers 902220a0ea smaller bundles by using module.e instead of module.exports
same for module.loaded and module.id
2016-02-13 13:11:34 +01:00
Tobias Koppers 1c961afe7b fixed small issues with new loader-runner 2015-12-30 16:39:10 +01:00
Tobias Koppers 805f558cc6 Merge branch 'webpack-1'
Conflicts:
	package.json
2015-11-24 08:28:39 +01:00
曹柯 f770eaebda change space to tab 2015-11-21 01:10:39 +08:00
曹柯 4fe6145f8c fix windows cross driver path not found issue 2015-11-21 01:07:43 +08:00
Tobias Koppers 3201dc333d Merge branch 'webpack-1'
Conflicts:
	lib/NormalModuleFactory.js
	package.json
2015-11-13 21:58:38 +01:00
Tobias Koppers 8d10b228a0 force relative path for "module" require
fixes #1596
2015-11-10 21:26:47 +01:00
Tobias Koppers 72e8dd0147 Merge pull request #861 from webpack/webpack-2
Webpack 2
2015-11-06 01:12:38 +01:00
WuCY 83143d69ca Null case 2015-10-05 23:32:20 -07:00
WuCY 7eb3555844 Fix the absolute path used in NodeStuffPlugin 2015-08-08 15:32:33 -07:00
Tobias Koppers 431a4c791c Merge branch 'master' into webpack-2
Conflicts:
	hot/dev-server.js
	hot/only-dev-server.js
	hot/poll.js
	hot/signal.js
	lib/ChunkTemplate.js
	lib/HotModuleReplacement.runtime.js
	lib/HotModuleReplacementPlugin.js
	lib/JsonpMainTemplatePlugin.js
	lib/MainTemplate.js
	lib/NormalModule.js
	lib/Parser.js
	lib/RecordIdsPlugin.js
	lib/WebpackOptionsApply.js
	lib/dependencies/RequireEnsureDependency.js
	lib/node/OldNodeWatchFileSystem.js
	lib/optimize/OccurrenceOrderPlugin.js
	package.json
2015-07-17 09:30:37 +02:00
Tobias Koppers f7d799adb4 rebeautify without spacing after keyword 2015-07-16 00:19:23 +02:00
Avi Haiat 0a340f2b1a feat(app): Beautify all lib files 2015-07-13 01:20:09 +03:00
Avi Haiat daff7440a6 feat(app): Fix some obvious lint errors and warnings 2015-07-08 15:52:41 +03:00
Tobias Koppers 2245c4acca Promise based chunk loading API
don't flag entry module with `0` id anymore
use extra argument in chunk instead
this allows to require entry points
2015-06-13 11:45:28 +02:00
Tobias Koppers cebd3b9722 added linting 2015-04-23 23:55:50 +02:00
Taylor Brown d661eb199d Fix: setConstant and setModuleConstant now function correctly again.
Previously, __filename, __dirname, and other constants were broken. This was due to
the refactor of setConstant and setModuleConstant, and the reuse of the variable name "expr"
2014-07-04 12:13:44 +02:00
Tobias Koppers d80cdcefac Code Quality 2014-06-24 18:53:32 +02:00
Tobias Koppers a70f91499a Allow mixing different webpack versions 2014-06-18 10:59:54 +02:00
Tobias Koppers a134fae430 require.extension should translate to undefined
fixes #209
2014-03-19 23:27:18 +01:00
Tobias Koppers 0fea43b4cb rename generated require to __webpack_require__
fixes #141
fixes RubenVerborgh/N3.js#18
2014-03-03 14:56:17 +01:00
Tobias Koppers 3170b76b22 webpack 1.0 beta
moved many options to plugins
#113
2013-12-17 23:21:49 +01:00
Tobias Koppers 392c6db063 more useful error when using require.extensions #104 2013-10-11 10:42:25 +02:00
Tobias Koppers 55149353d4 fixed little bug 2013-05-14 13:55:06 +02:00
Tobias Koppers c4140aac51 moved ConsolePlugin into NodeSourcePlugin 2013-02-26 13:31:05 +01:00
Tobias Koppers 2183f05db8 added __resourceQuery, __dir/__filename compile time constant 2013-02-16 22:23:22 +01:00
Tobias Koppers 3dc62749a2 moved webworker template, added node.js template #57 2013-02-13 17:00:07 +01:00