Commit Graph

184 Commits

Author SHA1 Message Date
alexander.akait 7b4775cebe fix(types): fix some types 2024-03-21 15:16:51 +03:00
alexander.akait be1d35eb02 fix(types): more 2024-03-18 18:50:56 +03:00
alexander.akait 9ed9d06c05 test: more 2024-03-15 19:59:30 +03:00
alexander.akait c80a7f2e16 refactor: code use attributes instead assertions 2024-03-15 18:11:02 +03:00
alexander.akait d6e98945c9 fix(js): import assertions 2024-03-15 17:24:33 +03:00
alexander.akait b2252fa5b1 fix(css): output layer/supports/media for CSS external imports 2024-03-15 15:15:53 +03:00
alexander.akait 9f63f7013a refactor: more types 2024-02-16 20:39:12 +03:00
ahabhgk ecd16a35ad lint 2024-01-16 10:31:20 +08:00
ahabhgk b19c422925 fix: add warning for async external 2024-01-16 10:25:30 +08:00
Nitin Kumar 412ae5425e chore: udpate prettier to v3 2024-01-14 07:11:34 +05:30
versole ca4f3235ba fix: external module hard code arrow function 2024-01-02 11:27:18 +08:00
alexander.akait 4809421990 refactor(types): more 2023-06-21 19:00:24 +03:00
alexander.akait ac2c8bec53 refactor: avoid using only runtime 2023-06-03 03:58:03 +03:00
alexander.akait 44ded0ab51 refactor: some code 2023-06-03 03:21:47 +03:00
alexander.akait b18e4e822d fix: respect `importMetaName` 2023-06-03 02:58:12 +03:00
alexander.akait e3b1837442 fix: compatibility `__non_webpack_require__` with ES modules 2023-06-03 02:13:44 +03:00
alexander.akait 02590bfdc7 chore: improve types 2023-04-21 19:22:33 +03:00
Sean Larkin fa4cbf11a1 add more module type constants, use them across codebase 2023-03-31 10:56:32 -07:00
Asriel Yu 96da766002
Merge branch 'webpack:main' into fix-callback-err-type-should-include-null 2022-01-14 20:07:21 +08:00
Tobias Koppers 2f2991a967 Merge branch 'main' into support-cjs-static-named-exports 2022-01-10 14:38:57 +01:00
Tobias Koppers 102014bf54 fix target expression
fix externals

add test case
2022-01-10 14:33:34 +01:00
Asriel Yu 136b723023 fix callback err type should include null 2021-12-24 20:27:31 +08:00
Tobias Koppers f37ce4e741 avoid hoisting css externals 2021-12-17 18:24:41 +01:00
Tobias Koppers b9c6691ff5 bugfixes, external assets 2021-12-03 16:23:09 +01:00
Tobias Koppers 3c9801a549 add support for external css 2021-12-03 08:47:21 +01:00
Ivan Kopeykin edeaa6eb82 use "safe" global object 2021-11-23 20:40:03 +03:00
Tobias Koppers 1ad5234555
Merge pull request #14381 from webpack/cache/externals 2021-10-04 09:56:21 +02:00
Tobias Koppers 7135727cba avoid unneccessary separators and arrays 2021-10-04 09:29:09 +02:00
Tobias Koppers a0a5f28510 allow ExternalModules to be unsafe cached 2021-10-01 16:27:20 +02:00
shfshanyue 92f84dcac0 chore: merge multi hash.update 2021-09-26 08:51:53 +08:00
Tobias Koppers 4a8bf4c084 allow to configure all hash functions used
fix default hash function for HttpUriPlugin to sha512
2021-09-23 14:55:13 +02:00
Tobias Koppers 4e8a621bfa fix null module externals 2021-09-03 13:47:09 +02:00
Tobias Koppers 3f7d80d823 fix concatenation of module externals
#2933
2021-07-06 14:07:45 +02:00
Tobias Koppers 7f35d28bb8 fix #13667 2021-07-02 06:53:30 +02:00
Tobias Koppers a1f0d23dcc add `node-commonjs` external type to use `createRequire` for commonjs externals
for `module` externals, fallback to `import()` when not in module mode
2021-06-25 11:22:55 +02:00
Tobias Koppers 629f9f031c add support for module externals and automatic externals 2021-06-24 16:44:14 +02:00
Tobias Koppers 15408018cb partially fix test cases 2021-06-24 10:05:37 +02:00
Tobias Koppers 9f3950e571 add support for libraries combined with iife: false
fix missing runtime requirement for system.js context
fix inlining of modules when conflicting symbols are defined on top-level
2021-02-11 11:19:24 +01:00
Tobias Koppers 11a7cac537 add useSimpleSourceMap flag to enable/disable OriginalSource for generated code
pass reduced options object to Source.map() function
2020-10-26 16:33:38 +01:00
Tobias Koppers 7e88ff6b6c keep iife flag for backward-compat 2020-10-20 17:38:29 +02:00
Jarda Snajdr 18c369bdfd Make external modules of type 'this' work with module concatenation
Changes how the object lookup is wrapped in an IIFE to avoid hiding the
left side of the assignment inside a function.

