├── .github └── ISSUE_TEMPLATE.md ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── appveyor.yml ├── bin └── benchmark-append-serializer.js ├── commitlint.config.js ├── index.js ├── lib ├── CacheAsset.js ├── CacheEnhancedResolve.js ├── CacheMd5.js ├── CacheModule.js ├── CacheModuleResolver.js ├── CacheSerializerFactory.js ├── ChalkLoggerPlugin.js ├── ExcludeModulePlugin.js ├── ParallelLauncherPlugin.js ├── ParallelModulePlugin.js ├── SerializerAppend.js ├── SerializerAppend2.js ├── SerializerAppend2Plugin.js ├── SerializerAppendPlugin.js ├── SerializerCacache.js ├── SerializerCacachePlugin.js ├── SerializerFile.js ├── SerializerFilePlugin.js ├── SerializerJson.js ├── SerializerJsonPlugin.js ├── SerializerLeveldb.js ├── SerializerLeveldbPlugin.js ├── SupportExtractTextPlugin.js ├── SupportMiniCssExtractPlugin.js ├── SystemArchetype.js ├── SystemParity.js ├── SystemPruneCaches.js ├── TransformAssetPlugin.js ├── TransformBasicDependencyPlugin.js ├── TransformBasicDependencyPluginLegacy.js ├── TransformCompilationPlugin.js ├── TransformConcatenationModulePlugin.js ├── TransformDependencyBlockPlugin.js ├── TransformGeneratorPlugin.js ├── TransformModuleAssetsPlugin.js ├── TransformModuleErrorsPlugin.js ├── TransformNormalModuleFactoryPlugin.js ├── TransformNormalModulePlugin.js ├── TransformParserPlugin.js ├── TransformSourcePlugin.js ├── defaultConfigHash.js ├── envHash.js ├── loggerFactory.js ├── schema-4 │ ├── _generate.js │ ├── basic-dependency.json │ └── index.js └── util │ ├── Object.entries.js │ ├── Object.values.js │ ├── bulk-fs-task.js │ ├── index.js │ ├── log-messages.js │ ├── parity.js │ ├── plugin-compat.js │ ├── promisify.js │ ├── relate-context.js │ └── serial.js ├── package.json └── tests ├── base-webpack-1.js ├── base-webpack-2.js ├── base-webpack-3.js ├── base-webpack-4.js ├── fixtures ├── base-10deps-1nest │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-1dep-full-width │ ├── webpack.config.js │ ├── fib.js │ └── index.js ├── base-1dep-hash-filename │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-1dep-optional │ ├── index.js │ └── webpack.config.js ├── base-1dep-query │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-amd-1dep-local │ ├── index.js │ └── webpack.config.js ├── base-amd-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-amd-code-split │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-amd-context │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-change-1dep │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-change-context │ ├── a │ │ ├── 11.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-change-es2015-all-module │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-change-es2015-commonjs-module │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-change-es2015-default-module │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-change-es2015-export-module │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-change-es2015-export-order-module │ ├── a.js │ ├── index.js │ ├── obj.js │ ├── other.js │ └── webpack.config.js ├── base-change-es2015-module │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-change-es2015-rename-module │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-code-split-devtool-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-code-split-ensure │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-code-split-nest-devtool-source-map │ ├── fib.js │ ├── index.js │ ├── sq.js │ └── webpack.config.js ├── base-code-split-nest │ ├── fib.js │ ├── index.js │ ├── sq.js │ └── webpack.config.js ├── base-code-split-process │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-code-split │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-context-devtool-source-map │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-context-move │ ├── a.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ ├── web_modules │ │ └── a │ │ │ ├── 1.js │ │ │ ├── 2.js │ │ │ ├── 3.js │ │ │ ├── 4.js │ │ │ └── 5.js │ └── webpack.config.js ├── base-context-optional │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-context │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-deep-context-devtool-source-map │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ ├── b │ │ │ ├── 10.js │ │ │ ├── 11-2.js │ │ │ ├── 6.js │ │ │ ├── 7.js │ │ │ ├── 8.js │ │ │ └── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-deep-context │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ ├── b │ │ │ ├── 10.js │ │ │ ├── 11-2.js │ │ │ ├── 6.js │ │ │ ├── 7.js │ │ │ ├── 8.js │ │ │ └── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-cheap-eval-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-cheap-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-eval-source-map-hash-filename │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-eval-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-eval │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-inline-cheap-source-map-hash-filename │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-inline-cheap-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-nosources-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-source-map-hash-filename │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-devtool-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-error-resolve │ ├── index.js │ └── webpack.config.js ├── base-es2015-dynamic-context-import │ ├── fibs │ │ ├── fib.js │ │ └── obj.js │ ├── index.js │ └── webpack.config.js ├── base-es2015-dynamic-import │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-es2015-json │ ├── a.js │ ├── b.json │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-es2015-module-compatibility │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-es2015-module-export-before-import │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-es2015-module-export-star-alt │ ├── export.js │ ├── fab.js │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-es2015-module-export-star-some │ ├── export.js │ ├── fab.js │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-es2015-module-export-star │ ├── export.js │ ├── fab.js │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-es2015-module-use-before-import │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-es2015-module │ ├── a.js │ ├── b.js │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-es2015-rename-module │ ├── fact.js │ ├── fib.js │ ├── index.js │ ├── key.js │ ├── obj.js │ └── webpack.config.js ├── base-es2015-system-context │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-es2015-system-module │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-external │ ├── index.js │ └── webpack.config.js ├── base-move-10deps-1nest │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 6 │ │ │ └── index.js │ │ ├── 7 │ │ │ └── index.js │ │ ├── 10.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-move-1dep │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-move-context │ ├── a │ │ ├── 1 │ │ │ └── index.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-options-default │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-path-info │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-process-env │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-query-request │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-records-json │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-resolve-missing │ ├── fib.js │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── base-target-node-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-warning-context │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── base-warning-es2015 │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── base-wasm │ ├── index.js │ ├── wasm.wasm │ └── webpack.config.js ├── hard-source-confighash-dir │ ├── config-hash │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── hard-source-confighash │ ├── config-hash │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── hard-source-environmenthash │ ├── env-hash │ ├── fib │ │ └── index.js │ ├── hard-source-config.js │ ├── index.js │ ├── loader.js │ ├── vendor │ │ ├── lib1.js │ │ └── lib2.js │ └── webpack.config.js ├── hard-source-exclude-plugin │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── hard-source-md5 │ ├── config-hash │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── hard-source-packageyarnlock-hash │ ├── env-hash │ ├── fib │ │ └── index.js │ ├── hard-source-config.js │ ├── index.js │ ├── loader.js │ ├── package-lock.json │ ├── vendor │ │ ├── lib1.js │ │ └── lib2.js │ ├── webpack.config.js │ └── yarn.lock ├── hard-source-parallel-plugin-config-mismatch │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── hard-source-parallel-plugin-context │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── hard-source-parallel-plugin-defaults │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── hard-source-parallel-plugin │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── hard-source-prune │ ├── config-hash │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── loader-css │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── loader-custom-context-dep │ ├── dir │ │ ├── .gitkeep │ │ └── b │ ├── fib.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-deep-context-dep │ ├── dir │ │ ├── .gitkeep │ │ └── dirdir │ │ │ └── b │ ├── fib.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-function-option │ ├── fib.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-missing-dep-added │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-missing-dep │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-no-dep-moved │ ├── fib │ │ └── index.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-no-dep │ ├── fib.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-prepend-helper │ ├── image.png │ ├── index.js │ ├── loader-helper.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-resolve-missing-query │ ├── fib.js │ ├── fib │ │ └── index.js │ ├── index.js │ ├── loader │ │ └── index.js │ └── webpack.config.js ├── loader-custom-resolve-missing │ ├── fib.js │ ├── fib │ │ └── index.js │ ├── index.js │ ├── loader.js │ ├── loader │ │ └── index.js │ └── webpack.config.js ├── loader-custom-resolve-request-missing-change │ ├── fab.js │ ├── fib.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-resolve-request-missing │ ├── fib.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-resolve-request │ ├── fab │ │ └── index.js │ ├── fib.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-custom-user-loader │ ├── fib.js │ ├── index.js │ ├── loader.js │ └── webpack.config.js ├── loader-file-context │ ├── images │ │ └── image.png │ ├── index.js │ └── webpack.config.js ├── loader-file-move │ ├── image.png │ ├── index.js │ └── webpack.config.js ├── loader-file-options │ ├── image.png │ ├── index.js │ └── webpack.config.js ├── loader-file-use │ ├── src │ │ ├── image.png │ │ └── index.js │ └── webpack.config.js ├── loader-file │ ├── image.png │ ├── index.js │ └── webpack.config.js ├── loader-warning │ ├── index.js │ ├── loader.js │ ├── module.js │ └── webpack.config.js ├── loader-worker-1dep │ ├── fib.js │ ├── index.js │ ├── webpack.config.js │ └── worker.js ├── plugin-child-compiler-resolutions │ ├── child-compilation-plugin.js │ ├── fib.js │ ├── index.js │ ├── loader-a.js │ ├── loader-b.js │ └── webpack.config.js ├── plugin-concatenated-module-change │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── plugin-concatenated-module │ ├── a.js │ ├── b.js │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── plugin-copy │ ├── images │ │ └── image.png │ ├── index.js │ └── webpack.config.js ├── plugin-dll-reference-scope │ ├── dll-4.27.js │ ├── dll-manifest-4.27.json │ ├── dll-manifest.json │ ├── dll.js │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-dll-reference │ ├── dll-4.27.js │ ├── dll-manifest-4.27.json │ ├── dll-manifest.json │ ├── dll.js │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-dll │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-extract-text-html-uglify │ ├── index.css │ ├── index.html │ ├── index.js │ └── webpack.config.js ├── plugin-extract-text-loader-file │ ├── image.png │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-extract-text-throw-on-freeze │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-extract-text-uglify-eval-source-map │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-extract-text-uglify-source-map │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-extract-text-uglify │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-extract-text │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-hmr-accept-dep │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── plugin-hmr-accept │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── plugin-hmr-es2015 │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-hmr-process-env │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── plugin-hmr │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── plugin-html-lodash │ ├── fact.js │ ├── fib.js │ ├── index.html │ ├── index.js │ └── webpack.config.js ├── plugin-ignore-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-ignore-context-members │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── plugin-ignore-context │ ├── a │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── 4.js │ │ ├── 5.js │ │ └── index.js │ ├── b │ │ ├── 10.js │ │ ├── 6.js │ │ ├── 7.js │ │ ├── 8.js │ │ ├── 9.js │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── plugin-isomorphic-tools │ ├── image.png │ ├── index.css │ ├── index.js │ ├── webpack-isomorphic-tools.js │ └── webpack.config.js ├── plugin-logger-child-no-memory │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-mini-css-extract-change │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-mini-css-extract-file │ ├── image.png │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-mini-css-extract-watch │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-mini-css-extract │ ├── index.css │ ├── index.js │ └── webpack.config.js ├── plugin-prefetch-es2015 │ ├── a.js │ ├── b.js │ ├── fib.js │ ├── index.js │ ├── obj.js │ ├── unused.js │ └── webpack.config.js ├── plugin-serializer-json-base-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-side-effect-change │ ├── index.js │ ├── obj │ │ ├── fab.js │ │ ├── fib.js │ │ ├── key.js │ │ ├── obj.js │ │ └── package.json │ └── webpack.config.js ├── plugin-side-effect-settings │ ├── index.js │ ├── obj │ │ ├── fab.js │ │ ├── fib.js │ │ ├── key.js │ │ ├── obj.js │ │ └── package.json │ └── webpack.config.js ├── plugin-side-effect │ ├── index.js │ ├── obj │ │ ├── fab.js │ │ ├── fib.js │ │ ├── key.js │ │ ├── obj.js │ │ └── package.json │ └── webpack.config.js ├── plugin-source-map-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-uglify-1dep-es2015 │ ├── fib.js │ ├── index.js │ ├── obj.js │ └── webpack.config.js ├── plugin-uglify-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-uglify-babel-devtool-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── plugin-uglify-devtool-source-map │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── serializer-append-2-base-1dep-bad-cache │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── serializer-append-2-base-1dep-compact │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── serializer-append-2-base-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── serializer-append-base-1dep-compact │ ├── fib │ │ └── index.js │ ├── index.js │ └── webpack.config.js ├── serializer-append-base-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── serializer-cacache-base-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── serializer-json-base-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js └── serializer-leveldb-base-1dep │ ├── fib.js │ ├── index.js │ └── webpack.config.js ├── hard-source.js ├── loaders-webpack-1.js ├── loaders-webpack-2.js ├── loaders-webpack-3.js ├── plugins-webpack-1.js ├── plugins-webpack-2.js ├── plugins-webpack-3.js ├── plugins-webpack-4.js ├── serializers.js └── util ├── features.js ├── force-write-records.js ├── index.js └── webpack-if.js /.gitignore: -------------------------------------------------------------------------------- 1 | tests/fixtures/*/tmp 2 | node_modules -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | matrix: 4 | fast_finish: true 5 | allow_failures: 6 | - node_js: 4 7 | include: 8 | - node_js: node 9 | env: NPM_SCRIPT=lint 10 | - node_js: node 11 | env: NPM_SCRIPT=commitlint-travis 12 | - node_js: node 13 | env: NPM_SCRIPT=test NPM_INSTALL_EXTRA="webpack@4 file-loader@1 html-webpack-plugin@3.2.0" 14 | - node_js: 8 15 | env: NPM_SCRIPT=test NPM_INSTALL_EXTRA="webpack@3 file-loader@0.11 html-webpack-plugin@2.22.0" 16 | - node_js: 8 17 | env: NPM_SCRIPT=test NPM_INSTALL_EXTRA="webpack@4 file-loader@1 html-webpack-plugin@3.2.0" 18 | 19 | before_script: 20 | - npm install ${NPM_INSTALL_EXTRA} 21 | script: npm run ${NPM_SCRIPT} 22 | cache: 23 | directories: 24 | - node_modules 25 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = {extends: ['@commitlint/config-conventional']}; 2 | -------------------------------------------------------------------------------- /lib/ParallelLauncherPlugin.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/lib/ParallelLauncherPlugin.js -------------------------------------------------------------------------------- /lib/util/Object.entries.js: -------------------------------------------------------------------------------- 1 | module.exports = function Object_values(obj) { 2 | return Object.keys(obj).map(key => [key, obj[key]]); 3 | }; 4 | -------------------------------------------------------------------------------- /lib/util/Object.values.js: -------------------------------------------------------------------------------- 1 | module.exports = function Object_values(obj) { 2 | return Object.keys(obj).map(key => obj[key]); 3 | }; 4 | -------------------------------------------------------------------------------- /lib/util/promisify.js: -------------------------------------------------------------------------------- 1 | module.exports = function promisify(f, o) { 2 | const ctx = (o && o.context) || null; 3 | return function promisify_wrap() { 4 | const args = Array.from(arguments); 5 | return new Promise(function promisify_resolver(resolve, reject) { 6 | args.push(function promisify_callback(err, value) { 7 | if (err) { 8 | return reject(err); 9 | } 10 | return resolve(value); 11 | }); 12 | f.apply(ctx, args); 13 | }); 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/a/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./1') + 3 | require('./2') + 4 | require('./3') + 5 | require('./4') + 6 | require('./5'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-10deps-1nest/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-full-width/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-full-width/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-full-width/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-hash-filename/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-hash-filename/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-hash-filename/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: '[hash].js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-optional/index.js: -------------------------------------------------------------------------------- 1 | var fib; 2 | try { 3 | fib = require('./fib'); 4 | } 5 | catch (_) { 6 | fib = function(v) {return v;}; 7 | } 8 | 9 | console.log(fib(3)); 10 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-query/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-query/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib?http://localhost'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep-query/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-1dep-local/index.js: -------------------------------------------------------------------------------- 1 | define('./fib', function() { 2 | return function(n) { 3 | return n + (n > 0 ? n - 1 : 0); 4 | }; 5 | }); 6 | 7 | define(['./fib'], function(fib) { 8 | console.log(fib(3)); 9 | }); 10 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-1dep-local/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-1dep/fib.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return function(n) { 3 | return n + (n > 0 ? n - 1 : 0); 4 | }; 5 | }); 6 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-1dep/index.js: -------------------------------------------------------------------------------- 1 | define(['./fib'], function(fib) { 2 | console.log(fib(3)); 3 | }); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-code-split/fib.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return function(n) { 3 | return n + (n > 0 ? n - 1 : 0); 4 | }; 5 | }); 6 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-code-split/index.js: -------------------------------------------------------------------------------- 1 | require(['./fib'], function(fib) { 2 | console.log(fib(3)); 3 | }); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-code-split/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/a/index.js: -------------------------------------------------------------------------------- 1 | var a = '1'; 2 | var b = '2'; 3 | var c = '3'; 4 | var d = '4'; 5 | var e = '5'; 6 | 7 | define(['./' + a, './' + b, './' + c, './' + d, './' + e], function(a, b, c, d, e) { 8 | return (a + b + c + d + e); 9 | }); 10 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-amd-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-1dep/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/base-change-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/a/11.js: -------------------------------------------------------------------------------- 1 | module.exports = 11; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', false, /\d/); 2 | 3 | module.exports = context.keys() 4 | .reduce(function(carry, key) { 5 | return carry + context(key); 6 | }, 0); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-all-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-all-module/index.js: -------------------------------------------------------------------------------- 1 | import {key} from './obj'; 2 | export default key; -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-all-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-all-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-commonjs-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-commonjs-module/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./obj').fib; 2 | module.exports = fib(3); -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-commonjs-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-commonjs-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-default-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-default-module/index.js: -------------------------------------------------------------------------------- 1 | import {key} from './obj'; 2 | export default key; -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-default-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | export default { 5 | key, 6 | fib, 7 | }; 8 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-default-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-module/index.js: -------------------------------------------------------------------------------- 1 | import {key} from './obj'; 2 | export default key; -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | export let key = 'obj'; 3 | export {fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-order-module/a.js: -------------------------------------------------------------------------------- 1 | import {key, fib} from './obj'; 2 | export default [fib, key]; -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-order-module/index.js: -------------------------------------------------------------------------------- 1 | import a from './a'; 2 | import other from './other'; 3 | export default [a, other]; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-order-module/obj.js: -------------------------------------------------------------------------------- 1 | import './other'; 2 | export var key = 'obj'; 3 | export function fib(n) { 4 | return n + (n > 0 ? n - 1 : 0); 5 | } -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-order-module/other.js: -------------------------------------------------------------------------------- 1 | import {fib, key} from './obj'; 2 | export default [key, fib]; -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-export-order-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-module/index.js: -------------------------------------------------------------------------------- 1 | import {key} from './obj'; 2 | export default key; -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-rename-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-rename-module/index.js: -------------------------------------------------------------------------------- 1 | import {rekey as key} from './obj'; 2 | export default key; -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-rename-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key as rekey, fib as refib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-change-es2015-rename-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-devtool-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-devtool-source-map/index.js: -------------------------------------------------------------------------------- 1 | require([], function() { 2 | var fib = require('./fib'); 3 | 4 | console.log(fib(3)); 5 | }); 6 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-devtool-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | devtool: 'source-map', 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-ensure/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-ensure/index.js: -------------------------------------------------------------------------------- 1 | require.ensure([], function() { 2 | var fib = require('./fib'); 3 | 4 | console.log(fib(3)); 5 | }); 6 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-ensure/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-nest-devtool-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-nest-devtool-source-map/index.js: -------------------------------------------------------------------------------- 1 | require([], function() { 2 | var fib = require('./fib'); 3 | require([], function() { 4 | var sq = require('./sq'); 5 | 6 | console.log(fib(sq(3))); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-nest-devtool-source-map/sq.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n * n; 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-nest-devtool-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | devtool: 'source-map', 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-nest/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-nest/index.js: -------------------------------------------------------------------------------- 1 | require([], function() { 2 | var fib = require('./fib'); 3 | require([], function() { 4 | var sq = require('./sq'); 5 | 6 | console.log(fib(sq(3))); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-nest/sq.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n * n; 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-nest/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-process/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-process/index.js: -------------------------------------------------------------------------------- 1 | require([], function() { 2 | if (process.env.NODE_ENV !== 'production') { 3 | var fib = require('./fib'); 4 | 5 | console.log(fib(3)); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split-process/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split/index.js: -------------------------------------------------------------------------------- 1 | require([], function() { 2 | var fib = require('./fib'); 3 | 4 | console.log(fib(3)); 5 | }); 6 | -------------------------------------------------------------------------------- /tests/fixtures/base-code-split/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', false, /\d/); 2 | 3 | module.exports = 4 | context('./1') + 5 | context('./2') + 6 | context('./3') + 7 | context('./4') + 8 | context('./5'); 9 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-devtool-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | devtool: 'source-map', 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/a.js: -------------------------------------------------------------------------------- 1 | var context = require.context('a', true, /\d/); 2 | 3 | module.exports = 4 | context('./1') + 5 | context('./2') + 6 | context('./3') + 7 | context('./4') + 8 | context('./5'); -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/web_modules/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 11; -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/web_modules/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 12; -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/web_modules/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 13; -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/web_modules/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 14; -------------------------------------------------------------------------------- /tests/fixtures/base-context-move/web_modules/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 15; -------------------------------------------------------------------------------- /tests/fixtures/base-context-optional/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-optional/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-optional/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-optional/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-optional/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-optional/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-optional/index.js: -------------------------------------------------------------------------------- 1 | var a = 0; 2 | try { 3 | var context = require.context('./a'); 4 | context.keys().forEach(function(m) {a += context(m);}); 5 | } 6 | catch (_) {} 7 | 8 | console.log(a + require('./b')); 9 | -------------------------------------------------------------------------------- /tests/fixtures/base-context-optional/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', false, /\d/); 2 | 3 | module.exports = 4 | context('./1') + 5 | context('./2') + 6 | context('./3') + 7 | context('./4') + 8 | context('./5'); 9 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/b/11-2.js: -------------------------------------------------------------------------------- 1 | module.exports = 11; -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', true, /\d/); 2 | 3 | module.exports = 4 | context('./1') + 5 | context('./2') + 6 | context('./3') + 7 | context('./4') + 8 | context('./5') + 9 | context('./b/6') + 10 | context('./b/7') + 11 | context('./b/8') + 12 | context('./b/9') + 13 | context('./b/10'); 14 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context-devtool-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | devtool: 'source-map', 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/b/11-2.js: -------------------------------------------------------------------------------- 1 | module.exports = 11; -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', true, /\d/); 2 | 3 | module.exports = 4 | context('./1') + 5 | context('./2') + 6 | context('./3') + 7 | context('./4') + 8 | context('./5') + 9 | context('./b/6') + 10 | context('./b/7') + 11 | context('./b/8') + 12 | context('./b/9') + 13 | context('./b/10'); 14 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-deep-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-cheap-eval-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-cheap-eval-source-map/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-cheap-eval-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'cheap-eval-source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | recordsPath: __dirname + '/tmp/cache/records.json', 12 | plugins: [ 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache', 15 | }), 16 | ], 17 | }; 18 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-cheap-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-cheap-source-map/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-cheap-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'cheap-source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval-source-map-hash-filename/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval-source-map-hash-filename/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval-source-map-hash-filename/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'eval-source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: '[hash].js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval-source-map/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'eval-source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-eval/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'eval', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-inline-cheap-source-map-hash-filename/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-inline-cheap-source-map-hash-filename/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-inline-cheap-source-map-hash-filename/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'inline-cheap-source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: '[hash].js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-inline-cheap-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-inline-cheap-source-map/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-inline-cheap-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'inline-cheap-source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-nosources-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-nosources-source-map/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-nosources-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'nosources-source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-source-map-hash-filename/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-source-map-hash-filename/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-source-map-hash-filename/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: '[hash].js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-source-map/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-devtool-source-map/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | devtool: 'source-map', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-error-resolve/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-error-resolve/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-dynamic-context-import/fibs/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-dynamic-context-import/fibs/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-dynamic-context-import/index.js: -------------------------------------------------------------------------------- 1 | const l = 'obj'; 2 | import(/* webpackChunkName: '[request].locale' */`./fibs/${window.Globals.locale}`) 3 | .then(({fib}) => { 4 | console.log(fib(3)); 5 | }); 6 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-dynamic-context-import/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | mode: 'development', 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-dynamic-import/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-dynamic-import/index.js: -------------------------------------------------------------------------------- 1 | import(/* webpackChunkName: 'foo' */'./obj') 2 | .then(({fib}) => { 3 | console.log(fib(3)); 4 | }); 5 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-dynamic-import/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-dynamic-import/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-json/a.js: -------------------------------------------------------------------------------- 1 | import b from './b'; 2 | export {b}; 3 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-json/b.json: -------------------------------------------------------------------------------- 1 | "key" -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-json/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-json/index.js: -------------------------------------------------------------------------------- 1 | import {fib} from './obj'; 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-json/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | import {b as key} from './a'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-json/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-compatibility/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-compatibility/index.js: -------------------------------------------------------------------------------- 1 | import * as fib from './obj'; 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-compatibility/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-compatibility/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-before-import/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-before-import/index.js: -------------------------------------------------------------------------------- 1 | import {key} from './obj'; 2 | 3 | console.log(key(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-before-import/obj.js: -------------------------------------------------------------------------------- 1 | export {key, fib}; 2 | import fib from './fib'; 3 | let key = 'obj'; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-before-import/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-alt/export.js: -------------------------------------------------------------------------------- 1 | export * from './fib'; 2 | export * from './fab'; 3 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-alt/fab.js: -------------------------------------------------------------------------------- 1 | export function fab(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-alt/fib.js: -------------------------------------------------------------------------------- 1 | export function fib(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-alt/index.js: -------------------------------------------------------------------------------- 1 | import {fab} from './export'; 2 | 3 | console.log(fab(4)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-alt/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-some/export.js: -------------------------------------------------------------------------------- 1 | export * from './fib'; 2 | export * from './fab'; 3 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-some/fab.js: -------------------------------------------------------------------------------- 1 | export function fab(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-some/fib.js: -------------------------------------------------------------------------------- 1 | export function fib(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-some/index.js: -------------------------------------------------------------------------------- 1 | import {fab} from './export'; 2 | export default fab(4); -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star-some/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star/export.js: -------------------------------------------------------------------------------- 1 | export * from './fib'; 2 | export * from './fab'; 3 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star/fab.js: -------------------------------------------------------------------------------- 1 | export function fab(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star/fib.js: -------------------------------------------------------------------------------- 1 | export function fib(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star/index.js: -------------------------------------------------------------------------------- 1 | import {fib, fab} from './export'; 2 | 3 | console.log(fib(3), fab(4)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-export-star/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-use-before-import/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-use-before-import/index.js: -------------------------------------------------------------------------------- 1 | console.log(key(3)); 2 | import {key} from './obj'; 3 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-use-before-import/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module-use-before-import/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module/a.js: -------------------------------------------------------------------------------- 1 | import b from './b'; 2 | export {b}; 3 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module/b.js: -------------------------------------------------------------------------------- 1 | export default 'key'; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module/index.js: -------------------------------------------------------------------------------- 1 | import {fib} from './obj'; 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | import {b as key} from './a'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-rename-module/fact.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-rename-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-rename-module/index.js: -------------------------------------------------------------------------------- 1 | import {key as _key} from './key'; 2 | import {key as __key} from './obj'; 3 | import fibfib from './fib'; 4 | import factfact from './fact'; 5 | 6 | console.log(_key, __key, factfact, fibfib(3)); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-rename-module/key.js: -------------------------------------------------------------------------------- 1 | export var key = 'keykey'; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-rename-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-rename-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/a/1.js: -------------------------------------------------------------------------------- 1 | export default 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/a/2.js: -------------------------------------------------------------------------------- 1 | export default 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/a/3.js: -------------------------------------------------------------------------------- 1 | export default 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/a/4.js: -------------------------------------------------------------------------------- 1 | export default 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/a/5.js: -------------------------------------------------------------------------------- 1 | export default 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/a/index.js: -------------------------------------------------------------------------------- 1 | export default Promise.all([1, 2, 3, 4, 5].map(i => System.import('./' + i))) 2 | .then(values => { 3 | const [m1, m2, m3, m4, m5] = values; 4 | return (m1 + m2 + m3 + m4 + m5); 5 | }); 6 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/b/10.js: -------------------------------------------------------------------------------- 1 | export default 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/b/6.js: -------------------------------------------------------------------------------- 1 | export default 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/b/7.js: -------------------------------------------------------------------------------- 1 | export default 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/b/8.js: -------------------------------------------------------------------------------- 1 | export default 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/b/9.js: -------------------------------------------------------------------------------- 1 | export default 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/b/index.js: -------------------------------------------------------------------------------- 1 | import m6 from './6'; 2 | import m7 from './7'; 3 | import m8 from './8'; 4 | import m9 from './9'; 5 | import m10 from './10'; 6 | 7 | export default (m6 + m7 + m8 + m9 + m10); 8 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/index.js: -------------------------------------------------------------------------------- 1 | import a from './a'; 2 | import b from './b'; 3 | 4 | a.then(a => console.log(a + b)); 5 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-module/index.js: -------------------------------------------------------------------------------- 1 | System.import('./obj') 2 | .then(({fib}) => { 3 | console.log(fib(3)); 4 | }); 5 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-es2015-system-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-external/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-external/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | externals: function(context, request, cb) { 11 | if (request === './fib') {return cb(null, './fib', 'commonjs2');} 12 | cb(); 13 | }, 14 | plugins: [ 15 | new HardSourceWebpackPlugin({ 16 | cacheDirectory: 'cache', 17 | environmentHash: { 18 | root: __dirname + '/../../..', 19 | }, 20 | }), 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/a/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./1') + 3 | require('./2') + 4 | require('./3') + 5 | require('./4') + 6 | require('./5'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/b/6/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 60; -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/b/7/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 70; -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/b/index.js: -------------------------------------------------------------------------------- 1 | var b = module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-10deps-1nest/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-1dep/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/base-move-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/a/1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', true, /\d/); 2 | 3 | module.exports = context.keys() 4 | .reduce(function(carry, key) { 5 | return carry + context(key); 6 | }, 0); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-move-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-options-default/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-options-default/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-options-default/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | environmentHash: { 13 | root: __dirname + '/../../..', 14 | }, 15 | }), 16 | ], 17 | }; 18 | -------------------------------------------------------------------------------- /tests/fixtures/base-path-info/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-path-info/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-path-info/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | pathinfo: true, 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /tests/fixtures/base-process-env/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-process-env/index.js: -------------------------------------------------------------------------------- 1 | if (process.env.NODE_ENV !== 'production') { 2 | var fib = require('./fib'); 3 | 4 | console.log(fib(3)); 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/base-process-env/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | }), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tests/fixtures/base-query-request/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-query-request/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib?argument'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-query-request/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-records-json/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-records-json/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-records-json/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | recordsOutputPath: __dirname + '/tmp/records.json', 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /tests/fixtures/base-resolve-missing/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/base-resolve-missing/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-resolve-missing/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-resolve-missing/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-target-node-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-target-node-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-target-node-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | target: 'node', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /tests/fixtures/base-warning-context/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-warning-context/index.js: -------------------------------------------------------------------------------- 1 | var expr = require.context; 2 | -------------------------------------------------------------------------------- /tests/fixtures/base-warning-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-warning-es2015/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-warning-es2015/index.js: -------------------------------------------------------------------------------- 1 | import {warning} from './obj'; 2 | console.log(warning); -------------------------------------------------------------------------------- /tests/fixtures/base-warning-es2015/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | let key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-warning-es2015/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/base-wasm/index.js: -------------------------------------------------------------------------------- 1 | import {add, getNumber} from './wasm.wasm'; 2 | 3 | console.log(add(getNumber(), 2)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/base-wasm/wasm.wasm: -------------------------------------------------------------------------------- 1 | asm `` add getNumber 2 | j A( -------------------------------------------------------------------------------- /tests/fixtures/base-wasm/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-confighash-dir/config-hash: -------------------------------------------------------------------------------- 1 | b -------------------------------------------------------------------------------- /tests/fixtures/hard-source-confighash-dir/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/hard-source-confighash-dir/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-confighash-dir/webpack.config.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | plugins: [ 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache/[confighash]', 15 | configHash: function(config) { 16 | return fs.readFileSync(__dirname + '/config-hash', 'utf8'); 17 | }, 18 | environmentHash: { 19 | root: __dirname + '/../../..', 20 | }, 21 | }), 22 | ], 23 | }; 24 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-confighash/config-hash: -------------------------------------------------------------------------------- 1 | b -------------------------------------------------------------------------------- /tests/fixtures/hard-source-confighash/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/hard-source-confighash/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-confighash/webpack.config.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | plugins: [ 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache', 15 | configHash: function(config) { 16 | return fs.readFileSync(__dirname + '/config-hash', 'utf8'); 17 | }, 18 | environmentHash: { 19 | root: __dirname + '/../../..', 20 | }, 21 | }), 22 | ], 23 | }; 24 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-environmenthash/env-hash: -------------------------------------------------------------------------------- 1 | b -------------------------------------------------------------------------------- /tests/fixtures/hard-source-environmenthash/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/hard-source-environmenthash/hard-source-config.js: -------------------------------------------------------------------------------- 1 | { 2 | cacheDirectory: "cache", 3 | environmentHash: function(config) { 4 | return new Promise(function(resolve, reject) { 5 | fs.readFile(__dirname + "/env-hash", "utf8", function(err, src) { 6 | if (err) {return reject(err);} 7 | resolve(src); 8 | }); 9 | }); 10 | }, 11 | } -------------------------------------------------------------------------------- /tests/fixtures/hard-source-environmenthash/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-environmenthash/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | return require('graceful-fs').readFileSync('./vendor/lib1.js') + source; 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-environmenthash/vendor/lib1.js: -------------------------------------------------------------------------------- 1 | console.log("b"); 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-environmenthash/vendor/lib2.js: -------------------------------------------------------------------------------- 1 | console.log("b"); 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-environmenthash/webpack.config.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | var hardSourceConfig = eval( 6 | '(function() { return (' + 7 | require('graceful-fs') 8 | .readFileSync(__dirname + '/hard-source-config.js', 'utf8') + 9 | '); })' 10 | )(); 11 | 12 | module.exports = { 13 | context: __dirname, 14 | entry: './loader.js!./index.js', 15 | output: { 16 | path: __dirname + '/tmp', 17 | filename: 'main.js', 18 | }, 19 | plugins: [ 20 | new HardSourceWebpackPlugin(hardSourceConfig), 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-exclude-plugin/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-exclude-plugin/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-exclude-plugin/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | new HardSourceWebpackPlugin.ExcludeModulePlugin({ 18 | test: /fib\.js$/, 19 | }), 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-md5/config-hash: -------------------------------------------------------------------------------- 1 | a -------------------------------------------------------------------------------- /tests/fixtures/hard-source-md5/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return 1; 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/hard-source-md5/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-md5/webpack.config.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | plugins: [ 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache', 15 | configHash: function(config) { 16 | return fs.readFileSync(__dirname + '/config-hash', 'utf8'); 17 | }, 18 | environmentHash: { 19 | root: __dirname + '/../../..', 20 | }, 21 | }), 22 | ], 23 | }; 24 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/env-hash: -------------------------------------------------------------------------------- 1 | b -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/hard-source-config.js: -------------------------------------------------------------------------------- 1 | { 2 | cacheDirectory: "cache", 3 | environmentHash: { 4 | root: __dirname, 5 | }, 6 | } -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | return require('graceful-fs').readFileSync('./vendor/lib1.js') + source; 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/package-lock.json: -------------------------------------------------------------------------------- 1 | c -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/vendor/lib1.js: -------------------------------------------------------------------------------- 1 | console.log("b"); 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/vendor/lib2.js: -------------------------------------------------------------------------------- 1 | console.log("b"); 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/webpack.config.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | var hardSourceConfig = eval( 6 | '(function() { return (' + 7 | require('graceful-fs') 8 | .readFileSync(__dirname + '/hard-source-config.js', 'utf8') + 9 | '); })' 10 | )(); 11 | 12 | module.exports = { 13 | context: __dirname, 14 | entry: './loader.js!./index.js', 15 | output: { 16 | path: __dirname + '/tmp', 17 | filename: 'main.js', 18 | }, 19 | plugins: [ 20 | new HardSourceWebpackPlugin(hardSourceConfig), 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-packageyarnlock-hash/yarn.lock: -------------------------------------------------------------------------------- 1 | b -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-config-mismatch/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-config-mismatch/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', false, /\d/); 2 | 3 | module.exports = 4 | context('./1') + 5 | context('./2') + 6 | context('./3') + 7 | context('./4') + 8 | context('./5'); 9 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | mode: 'development', 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | }), 15 | new (require('../../../lib/ParallelModulePlugin'))({ 16 | minModules: 2, 17 | }), 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-defaults/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-defaults/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin-defaults/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | mode: 'development', 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new (require('../../../lib/ParallelModulePlugin'))(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-parallel-plugin/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | mode: 'development', 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new HardSourceWebpackPlugin.ParallelModulePlugin({ 19 | fork: (fork, compiler, webpackBin) => fork(webpackBin(), ['--config', __filename], { 20 | silent: true, 21 | }), 22 | numWorkers: 2, 23 | minModules: 1, 24 | }), 25 | ], 26 | }; 27 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-prune/config-hash: -------------------------------------------------------------------------------- 1 | b -------------------------------------------------------------------------------- /tests/fixtures/hard-source-prune/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/hard-source-prune/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/hard-source-prune/webpack.config.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | plugins: [ 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache/[confighash]', 15 | configHash: function(config) { 16 | return fs.readFileSync(__dirname + '/config-hash', 'utf8'); 17 | }, 18 | environmentHash: { 19 | root: __dirname + '/../../..', 20 | }, 21 | cachePrune: { 22 | maxAge: -2000, 23 | sizeThreshold: 0, 24 | }, 25 | }), 26 | ], 27 | }; 28 | -------------------------------------------------------------------------------- /tests/fixtures/loader-css/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-css/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-context-dep/dir/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-custom-context-dep/dir/.gitkeep -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-context-dep/dir/b: -------------------------------------------------------------------------------- 1 | // b -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-context-dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-context-dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-context-dep/loader.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | var path = require('path'); 3 | 4 | module.exports = function(source) { 5 | this.cacheable && this.cacheable(); 6 | this.addContextDependency(path.join(__dirname, 'dir')); 7 | var items = fs.readdirSync(path.join(__dirname, 'dir')); 8 | items.sort(); 9 | return [ 10 | '// ' + items[1], 11 | source 12 | ].join('\n'); 13 | }; 14 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-context-dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './loader.js!./index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-deep-context-dep/dir/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-custom-deep-context-dep/dir/.gitkeep -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-deep-context-dep/dir/dirdir/b: -------------------------------------------------------------------------------- 1 | // b -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-deep-context-dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-deep-context-dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-deep-context-dep/loader.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | var path = require('path'); 3 | 4 | module.exports = function(source) { 5 | this.cacheable && this.cacheable(); 6 | this.addContextDependency(path.join(__dirname, 'dir')); 7 | var items = fs.readdirSync(path.join(__dirname, 'dir')); 8 | items.sort(); 9 | var subdir = items[items.length - 1]; 10 | var subitems = fs.readdirSync(path.join(__dirname, 'dir', subdir)); 11 | subitems.sort(); 12 | var name = subitems[subitems.length - 1]; 13 | return [ 14 | '// ' + subdir + '/' + name, 15 | source 16 | ].join('\n'); 17 | }; 18 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-deep-context-dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './loader.js!./index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-function-option/fib.js: -------------------------------------------------------------------------------- 1 | bar -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-function-option/index.js: -------------------------------------------------------------------------------- 1 | require('./fib'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-function-option/loader.js: -------------------------------------------------------------------------------- 1 | var loaderUtils = require('loader-utils'); 2 | 3 | module.exports = function(source) { 4 | var options = loaderUtils.getOptions(this); 5 | return options.handle(source); 6 | }; 7 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-missing-dep-added/index.js: -------------------------------------------------------------------------------- 1 | console.log(fib(3)); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-missing-dep-added/loader.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | var path = require('path'); 3 | 4 | module.exports = function(source) { 5 | this.cacheable && this.cacheable(); 6 | var file = path.join(__dirname, 'fib.js'); 7 | try { 8 | fs.statSync(file); 9 | return [ 10 | 'var fib = require("./fib.js");', 11 | source, 12 | ].join('\n'); 13 | } 14 | catch (_) { 15 | this.addDependency(file); 16 | } 17 | return source; 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-missing-dep-added/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './loader.js!./index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-missing-dep/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-custom-missing-dep/index.js -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-missing-dep/loader.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | var path = require('path'); 3 | 4 | module.exports = function(source) { 5 | this.cacheable && this.cacheable(); 6 | this.addDependency(path.join(__dirname, 'fib.js')); 7 | return source; 8 | }; 9 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-missing-dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './loader.js!./index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-no-dep-moved/fib/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-custom-no-dep-moved/fib/index.js -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-no-dep-moved/index.js: -------------------------------------------------------------------------------- 1 | require('./loader.js!./fib'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-no-dep-moved/loader.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | var path = require('path'); 3 | 4 | module.exports = function(source) {}; 5 | 6 | module.exports.pitch = function(remainingRequest) { 7 | this.cacheable && this.cacheable(); 8 | return '// ' + remainingRequest.replace(/\\/g, '/'); 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-no-dep-moved/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-no-dep/fib.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-custom-no-dep/fib.js -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-no-dep/index.js: -------------------------------------------------------------------------------- 1 | require('./loader.js!./fib.js'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-no-dep/loader.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | var path = require('path'); 3 | 4 | module.exports = function(source) {}; 5 | 6 | module.exports.pitch = function() { 7 | this.cacheable && this.cacheable(); 8 | return '// no source'; 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-no-dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-prepend-helper/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-custom-prepend-helper/image.png -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-prepend-helper/index.js: -------------------------------------------------------------------------------- 1 | helper(require('./image.png')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-prepend-helper/loader-helper.js: -------------------------------------------------------------------------------- 1 | function helper(b) { 2 | console.log(b); 3 | } -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-prepend-helper/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | var helperPath = require.resolve('./loader-helper.js'); 4 | this.addDependency(helperPath); 5 | return require('graceful-fs').readFileSync(helperPath, 'utf8') + source; 6 | }; 7 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing-query/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing-query/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing-query/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./loader?missing!./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing-query/loader/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | return [ 4 | '// loader/index.js', 5 | source, 6 | ].join('\n'); 7 | }; 8 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing-query/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./loader!./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | return [ 4 | '// loader.js', 5 | source, 6 | ].join('\n'); 7 | }; -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing/loader/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | return [ 4 | '// loader/index.js', 5 | source, 6 | ].join('\n'); 7 | }; 8 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-missing/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing-change/fab.js: -------------------------------------------------------------------------------- 1 | bar -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing-change/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing-change/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./loader!./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing-change/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | const done = this.async(); 4 | new Promise( 5 | (f, e) => this.resolve(this.context, './fab', (er, v) => (er ? e(er) : f(v))) 6 | ) 7 | .then(v => JSON.stringify(v)) 8 | .then(v => done(null, v), done); 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing-change/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./loader!./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | const done = this.async(); 4 | new Promise( 5 | (f, e) => this.resolve(this.context, './fab', (er, v) => (er ? f('unresolved') : f(v))) 6 | ) 7 | .then(v => JSON.stringify(v)) 8 | .then(v => done(null, v), done); 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request-missing/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request/fab/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n * (n > 1 ? n - 1 : 1); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./loader!./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | return new Promise( 4 | (f, e) => this.resolve(this.context, './fab', (er, v) => er ? e(er) : f(v)) 5 | ) 6 | .then(v => JSON.stringify(v)); 7 | }; 8 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-resolve-request/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-user-loader/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-user-loader/index.js: -------------------------------------------------------------------------------- 1 | require('./loader.js!./fib.js'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-custom-user-loader/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | return source; 4 | }; 5 | -------------------------------------------------------------------------------- /tests/fixtures/loader-file-context/images/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-file-context/images/image.png -------------------------------------------------------------------------------- /tests/fixtures/loader-file-context/index.js: -------------------------------------------------------------------------------- 1 | require.context('!!file-loader?name=[name].[ext]!./images', true, /image\.png/); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-file-move/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-file-move/image.png -------------------------------------------------------------------------------- /tests/fixtures/loader-file-move/index.js: -------------------------------------------------------------------------------- 1 | require('./image.png'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-file-options/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-file-options/image.png -------------------------------------------------------------------------------- /tests/fixtures/loader-file-options/index.js: -------------------------------------------------------------------------------- 1 | require('./image.png'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-file-options/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var webpackVersion = require('webpack/package.json').version; 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | module: { 12 | rules: [ 13 | { 14 | test: /\.png$/, 15 | loader: 'file-loader', 16 | options: { 17 | name: '[hash].[ext]', 18 | outputPath: name => `images/${name}`, 19 | }, 20 | }, 21 | ], 22 | }, 23 | plugins: [ 24 | new HardSourceWebpackPlugin({ 25 | cacheDirectory: 'cache', 26 | }), 27 | ], 28 | }; 29 | -------------------------------------------------------------------------------- /tests/fixtures/loader-file-use/src/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-file-use/src/image.png -------------------------------------------------------------------------------- /tests/fixtures/loader-file-use/src/index.js: -------------------------------------------------------------------------------- 1 | require('./image.png'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-file/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-file/image.png -------------------------------------------------------------------------------- /tests/fixtures/loader-file/index.js: -------------------------------------------------------------------------------- 1 | require('./image.png'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-warning/index.js: -------------------------------------------------------------------------------- 1 | // fake content 2 | require("./module"); 3 | -------------------------------------------------------------------------------- /tests/fixtures/loader-warning/loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | var done = this.async(); 3 | this.cacheable(); 4 | this.emitWarning("This is a test warning"); 5 | this.emitError("This is a test error"); 6 | done(null, source); 7 | }; 8 | -------------------------------------------------------------------------------- /tests/fixtures/loader-warning/module.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/loader-warning/module.js -------------------------------------------------------------------------------- /tests/fixtures/loader-worker-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/loader-worker-1dep/index.js: -------------------------------------------------------------------------------- 1 | var worker = require('!!worker-loader!./worker.js'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/loader-worker-1dep/worker.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-child-compiler-resolutions/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-child-compiler-resolutions/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-child-compiler-resolutions/loader-a.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | return '// loader-a\n' + source; 4 | }; 5 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-child-compiler-resolutions/loader-b.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable && this.cacheable(); 3 | return '// loader-b\n' + source; 4 | }; 5 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module-change/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module-change/index.js: -------------------------------------------------------------------------------- 1 | var key = require('./obj').key; 2 | module.exports = key; -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module-change/obj.js: -------------------------------------------------------------------------------- 1 | let key = 'obj'; 2 | export {key}; -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module-change/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | plugins: [ 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache', 15 | environmentHash: { 16 | root: __dirname + '/../../..', 17 | }, 18 | }), 19 | new webpack.optimize.ModuleConcatenationPlugin(), 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module/a.js: -------------------------------------------------------------------------------- 1 | import b from './b'; 2 | export {b}; 3 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module/b.js: -------------------------------------------------------------------------------- 1 | export default 'a key'; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module/index.js: -------------------------------------------------------------------------------- 1 | const {fib} = require('./obj'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | import {b as key} from './a'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-concatenated-module/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | plugins: [ 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache', 15 | environmentHash: { 16 | root: __dirname + '/../../..', 17 | }, 18 | }), 19 | new HardSourceWebpackPlugin.SerializerJsonPlugin(), 20 | new webpack.optimize.ModuleConcatenationPlugin(), 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-copy/images/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/plugin-copy/images/image.png -------------------------------------------------------------------------------- /tests/fixtures/plugin-copy/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/plugin-copy/index.js -------------------------------------------------------------------------------- /tests/fixtures/plugin-copy/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | var CopyWebpackPlugin = require('copy-webpack-plugin'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | module: { 13 | rules: [ 14 | { 15 | test: /\.png$/, 16 | loader: 'file-loader', 17 | }, 18 | ], 19 | }, 20 | plugins: [ 21 | new HardSourceWebpackPlugin({ 22 | cacheDirectory: 'cache', 23 | }), 24 | new CopyWebpackPlugin(['images']), 25 | ], 26 | }; 27 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll-reference-scope/dll-manifest-4.27.json: -------------------------------------------------------------------------------- 1 | {"name":"dll_b44bb155bbcb19ee9c89","content":{"./fib.js":{"id":1,"buildMeta":{"providedExports":true}}}} -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll-reference-scope/dll-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dll_c640cf83e777b7d462d5", 3 | "content": { 4 | "./fib.js": { 5 | "id": 0, 6 | "meta": {}, 7 | "hasStarExport": false, 8 | "activeExports": [] 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll-reference-scope/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll-reference-scope/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll-reference/dll-manifest-4.27.json: -------------------------------------------------------------------------------- 1 | {"name":"dll_b44bb155bbcb19ee9c89","content":{"./fib.js":{"id":1,"buildMeta":{"providedExports":true}}}} -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll-reference/dll-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dll_c640cf83e777b7d462d5", 3 | "content": { 4 | "./fib.js": { 5 | "id": 0, 6 | "meta": {}, 7 | "hasStarExport": false, 8 | "activeExports": [] 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll-reference/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll-reference/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-dll/webpack.config.js: -------------------------------------------------------------------------------- 1 | var DllPlugin = require('webpack').DllPlugin; 2 | var HardSourceWebpackPlugin = require('../../..'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: { 7 | 'dll': ['./fib.js'], 8 | }, 9 | output: { 10 | path: __dirname + '/tmp', 11 | filename: 'dll.js', 12 | library: '[name]_[hash]', 13 | }, 14 | plugins: [ 15 | new HardSourceWebpackPlugin({ 16 | cacheDirectory: 'cache', 17 | environmentHash: { 18 | root: __dirname + '/../../..', 19 | }, 20 | }), 21 | new DllPlugin({ 22 | path: __dirname + '/tmp/dll-manifest.json', 23 | name: '[name]_[hash]', 24 | context: __dirname, 25 | }), 26 | ], 27 | }; 28 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-html-uglify/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-html-uglify/index.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-html-uglify/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-loader-file/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/plugin-extract-text-loader-file/image.png -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-loader-file/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | background: url('image.png'); 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-loader-file/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-throw-on-freeze/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-throw-on-freeze/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-uglify-eval-source-map/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-uglify-eval-source-map/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-uglify-source-map/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-uglify-source-map/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-uglify/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text-uglify/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-extract-text/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-accept-dep/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-accept-dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | 5 | if (module.hot) { 6 | module.hot.accept('./fib', function() { 7 | console.log(require('./fib')(3)); 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-accept/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-accept/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | 5 | if (module.hot) { 6 | module.hot.accept(function() {}); 7 | } 8 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-accept/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HotModuleReplacementPlugin = require('webpack').HotModuleReplacementPlugin; 2 | var HardSourceWebpackPlugin = require('../../..'); 3 | var ForceWriteRecords = require('../../util/force-write-records'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | recordsPath: __dirname + '/tmp/cache/records.json', 13 | plugins: [ 14 | new ForceWriteRecords(), 15 | new HotModuleReplacementPlugin(), 16 | new HardSourceWebpackPlugin({ 17 | cacheDirectory: __dirname + '/tmp/cache', 18 | environmentHash: { 19 | root: __dirname + '/../../..', 20 | }, 21 | }), 22 | ], 23 | }; 24 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-es2015/fib.js: -------------------------------------------------------------------------------- 1 | export function fib(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; 4 | 5 | export var key = 'fib'; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-es2015/index.js: -------------------------------------------------------------------------------- 1 | import {fib} from './fib'; 2 | export default fib(3); -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-es2015/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HotModuleReplacementPlugin = require('webpack').HotModuleReplacementPlugin; 2 | var HardSourceWebpackPlugin = require('../../..'); 3 | var ForceWriteRecords = require('../../util/force-write-records'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | recordsPath: __dirname + '/tmp/cache/records.json', 13 | plugins: [ 14 | new ForceWriteRecords(), 15 | new HotModuleReplacementPlugin(), 16 | new HardSourceWebpackPlugin({ 17 | cacheDirectory: __dirname + '/tmp/cache', 18 | environmentHash: { 19 | root: __dirname + '/../../..', 20 | }, 21 | }), 22 | ], 23 | }; 24 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-process-env/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | if (process.env.NODE_ENV !== "production") { 3 | return n + (n > 0 ? n - 2 : 0); 4 | } 5 | else { 6 | return n + (n > 0 ? n - 1 : 0); 7 | } 8 | }; -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr-process-env/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | 5 | if (module.hot) { 6 | module.hot.accept('./fib', function() { 7 | console.log(require('./fib')(3)); 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-hmr/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HotModuleReplacementPlugin = require('webpack').HotModuleReplacementPlugin; 2 | var HardSourceWebpackPlugin = require('../../..'); 3 | var ForceWriteRecords = require('../../util/force-write-records'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | recordsPath: __dirname + '/tmp/cache/records.json', 13 | plugins: [ 14 | new ForceWriteRecords(), 15 | new HotModuleReplacementPlugin(), 16 | new HardSourceWebpackPlugin({ 17 | cacheDirectory: __dirname + '/tmp/cache', 18 | environmentHash: { 19 | root: __dirname + '/../../..', 20 | }, 21 | }), 22 | ], 23 | }; 24 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-html-lodash/fact.js: -------------------------------------------------------------------------------- 1 | require('lodash'); 2 | 3 | module.exports = function(n) { 4 | return n * (n > 0 ? n - 2 : 0); 5 | }; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-html-lodash/fib.js: -------------------------------------------------------------------------------- 1 | require('./fact'); 2 | 3 | module.exports = function(n) { 4 | return n + (n > 0 ? n - 2 : 0); 5 | }; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-html-lodash/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-html-lodash/index.js: -------------------------------------------------------------------------------- 1 | require('./fib'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-html-lodash/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HtmlPlugin = require('html-webpack-plugin'); 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | plugins: [ 13 | new HtmlPlugin({ 14 | template: 'index.html', 15 | filename: 'index.html', 16 | cache: false, 17 | }), 18 | new HardSourceWebpackPlugin({ 19 | cacheDirectory: 'cache', 20 | environmentHash: { 21 | root: __dirname + '/../../..', 22 | }, 23 | }), 24 | ], 25 | }; 26 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-1dep/index.js: -------------------------------------------------------------------------------- 1 | require('./fib'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var IgnorePlugin = require('webpack').IgnorePlugin; 2 | 3 | var HardSourceWebpackPlugin = require('../../..'); 4 | 5 | module.exports = { 6 | context: __dirname, 7 | entry: './index.js', 8 | output: { 9 | path: __dirname + '/tmp', 10 | filename: 'main.js', 11 | }, 12 | plugins: [ 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache', 15 | environmentHash: { 16 | root: __dirname + '/../../..', 17 | }, 18 | }), 19 | new IgnorePlugin(/\.\/fib/), 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', false, /\d/); 2 | 3 | module.exports = 0; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context-members/webpack.config.js: -------------------------------------------------------------------------------- 1 | var IgnorePlugin = require('webpack').IgnorePlugin; 2 | var HardSourceWebpackPlugin = require('../../..'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new IgnorePlugin(/\.\/a\/[1-5]/), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/a/1.js: -------------------------------------------------------------------------------- 1 | module.exports = 1; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/a/2.js: -------------------------------------------------------------------------------- 1 | module.exports = 2; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/a/3.js: -------------------------------------------------------------------------------- 1 | module.exports = 3; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/a/4.js: -------------------------------------------------------------------------------- 1 | module.exports = 4; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/a/5.js: -------------------------------------------------------------------------------- 1 | module.exports = 5; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/a/index.js: -------------------------------------------------------------------------------- 1 | var context = require.context('.', false, /\d/); 2 | 3 | module.exports = 0; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/b/10.js: -------------------------------------------------------------------------------- 1 | module.exports = 10; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/b/6.js: -------------------------------------------------------------------------------- 1 | module.exports = 6; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/b/7.js: -------------------------------------------------------------------------------- 1 | module.exports = 7; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/b/8.js: -------------------------------------------------------------------------------- 1 | module.exports = 8; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/b/9.js: -------------------------------------------------------------------------------- 1 | module.exports = 9; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/b/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | require('./6') + 3 | require('./7') + 4 | require('./8') + 5 | require('./9') + 6 | require('./10'); 7 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/index.js: -------------------------------------------------------------------------------- 1 | console.log(require('./a') + require('./b')); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-ignore-context/webpack.config.js: -------------------------------------------------------------------------------- 1 | var IgnorePlugin = require('webpack').IgnorePlugin; 2 | var HardSourceWebpackPlugin = require('../../..'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new IgnorePlugin(/tmp/, /\.\/a/), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-isomorphic-tools/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/plugin-isomorphic-tools/image.png -------------------------------------------------------------------------------- /tests/fixtures/plugin-isomorphic-tools/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | background: url('image.png'); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-isomorphic-tools/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-logger-child-no-memory/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-logger-child-no-memory/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract-change/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: red; 3 | } -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract-change/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract-file/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzgoddard/hard-source-webpack-plugin/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/tests/fixtures/plugin-mini-css-extract-file/image.png -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract-file/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | background: url('image.png'); 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract-file/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract-watch/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: red; 3 | } -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract-watch/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract/index.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-mini-css-extract/index.js: -------------------------------------------------------------------------------- 1 | require('./index.css'); 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-prefetch-es2015/a.js: -------------------------------------------------------------------------------- 1 | import b from './b'; 2 | export {b}; 3 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-prefetch-es2015/b.js: -------------------------------------------------------------------------------- 1 | export default 'key'; 2 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-prefetch-es2015/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-prefetch-es2015/index.js: -------------------------------------------------------------------------------- 1 | import {key} from './obj'; 2 | 3 | console.log(key); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-prefetch-es2015/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | import {b as key} from './a'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-prefetch-es2015/unused.js: -------------------------------------------------------------------------------- 1 | import b from './b'; 2 | export {b}; 3 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-prefetch-es2015/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var HardSourceWebpackPlugin = require('../../..'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new webpack.PrefetchPlugin('./unused.js'), 13 | new HardSourceWebpackPlugin({ 14 | cacheDirectory: 'cache', 15 | environmentHash: { 16 | root: __dirname + '/../../..', 17 | }, 18 | }), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-serializer-json-base-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-serializer-json-base-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-serializer-json-base-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | plugins: [ 11 | new HardSourceWebpackPlugin({ 12 | cacheDirectory: 'cache', 13 | environmentHash: { 14 | root: __dirname + '/../../..', 15 | }, 16 | }), 17 | new HardSourceWebpackPlugin.SerializerJsonPlugin(), 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-change/index.js: -------------------------------------------------------------------------------- 1 | import {fab} from './obj'; 2 | 3 | console.log(fab(3)); -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-change/obj/fab.js: -------------------------------------------------------------------------------- 1 | function fab(n) { 2 | return n * (n > 1 ? n - 1 : 1); 3 | } 4 | 5 | export {fab}; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-change/obj/fib.js: -------------------------------------------------------------------------------- 1 | function fib(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | } 4 | 5 | export {fib}; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-change/obj/key.js: -------------------------------------------------------------------------------- 1 | let key = 'key'; 2 | 3 | export {key}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-change/obj/obj.js: -------------------------------------------------------------------------------- 1 | import {fib} from './fib'; 2 | import {fab} from './fab'; 3 | import {key} from './key'; 4 | export {fib, fab, key}; 5 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-change/obj/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "obj", 3 | "sideEffects": false, 4 | "main": "obj.js" 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-change/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | optimization: { 11 | minimize: false, 12 | sideEffects: true, 13 | }, 14 | module: { 15 | rules: [ 16 | { 17 | test: /obj/, 18 | }, 19 | ], 20 | }, 21 | plugins: [ 22 | new HardSourceWebpackPlugin({ 23 | cacheDirectory: 'cache', 24 | environmentHash: { 25 | root: __dirname + '/../../..', 26 | }, 27 | }), 28 | ], 29 | }; 30 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-settings/index.js: -------------------------------------------------------------------------------- 1 | import {fib} from './obj'; 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-settings/obj/fab.js: -------------------------------------------------------------------------------- 1 | function fab(n) { 2 | return n * (n > 1 ? n - 1 : 1); 3 | } 4 | 5 | export {fab}; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-settings/obj/fib.js: -------------------------------------------------------------------------------- 1 | function fib(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | } 4 | 5 | export {fib}; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-settings/obj/key.js: -------------------------------------------------------------------------------- 1 | let key = 'key'; 2 | 3 | export {key}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-settings/obj/obj.js: -------------------------------------------------------------------------------- 1 | import {fib} from './fib'; 2 | import {fab} from './fab'; 3 | import {key} from './key'; 4 | export {fib, fab, key}; 5 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-settings/obj/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "obj", 3 | "main": "obj.js" 4 | } 5 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect-settings/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | optimization: { 11 | minimize: false, 12 | sideEffects: true, 13 | }, 14 | module: { 15 | rules: [ 16 | { 17 | test: /obj/, 18 | sideEffects: false, 19 | }, 20 | ], 21 | }, 22 | plugins: [ 23 | new HardSourceWebpackPlugin({ 24 | cacheDirectory: 'cache', 25 | environmentHash: { 26 | root: __dirname + '/../../..', 27 | }, 28 | }), 29 | ], 30 | }; 31 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect/index.js: -------------------------------------------------------------------------------- 1 | import {fib} from './obj'; 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect/obj/fab.js: -------------------------------------------------------------------------------- 1 | function fab(n) { 2 | return n * (n > 1 ? n - 1 : 1); 3 | } 4 | 5 | export {fab}; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect/obj/fib.js: -------------------------------------------------------------------------------- 1 | function fib(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | } 4 | 5 | export {fib}; 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect/obj/key.js: -------------------------------------------------------------------------------- 1 | let key = 'key'; 2 | 3 | export {key}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect/obj/obj.js: -------------------------------------------------------------------------------- 1 | import {fib} from './fib'; 2 | import {fab} from './fab'; 3 | import {key} from './key'; 4 | export {fib, fab, key}; 5 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect/obj/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "obj", 3 | "sideEffects": false, 4 | "main": "obj.js" 5 | } 6 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-side-effect/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | 3 | module.exports = { 4 | context: __dirname, 5 | entry: './index.js', 6 | output: { 7 | path: __dirname + '/tmp', 8 | filename: 'main.js', 9 | }, 10 | optimization: { 11 | minimize: false, 12 | sideEffects: true, 13 | }, 14 | module: { 15 | rules: [ 16 | { 17 | test: /obj/, 18 | }, 19 | ], 20 | }, 21 | plugins: [ 22 | new HardSourceWebpackPlugin({ 23 | cacheDirectory: 'cache', 24 | environmentHash: { 25 | root: __dirname + '/../../..', 26 | }, 27 | }), 28 | ], 29 | }; 30 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-source-map-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-source-map-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-1dep-es2015/fib.js: -------------------------------------------------------------------------------- 1 | export default function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | } 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-1dep-es2015/index.js: -------------------------------------------------------------------------------- 1 | import {fib} from './obj'; 2 | export default fib(3); -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-1dep-es2015/obj.js: -------------------------------------------------------------------------------- 1 | import fib from './fib'; 2 | var key = 'obj'; 3 | export {key, fib}; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-babel-devtool-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-babel-devtool-source-map/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-devtool-source-map/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/plugin-uglify-devtool-source-map/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep-bad-cache/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep-bad-cache/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep-bad-cache/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var SerializerAppend2Plugin = require('../../../lib/SerializerAppend2Plugin'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new SerializerAppend2Plugin(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep-compact/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep-compact/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep-compact/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var SerializerAppend2Plugin = require('../../../lib/SerializerAppend2Plugin'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new SerializerAppend2Plugin(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-2-base-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var SerializerAppend2Plugin = require('../../../lib/SerializerAppend2Plugin'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new SerializerAppend2Plugin(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-base-1dep-compact/fib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 2 : 0); 3 | }; -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-base-1dep-compact/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-base-1dep-compact/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var SerializerAppendPlugin = require('../../../lib/SerializerAppendPlugin'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new SerializerAppendPlugin(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-base-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-base-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-append-base-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var SerializerAppendPlugin = require('../../../lib/SerializerAppendPlugin'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new SerializerAppendPlugin(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-cacache-base-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-cacache-base-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-cacache-base-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var SerializerCacachePlugin = require('../../../lib/SerializerCacachePlugin'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new SerializerCacachePlugin(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-json-base-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-json-base-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-json-base-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var SerializerJsonPlugin = require('../../../lib/SerializerJsonPlugin'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new SerializerJsonPlugin(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-leveldb-base-1dep/fib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(n) { 2 | return n + (n > 0 ? n - 1 : 0); 3 | }; 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-leveldb-base-1dep/index.js: -------------------------------------------------------------------------------- 1 | var fib = require('./fib'); 2 | 3 | console.log(fib(3)); 4 | -------------------------------------------------------------------------------- /tests/fixtures/serializer-leveldb-base-1dep/webpack.config.js: -------------------------------------------------------------------------------- 1 | var HardSourceWebpackPlugin = require('../../..'); 2 | var HardSourceLevelDbSerializerPlugin = require('../../../lib/SerializerLeveldbPlugin'); 3 | 4 | module.exports = { 5 | context: __dirname, 6 | entry: './index.js', 7 | output: { 8 | path: __dirname + '/tmp', 9 | filename: 'main.js', 10 | }, 11 | plugins: [ 12 | new HardSourceWebpackPlugin({ 13 | cacheDirectory: 'cache', 14 | environmentHash: { 15 | root: __dirname + '/../../..', 16 | }, 17 | }), 18 | new HardSourceLevelDbSerializerPlugin(), 19 | ], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/util/features.js: -------------------------------------------------------------------------------- 1 | const webpackVersion = require('webpack/package.json').version; 2 | 3 | const isWebpackBeta = /alpha|beta|rc/.test(webpackVersion); 4 | const webpackMajor = Number(webpackVersion.split('.')[0]); 5 | const webpack3OrEarlier = webpackMajor < 4; 6 | const webpack4OrLater = webpackMajor >= 4; 7 | 8 | module.exports = { 9 | extractText: !isWebpackBeta && webpack3OrEarlier, 10 | miniCss: webpack4OrLater, 11 | uglify: !isWebpackBeta, 12 | html: !isWebpackBeta, 13 | }; 14 | -------------------------------------------------------------------------------- /tests/util/force-write-records.js: -------------------------------------------------------------------------------- 1 | var fs = require('graceful-fs'); 2 | var path = require('path'); 3 | 4 | function ForceWriteRecords() {} 5 | 6 | ForceWriteRecords.prototype.apply = function(compiler) { 7 | compiler.plugin('done', function() { 8 | fs.writeFileSync( 9 | path.resolve(compiler.options.context, compiler.recordsOutputPath), 10 | JSON.stringify(compiler.records, null, 2), 11 | 'utf8' 12 | ); 13 | }); 14 | }; 15 | 16 | module.exports = ForceWriteRecords; 17 | --------------------------------------------------------------------------------