Forces the external module of type `this` to be in non-strict mode --
that's the only mode where the `this` lookup has any meaningful behavior.

Fixes #11724.
2020-10-17 20:27:40 +02:00
Tobias Koppers 9af66ff9af revert to registering the namespace export because we need to know this early 2020-09-15 12:36:16 +02:00
Tobias Koppers 39e1a7e4c7 move magic names to constants in ConcatenationScope
improve types
2020-09-15 12:36:06 +02:00
Tobias Koppers 9af1d7526b refactor module concatenation to address discovered bugs/edge cases 2020-09-15 12:36:02 +02:00
Tobias Koppers 2c00413b26 rename supportsAsyncImport -> supportsDynamicImport 2020-09-11 23:13:10 +02:00
Tobias Koppers f73778fc36 avoid check for import() in environment when import has been polyfilled 2020-09-11 23:11:04 +02:00
Tobias Koppers 48010fb955 replace output.ecmaVersion with output.environment and more detailed flags 2020-09-10 11:12:28 +02:00
chenxsan 2865155a67 fix lint 2020-08-11 20:51:44 +08:00
chenxsan 94e47d5721 fix ExternalModule bug 2020-08-11 20:42:32 +08: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 5068909499 Avoid tracking/printing detailed usage info for modules without exportsType
Make ContextModule a static default exporting module
fix provided exports info for ExternalModule
2020-07-08 11:07:03 +02:00
Tobias Koppers 3df380e2d7 add script external
change defaults of ModuleFederationPlugin to var library and script remoteType
allow using empty entry in config
2020-06-04 03:18:07 +02:00
Tobias Koppers a66290a15f add support for async externals
add `promise` external
add `import` external (uses import())

add `output.importFunctionName` option to change the `import()` function name

allow for inline external type when using arrays

fix some typings

fix namespace object behavior when using system external and accessing nested property
fix interop behavior for async dynamic modules
2020-05-19 17:25:43 +02:00
Tobias Koppers 952bc11510 fixes typing in ModuleGraph 2020-05-12 14:34:26 +02:00
Mohsen Azimi 1e0ad4ccd2 Upgrade to TypeScript 3.9 2020-05-12 14:34:24 +02:00
Tobias Koppers b4993f1ccc
Merge pull request #10503 from joeldenning/system-esmodule
Fix externals interop within SystemLibraryPlugin.
2020-03-10 15:38:38 +01:00
Nitin Kumar 285529a643
chore: fix typos across the project 2020-03-10 07:29:46 +05:30
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 f1dd328779 refactor library system 2020-02-26 17:35:52 +01:00
Tobias Koppers e5b51235d7 add externalsType option
fix a few edge cases in ExternalModule
2020-02-26 17:22:42 +01:00
Tobias Koppers 6477ca56f8 Split options defaulting in normalization and defaults
Apply defaults after plugins are applied to allow plugins to feature their own defaults.
This allows to make preset plugins.
2020-02-17 19:12:54 +01:00
Tobias Koppers 522d80f33b allocate less for empty Sets for runtime requirements and file/context/missingDependencies 2020-01-29 21:46:14 +01:00
Tobias Koppers b90f3e14a1 upgrade webpack-sources
make source maps and source names context independent

add enhanced-resolve declarations
add types to Module.build
fix tooling for import order to support import renaming
add support for concatenated modules in eval source maps
2019-11-12 08:59:08 +01:00
Tobias Koppers ddc3dae0e6 refactor Module.source() and Module.getRuntimeRequirements() into Module.codeGeneration
add code generation phase to Compilation
add `output.iife` options to remove iife wrapper
add `experiments.outputModule` which enabled `output.module`
add `output.module` which sets defaults to `output.iife: false`, `output.libraryTarget: "module"`, `output.jsonpScriptType: "module"`, `terserOptions.module: true`
add `output.module` example
improve runtime requirements needed by ConcatenatedModule
add entry inlining, which inlines entry module code into runtime scope (only when safe)
make whole bundle strict when all modules are strict
2019-10-08 23:59:48 +02:00
Tobias Koppers b80174a069 Improve backward-compat for various things
to enable mini-css-extract-plugin
2019-09-26 22:06:54 +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 0505e177f1 add more types and fix/remove TODOs
change Chunk.files to Set
remove checkContext from IgnorePlugin
remove external flag from ExternalModule
2019-06-14 10:45:56 +02:00
Tobias Koppers 0c39719729 avoid zero sized modules as they lead to problems 2019-05-13 12:29:29 +02:00
Tobias Koppers b66143f706 Merge tag 'v4.30.0' into next
4.30.0
2019-05-09 21:34:28 +02:00
Joel Denning 97d58d31c0 Adding support for output libraryTarget 'system'. Resolves #8833.
Tests, prettier

Self review

Add comments to System tests.

Adding typescript definition

Guy Bedford's feedback

Self review

Improving code coverage
2019-03-17 08:46:17 -07:00
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 318da93ce2 make Raw and ExternalModule serializable 2018-10-18 16:02:45 +02:00
Tobias Koppers 518104b3fb Merge tag 'v4.21.0' into next
4.21.0
2018-10-17 20:38:00 +02:00
Tobias Koppers 7bc5c98171 Merge branch 'master' into marcusdarmstrong-external-module-fix 2018-10-17 16:13:55 +02:00
Tobias Koppers 4eab41bd5f refactor Module.needBuild to be async 2018-09-27 11:20:54 +02:00
Eemeli Aro b624d167a5 Add "amd-require" libraryTarget, resulting in a require() wrapper 2018-09-26 21:46:16 +03:00
Tobias Koppers 19d60ba0cd Merge tag 'v4.19.1' into next
4.19.1
2018-09-18 10:13:54 +02:00
Tobias Koppers f0271d93c6 fix ExternalModule and test case 2018-09-18 09:10:14 +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 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 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 6d5310fbd6 allow multiple entryModules per chunk
allow to specify ChunkGroup to depend on
move entry modules into ChunkGraph
2018-08-15 11:51:16 +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 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
Florent Cailhol 367b02a0f0 Use RuntimeTemplate to generate error code 2018-07-31 09:01:06 +02:00
Tobias Koppers cf5f1d723c format existing code 2018-07-30 21:29:21 +02:00
Tobias Koppers 22c4756c9e add more types to Module 2018-07-25 12:38:34 +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 8614c75f11 run inherit types tool on existing code 2018-07-21 13:50:18 +02:00
Marcus Armstrong 058a5f4659
Correct ExternalModule's global option (#6933) 2018-04-13 16:40:16 -04: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 5238159d21 run prettier on existing code 2018-02-25 02:00:20 +01:00
Florent Cailhol 63b4523a15 Pass 'context' as constructor argument 2018-01-30 21:40:44 +01:00
Tobias Koppers d95f93f8cb add output.globalObject configuration option
remove deprecated atom and electron target
add self libraryTarget
add self external type
2017-12-27 18:46:37 +01:00