Merge branch 'main' into webpack-hot-middleware-lazy-compilation
This commit is contained in:
commit
9be408c1ec
74
.travis.yml
74
.travis.yml
|
@ -1,74 +0,0 @@
|
|||
dist: trusty
|
||||
language: node_js
|
||||
|
||||
branches:
|
||||
only:
|
||||
- webpack-4
|
||||
- main
|
||||
- next
|
||||
- dev-1
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- ".jest-cache"
|
||||
- ".eslintcache"
|
||||
|
||||
stages:
|
||||
- basic
|
||||
- advanced
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
node_js: "12"
|
||||
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=basic
|
||||
stage: basic
|
||||
- os: linux
|
||||
node_js: "12"
|
||||
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=lintunit
|
||||
stage: advanced
|
||||
- os: linux
|
||||
node_js: "12"
|
||||
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration
|
||||
stage: advanced
|
||||
- os: linux
|
||||
node_js: "12"
|
||||
env: NO_WATCH_TESTS=1 ALTERNATIVE_SORT=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration
|
||||
stage: advanced
|
||||
- os: linux
|
||||
node_js: "10"
|
||||
env:
|
||||
- NODEJS_VERSION=v15.0.0-nightly2020082003293aa3a1
|
||||
- YARN_EXTRA_ARGS="--ignore-engines"
|
||||
- NO_WATCH_TESTS=1
|
||||
- JEST="--maxWorkers=2 --cacheDirectory .jest-cache"
|
||||
- JOB_PART=integration
|
||||
stage: advanced
|
||||
fast_finish: true
|
||||
|
||||
before_install:
|
||||
- |
|
||||
if [ "$NODEJS_VERSION" != "" ];
|
||||
then
|
||||
mkdir /opt/node
|
||||
curl --silent "https://nodejs.org/download/nightly/$NODEJS_VERSION/node-$NODEJS_VERSION-linux-x64.tar.gz" | tar -zxf - --directory /opt/node
|
||||
export PATH="/opt/node/node-$NODEJS_VERSION-linux-x64/bin:$PATH"
|
||||
node --version
|
||||
fi
|
||||
|
||||
install:
|
||||
- yarn --frozen-lockfile $YARN_EXTRA_ARGS
|
||||
- yarn link --frozen-lockfile $YARN_EXTRA_ARGS || true
|
||||
- yarn link webpack --frozen-lockfile $YARN_EXTRA_ARGS
|
||||
|
||||
script: yarn travis:$JOB_PART
|
||||
|
||||
after_success:
|
||||
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose
|
||||
- bash <(curl -s https://codecov.io/bash) -F $JOB_PART -X gcov
|
||||
- rm -f .jest-cache/haste-map* .jest-cache/perf-cache*
|
||||
|
||||
notifications:
|
||||
slack:
|
||||
secure: JduSdKWwbnLCwo7Z4E59SGE+Uw832UwnXzQiKEpg1BV45MYDPRiGltly1tRHmPh9OGjvGx3XSkC2tNGOBLtL4UL2SCkf012x0t7jDutKRfcv/njynl8jk8l+UhPmaWiHXDQAgGiiKdL4RfzPLW3HeVHCOWm0LKMzcarTa8tw+rE=
|
497
cspell.json
497
cspell.json
|
@ -1,241 +1,308 @@
|
|||
{
|
||||
"version": "0.1",
|
||||
"version": "0.2",
|
||||
"language": "en",
|
||||
"words": [
|
||||
"webpack",
|
||||
"webpack's",
|
||||
"endregion",
|
||||
"entrypoint",
|
||||
"entrypoints",
|
||||
"splitted",
|
||||
"dedupe",
|
||||
"deduplication",
|
||||
"deduplicating",
|
||||
"unoptimized",
|
||||
"prefetch",
|
||||
"prefetching",
|
||||
"prefetched",
|
||||
"preload",
|
||||
"preloading",
|
||||
"preloaded",
|
||||
"gzipping",
|
||||
"brotli",
|
||||
"submodule",
|
||||
"submodules",
|
||||
"typeof",
|
||||
"devtool",
|
||||
"wasi",
|
||||
"wasm",
|
||||
"webassembly",
|
||||
"IIFE",
|
||||
"IIFE's",
|
||||
"bigint",
|
||||
"unexception",
|
||||
"etag",
|
||||
"builtins",
|
||||
"uncacheable",
|
||||
"cacheable",
|
||||
"mergeable",
|
||||
"devtools",
|
||||
"transpiled",
|
||||
"mixins",
|
||||
"subdir",
|
||||
"errored",
|
||||
"eval",
|
||||
"multiplicator",
|
||||
"finalizer",
|
||||
"promisify",
|
||||
"absolutify",
|
||||
"camelcase",
|
||||
"filebase",
|
||||
"moduleid",
|
||||
"modulehash",
|
||||
"chunkfilename",
|
||||
"chunkname",
|
||||
"chunkhash",
|
||||
"fullhash",
|
||||
"contenthash",
|
||||
"hashable",
|
||||
"hotupdatechunk",
|
||||
"middleware",
|
||||
"middlewares",
|
||||
"serializer",
|
||||
"serializers",
|
||||
"deserialization",
|
||||
"referenceable",
|
||||
"polyfilled",
|
||||
"transpiling",
|
||||
"transpile",
|
||||
"transpiles",
|
||||
"snapshotting",
|
||||
"sourcemap",
|
||||
"nosources",
|
||||
"filepath",
|
||||
"subpath",
|
||||
"pathinfo",
|
||||
"undelayed",
|
||||
"microtask",
|
||||
"microtasks",
|
||||
"deopt",
|
||||
"deopts",
|
||||
"sandboxed",
|
||||
"mangleable",
|
||||
"passthrough",
|
||||
"prioritise",
|
||||
"booleanized",
|
||||
"serializables",
|
||||
"unreviewed",
|
||||
"unshifted",
|
||||
"nonrecursive",
|
||||
"symlinked",
|
||||
"subfolder",
|
||||
"prettierrc",
|
||||
"templated",
|
||||
"templating",
|
||||
"kibibytes",
|
||||
"mebibytes",
|
||||
"gibibytes",
|
||||
"typechecker",
|
||||
"recurse",
|
||||
"preparsed",
|
||||
"acircular",
|
||||
"amdmodule",
|
||||
"asmjs",
|
||||
"assemblyscript",
|
||||
"asyncloader",
|
||||
"atlaskit",
|
||||
"autocrlf",
|
||||
"lcov",
|
||||
"lcovonly",
|
||||
"gcov",
|
||||
"lintunit",
|
||||
"instanceof",
|
||||
"loglevel",
|
||||
"runtime",
|
||||
"runtimes",
|
||||
"mimetype",
|
||||
"testvalue",
|
||||
"unusedkey",
|
||||
"unusedvalue",
|
||||
"performant",
|
||||
"watchings",
|
||||
"jsons",
|
||||
"exitance",
|
||||
"ident",
|
||||
"idents",
|
||||
"globstar",
|
||||
"inversed",
|
||||
"concated",
|
||||
"RBDT",
|
||||
"opensource",
|
||||
"babeljs",
|
||||
"backport",
|
||||
"backported",
|
||||
"basictest",
|
||||
"bigint",
|
||||
"Biró",
|
||||
"bitfield",
|
||||
"bomfile",
|
||||
"booleanized",
|
||||
"boolish",
|
||||
"brotli",
|
||||
"browserified",
|
||||
"browserslist",
|
||||
"browserslistrc",
|
||||
"Brumme",
|
||||
"bugfix",
|
||||
"bugfixes",
|
||||
"declarators",
|
||||
"rrrlll",
|
||||
"undefine",
|
||||
"finializer",
|
||||
"quasis",
|
||||
"hashs",
|
||||
"functype",
|
||||
"funcindex",
|
||||
"Descr",
|
||||
"valtype",
|
||||
"informations",
|
||||
"reexecuted",
|
||||
"global's",
|
||||
"unsplittable",
|
||||
"builtins",
|
||||
"cacheable",
|
||||
"callme",
|
||||
"camelcase",
|
||||
"chainable",
|
||||
"metacharacters",
|
||||
"Xarray",
|
||||
"Xfactory",
|
||||
"Xmodule",
|
||||
"Xexports",
|
||||
"moji",
|
||||
"bitfield",
|
||||
"precompute",
|
||||
"toplevel",
|
||||
"modulos",
|
||||
"untaint",
|
||||
"ufeff",
|
||||
"timestamping",
|
||||
"loadername",
|
||||
"laof",
|
||||
"chunkfilename",
|
||||
"chunkhash",
|
||||
"chunkname",
|
||||
"cmodule",
|
||||
"codecov",
|
||||
"cofounder",
|
||||
"hashchange",
|
||||
"popstate",
|
||||
"hotpink",
|
||||
"navigations",
|
||||
"Collet's",
|
||||
"compat",
|
||||
"noimport",
|
||||
"tmpl",
|
||||
"concated",
|
||||
"contenthash",
|
||||
"contextifies",
|
||||
"crossorigin",
|
||||
"csvg",
|
||||
"repo",
|
||||
"repos",
|
||||
"triaging",
|
||||
"valign",
|
||||
"returnfalse",
|
||||
"return'development",
|
||||
"datastructures",
|
||||
"prewalking",
|
||||
"overridables",
|
||||
"overridable",
|
||||
"cujojs",
|
||||
"Dani",
|
||||
"darkblue",
|
||||
"darkgreen",
|
||||
"darkred",
|
||||
"eqeqeq",
|
||||
"boolish",
|
||||
"analysing",
|
||||
"etags",
|
||||
"datastructures",
|
||||
"declarators",
|
||||
"dedupe",
|
||||
"deduplicating",
|
||||
"deduplication",
|
||||
"defunctzombie",
|
||||
"deopt",
|
||||
"deopts",
|
||||
"dependabot",
|
||||
"Descr",
|
||||
"deserialization",
|
||||
"destructure",
|
||||
"onconnect",
|
||||
"nwjs",
|
||||
"redeclaration",
|
||||
"kaios",
|
||||
"parallelism",
|
||||
"gitattributes",
|
||||
"hashbang",
|
||||
|
||||
"webassemblyjs",
|
||||
"assemblyscript",
|
||||
"fsevents",
|
||||
"watchpack",
|
||||
"tapable",
|
||||
"junit",
|
||||
"memfs",
|
||||
"rimraf",
|
||||
"devtool",
|
||||
"devtools",
|
||||
"donotcallme",
|
||||
"endregion",
|
||||
"entrypoint",
|
||||
"entrypoints",
|
||||
"Eoksni",
|
||||
"eqeqeq",
|
||||
"errored",
|
||||
"esmodule",
|
||||
"estree",
|
||||
"posthtml",
|
||||
"etag",
|
||||
"etags",
|
||||
"eval",
|
||||
"Ewald",
|
||||
"exitance",
|
||||
"filebase",
|
||||
"fileoverview",
|
||||
"filepath",
|
||||
"finalizer",
|
||||
"finializer",
|
||||
"fsevents",
|
||||
"fullhash",
|
||||
"funcindex",
|
||||
"functype",
|
||||
"gcov",
|
||||
"gibibytes",
|
||||
"gitattributes",
|
||||
"gitter",
|
||||
"global's",
|
||||
"globstar",
|
||||
"gzipping",
|
||||
"hashable",
|
||||
"hashbang",
|
||||
"hashchange",
|
||||
"hashs",
|
||||
"hotpink",
|
||||
"hotupdatechunk",
|
||||
"ident",
|
||||
"idents",
|
||||
"IIFE's",
|
||||
"IIFE",
|
||||
"informations",
|
||||
"instanceof",
|
||||
"inversed",
|
||||
"jhnns",
|
||||
"jrburke",
|
||||
"jsfile",
|
||||
"jsons",
|
||||
"junit",
|
||||
"Junya",
|
||||
"kaios",
|
||||
"Kees",
|
||||
"kibibytes",
|
||||
"Kluskens",
|
||||
"Koppers",
|
||||
"laof",
|
||||
"Larkin",
|
||||
"lcov",
|
||||
"lcovonly",
|
||||
"lintunit",
|
||||
"loadername",
|
||||
"loglevel",
|
||||
"longnameforexport",
|
||||
"mangleable",
|
||||
"MCEP",
|
||||
"mebibytes",
|
||||
"medikoo",
|
||||
"membertest",
|
||||
"memfs",
|
||||
"mergeable",
|
||||
"metacharacters",
|
||||
"microtask",
|
||||
"microtasks",
|
||||
"middleware",
|
||||
"middlewares",
|
||||
"mimetype",
|
||||
"mixins",
|
||||
"modulehash",
|
||||
"moduleid",
|
||||
"modulos",
|
||||
"moji",
|
||||
"MONEI",
|
||||
"mult",
|
||||
"multiplicator",
|
||||
"mylibrary",
|
||||
"mynamespace",
|
||||
"navigations",
|
||||
"nmodule",
|
||||
"noimport",
|
||||
"nonexistentfile",
|
||||
"nonrecursive",
|
||||
"nosource",
|
||||
"nosources",
|
||||
"nwjs",
|
||||
"onconnect",
|
||||
"opencollective",
|
||||
"opensource",
|
||||
"opuuus",
|
||||
"overridable",
|
||||
"overridables",
|
||||
"parallelism",
|
||||
"passthrough",
|
||||
"pathinfo",
|
||||
"performant",
|
||||
"Phoscur",
|
||||
"pmodule",
|
||||
"pnpm",
|
||||
"polyfilled",
|
||||
"popstate",
|
||||
"posthtml",
|
||||
"precompute",
|
||||
"prefetch",
|
||||
"prefetched",
|
||||
"prefetching",
|
||||
"preload",
|
||||
"preloaded",
|
||||
"preloading",
|
||||
"preparsed",
|
||||
"prettierrc",
|
||||
"prewalking",
|
||||
"prioritise",
|
||||
"promisify",
|
||||
"quasis",
|
||||
"queryloader",
|
||||
"querystrings",
|
||||
"RBDT",
|
||||
"recurse",
|
||||
"redeclaration",
|
||||
"reexecuted",
|
||||
"referenceable",
|
||||
"referencer",
|
||||
"repo",
|
||||
"repos",
|
||||
"return'development",
|
||||
"returnfalse",
|
||||
"revparse",
|
||||
"rimraf",
|
||||
"Rivest",
|
||||
"rrrlll",
|
||||
"runtime",
|
||||
"runtimes",
|
||||
"samsunginternet",
|
||||
"sandboxed",
|
||||
"serializables",
|
||||
"serializer",
|
||||
"serializers",
|
||||
"shama",
|
||||
"skypack",
|
||||
"snapshotting",
|
||||
"sokra",
|
||||
"somepackage",
|
||||
"somepath",
|
||||
"sourcemap",
|
||||
"sourcemapped",
|
||||
"splitted",
|
||||
"stylesheet",
|
||||
"subdir",
|
||||
"subfolder",
|
||||
"submodule",
|
||||
"submodules",
|
||||
"subpath",
|
||||
"substack",
|
||||
"symlinked",
|
||||
"syncloader",
|
||||
"systemjs",
|
||||
"tapable",
|
||||
"templated",
|
||||
"templating",
|
||||
"testcase",
|
||||
"testlink",
|
||||
"testloader",
|
||||
"testvalue",
|
||||
"timestamping",
|
||||
"tmpl",
|
||||
"toplevel",
|
||||
"traceur",
|
||||
"atlaskit",
|
||||
"transpile",
|
||||
"transpiled",
|
||||
"transpiles",
|
||||
"transpiling",
|
||||
"triaging",
|
||||
"Tshs",
|
||||
"typechecker",
|
||||
"typeof",
|
||||
"ufeff",
|
||||
"uncacheable",
|
||||
"undefine",
|
||||
"undelayed",
|
||||
"unexception",
|
||||
"unoptimized",
|
||||
"unreviewed",
|
||||
"unshifted",
|
||||
"unsplittable",
|
||||
"untaint",
|
||||
"unusedkey",
|
||||
"unusedvalue",
|
||||
"url's",
|
||||
"valign",
|
||||
"valtype",
|
||||
"wasi",
|
||||
"wasm",
|
||||
"watchings",
|
||||
"watchpack",
|
||||
"webassembly",
|
||||
"webassemblyjs",
|
||||
"webmake",
|
||||
"webpack's",
|
||||
"webpack",
|
||||
"Xarray",
|
||||
"Xexports",
|
||||
"Xfactory",
|
||||
"Xmodule",
|
||||
"xxhash",
|
||||
"xxhashjs",
|
||||
"systemjs",
|
||||
"skypack",
|
||||
|
||||
"sokra",
|
||||
"Koppers",
|
||||
"Junya",
|
||||
"Eoksni",
|
||||
"Ewald",
|
||||
"Larkin",
|
||||
"Kees",
|
||||
"Kluskens",
|
||||
"Phoscur",
|
||||
"defunctzombie",
|
||||
"shama",
|
||||
"jhnns",
|
||||
"substack",
|
||||
"MONEI",
|
||||
"medikoo",
|
||||
"webmake",
|
||||
"jrburke",
|
||||
"gitter",
|
||||
"codecov",
|
||||
"opencollective",
|
||||
"dependabot",
|
||||
"browserslist",
|
||||
"samsunginternet",
|
||||
"pnpm"
|
||||
"Yann"
|
||||
],
|
||||
"ignoreRegExpList": [
|
||||
"/Author.+/",
|
||||
"/data:.*/",
|
||||
"/\"mappings\":\".+\"/",
|
||||
"/toMatchInlineSnapshot\\(\\s*`[^`]*`\\s*\\)/"
|
||||
],
|
||||
"ignoreRegExpList": ["/Author.+/", "/data:.*/", "/\"mappings\":\".+\"/"],
|
||||
"ignorePaths": [
|
||||
"**/dist/**",
|
||||
"examples/**/README.md",
|
||||
"**/webpack.lock.data/**"
|
||||
"**/webpack.lock.data/**",
|
||||
"package.json",
|
||||
"yarn.lock",
|
||||
"types.d.ts",
|
||||
"**/**/*.snap",
|
||||
"test/cases/json/weird-properties/globals.json",
|
||||
"**/*.svg",
|
||||
"*.log",
|
||||
"**/*.wasm",
|
||||
"coverage/**",
|
||||
"test/**/module.js",
|
||||
"test/js/**",
|
||||
"test/cases/**",
|
||||
"test/configCases/**",
|
||||
"test/statsCases/**",
|
||||
"test/fixtures/**"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ declare module "@webassemblyjs/ast" {
|
|||
raw?: string
|
||||
): FloatLiteral;
|
||||
export function global(globalType: string, nodes: Node[]): Global;
|
||||
export function identifier(indentifier: string): Identifier;
|
||||
export function identifier(identifier: string): Identifier;
|
||||
export function funcParam(valType: string, id: Identifier): FuncParam;
|
||||
export function instruction(inst: string, args?: Node[]): Instruction;
|
||||
export function callInstruction(funcIndex: Index): CallInstruction;
|
||||
|
|
|
@ -692,6 +692,15 @@ export type AssetGeneratorDataUrlFunction = (
|
|||
*/
|
||||
export type AssetGeneratorOptions = AssetInlineGeneratorOptions &
|
||||
AssetResourceGeneratorOptions;
|
||||
/**
|
||||
* Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
|
||||
*/
|
||||
export type AssetModuleOutputPath =
|
||||
| string
|
||||
| ((
|
||||
pathData: import("../lib/Compilation").PathData,
|
||||
assetInfo?: import("../lib/Compilation").AssetInfo
|
||||
) => string);
|
||||
/**
|
||||
* Function that executes for module and should return whenever asset should be inlined as DataUrl.
|
||||
*/
|
||||
|
@ -2705,6 +2714,10 @@ export interface AssetResourceGeneratorOptions {
|
|||
* Specifies the filename template of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
|
||||
*/
|
||||
filename?: FilenameTemplate;
|
||||
/**
|
||||
* Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
|
||||
*/
|
||||
outputPath?: AssetModuleOutputPath;
|
||||
/**
|
||||
* The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
|
||||
*/
|
||||
|
|
|
@ -208,7 +208,7 @@ module.exports = __webpack_require__.p + "89a353e9c515885abd8e.png";
|
|||
/******/ var links = document.getElementsByTagName("link");
|
||||
/******/ for(var i = 0; i < links.length; i++) {
|
||||
/******/ var l = links[i];
|
||||
/******/ if(l.href == url || l.getAttribute("href") == url || l.getAttribute("data-webpack") == uniqueName + ":" + key) { link = l; break; }
|
||||
/******/ if(l.rel == "stylesheet" && (l.href == url || l.getAttribute("href") == url || l.getAttribute("data-webpack") == uniqueName + ":" + key)) { link = l; break; }
|
||||
/******/ }
|
||||
/******/ if(!done) return link;
|
||||
/******/
|
||||
|
@ -233,6 +233,7 @@ module.exports = __webpack_require__.p + "89a353e9c515885abd8e.png";
|
|||
/******/ link.onerror = onLinkComplete.bind(null, link.onerror);
|
||||
/******/ link.onload = onLinkComplete.bind(null, link.onload);
|
||||
/******/ } else onLinkComplete(undefined, { type: 'load', target: link });
|
||||
/******/
|
||||
/******/ needAttach && document.head.appendChild(link);
|
||||
/******/ return link;
|
||||
/******/ };
|
||||
|
@ -486,12 +487,12 @@ head{--webpack-app-1:_7;}
|
|||
## Unoptimized
|
||||
|
||||
```
|
||||
assets by chunk 16.8 KiB (name: main)
|
||||
asset output.js 16.4 KiB [emitted] (name: main)
|
||||
assets by chunk 16.9 KiB (name: main)
|
||||
asset output.js 16.5 KiB [emitted] (name: main)
|
||||
asset output.css 385 bytes [emitted] (name: main)
|
||||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main)
|
||||
asset 1.output.css 49 bytes [emitted]
|
||||
Entrypoint main 16.8 KiB (14.6 KiB) = output.js 16.4 KiB output.css 385 bytes 1 auxiliary asset
|
||||
Entrypoint main 16.9 KiB (14.6 KiB) = output.js 16.5 KiB output.css 385 bytes 1 auxiliary asset
|
||||
chunk (runtime: main) output.js, output.css (main) 218 bytes (javascript) 335 bytes (css) 14.6 KiB (asset) 42 bytes (css-import) 10 KiB (runtime) [entry] [rendered]
|
||||
> ./example.js main
|
||||
runtime modules 10 KiB 9 modules
|
||||
|
@ -512,12 +513,12 @@ webpack 5.66.0 compiled successfully
|
|||
## Production mode
|
||||
|
||||
```
|
||||
assets by chunk 4.23 KiB (name: main)
|
||||
asset output.js 3.85 KiB [emitted] [minimized] (name: main)
|
||||
assets by chunk 4.25 KiB (name: main)
|
||||
asset output.js 3.87 KiB [emitted] [minimized] (name: main)
|
||||
asset output.css 385 bytes [emitted] (name: main)
|
||||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main)
|
||||
asset 159.output.css 53 bytes [emitted]
|
||||
Entrypoint main 4.23 KiB (14.6 KiB) = output.js 3.85 KiB output.css 385 bytes 1 auxiliary asset
|
||||
Entrypoint main 4.25 KiB (14.6 KiB) = output.js 3.87 KiB output.css 385 bytes 1 auxiliary asset
|
||||
chunk (runtime: main) 159.output.css 23 bytes
|
||||
> ./lazy-style.css ./example.js 4:0-26
|
||||
./lazy-style.css 23 bytes [built] [code generated]
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<!-- A spinner -->
|
||||
<div class="spinner"></div>
|
||||
|
||||
<!-- This script only contains boostrapping logic -->
|
||||
<!-- This script only contains bootstrapping logic -->
|
||||
<!-- It will load all other scripts if necessary -->
|
||||
<script src="/dist/aaa/app.js" async></script>
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ const {
|
|||
/**
|
||||
* @template T
|
||||
* @callback CallbackCache
|
||||
* @param {WebpackError=} err
|
||||
* @param {(WebpackError | null)=} err
|
||||
* @param {T=} result
|
||||
* @returns {void}
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ const mergeEtags = require("./cache/mergeEtags");
|
|||
/**
|
||||
* @template T
|
||||
* @callback CallbackCache
|
||||
* @param {WebpackError=} err
|
||||
* @param {(WebpackError | null)=} err
|
||||
* @param {T=} result
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -27,7 +27,7 @@ const mergeEtags = require("./cache/mergeEtags");
|
|||
/**
|
||||
* @template T
|
||||
* @callback CallbackNormalErrorCache
|
||||
* @param {Error=} err
|
||||
* @param {(Error | null)=} err
|
||||
* @param {T=} result
|
||||
* @returns {void}
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,7 @@ const validate = createSchemaValidation(
|
|||
* @param {OutputFileSystem} fs filesystem
|
||||
* @param {string} outputPath output path
|
||||
* @param {Set<string>} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator)
|
||||
* @param {function(Error=, Set<string>=): void} callback returns the filenames of the assets that shouldn't be there
|
||||
* @param {function((Error | null)=, Set<string>=): void} callback returns the filenames of the assets that shouldn't be there
|
||||
* @returns {void}
|
||||
*/
|
||||
const getDiffToFs = (fs, outputPath, currentAssets, callback) => {
|
||||
|
|
|
@ -116,34 +116,34 @@ const { isSourceEqual } = require("./util/source");
|
|||
|
||||
/**
|
||||
* @callback Callback
|
||||
* @param {WebpackError=} err
|
||||
* @param {(WebpackError | null)=} err
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback ModuleCallback
|
||||
* @param {WebpackError=} err
|
||||
* @param {(WebpackError | null)=} err
|
||||
* @param {Module=} result
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback ModuleFactoryResultCallback
|
||||
* @param {WebpackError=} err
|
||||
* @param {(WebpackError | null)=} err
|
||||
* @param {ModuleFactoryResult=} result
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback ModuleOrFactoryResultCallback
|
||||
* @param {WebpackError=} err
|
||||
* @param {(WebpackError | null)=} err
|
||||
* @param {Module | ModuleFactoryResult=} result
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback ExecuteModuleCallback
|
||||
* @param {WebpackError=} err
|
||||
* @param {(WebpackError | null)=} err
|
||||
* @param {ExecuteModuleResult=} result
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -1020,7 +1020,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|||
/** @type {Map<DepConstructor, ModuleFactory>} */
|
||||
this.dependencyFactories = new Map();
|
||||
/** @type {DependencyTemplates} */
|
||||
this.dependencyTemplates = new DependencyTemplates();
|
||||
this.dependencyTemplates = new DependencyTemplates(
|
||||
this.outputOptions.hashFunction
|
||||
);
|
||||
this.childrenCounters = {};
|
||||
/** @type {Set<number|string>} */
|
||||
this.usedChunkIds = null;
|
||||
|
@ -3553,10 +3555,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|||
}
|
||||
|
||||
/**
|
||||
* If `module` is passed, `loc` and `request` must also be passed.
|
||||
* @param {string | ChunkGroupOptions} groupOptions options for the chunk group
|
||||
* @param {Module} module the module the references the chunk group
|
||||
* @param {DependencyLocation} loc the location from with the chunk group is referenced (inside of module)
|
||||
* @param {string} request the request from which the the chunk group is referenced
|
||||
* @param {Module=} module the module the references the chunk group
|
||||
* @param {DependencyLocation=} loc the location from with the chunk group is referenced (inside of module)
|
||||
* @param {string=} request the request from which the the chunk group is referenced
|
||||
* @returns {ChunkGroup} the new or existing chunk group
|
||||
*/
|
||||
addChunkInGroup(groupOptions, module, loc, request) {
|
||||
|
|
|
@ -58,13 +58,13 @@ const { isSourceEqual } = require("./util/source");
|
|||
/**
|
||||
* @template T
|
||||
* @callback Callback
|
||||
* @param {Error=} err
|
||||
* @param {(Error | null)=} err
|
||||
* @param {T=} result
|
||||
*/
|
||||
|
||||
/**
|
||||
* @callback RunAsChildCallback
|
||||
* @param {Error=} err
|
||||
* @param {(Error | null)=} err
|
||||
* @param {Chunk[]=} entries
|
||||
* @param {Compilation=} compilation
|
||||
*/
|
||||
|
|
|
@ -71,7 +71,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|||
|
||||
/**
|
||||
* @callback ResolveDependenciesCallback
|
||||
* @param {Error=} err
|
||||
* @param {(Error | null)=} err
|
||||
* @param {ContextElementDependency[]=} dependencies
|
||||
*/
|
||||
|
||||
|
@ -149,12 +149,9 @@ class ContextModule extends Module {
|
|||
this.resolveDependencies = undefined;
|
||||
}
|
||||
|
||||
prettyRegExp(regexString) {
|
||||
// remove the "/" at the front and the beginning
|
||||
// "/foo/" -> "foo"
|
||||
return regexString
|
||||
.substring(1, regexString.length - 1)
|
||||
.replace(/!/g, "%21");
|
||||
_prettyRegExp(regexString, stripSlash = true) {
|
||||
const str = (regexString + "").replace(/!/g, "%21").replace(/\|/g, "%7C");
|
||||
return stripSlash ? str.substring(1, str.length - 1) : str;
|
||||
}
|
||||
|
||||
_createIdentifier() {
|
||||
|
@ -175,13 +172,19 @@ class ContextModule extends Module {
|
|||
identifier += `|${this.options.addon}`;
|
||||
}
|
||||
if (this.options.regExp) {
|
||||
identifier += `|${this.options.regExp}`;
|
||||
identifier += `|${this._prettyRegExp(this.options.regExp, false)}`;
|
||||
}
|
||||
if (this.options.include) {
|
||||
identifier += `|include: ${this.options.include}`;
|
||||
identifier += `|include: ${this._prettyRegExp(
|
||||
this.options.include,
|
||||
false
|
||||
)}`;
|
||||
}
|
||||
if (this.options.exclude) {
|
||||
identifier += `|exclude: ${this.options.exclude}`;
|
||||
identifier += `|exclude: ${this._prettyRegExp(
|
||||
this.options.exclude,
|
||||
false
|
||||
)}`;
|
||||
}
|
||||
if (this.options.referencedExports) {
|
||||
identifier += `|referencedExports: ${JSON.stringify(
|
||||
|
@ -231,13 +234,13 @@ class ContextModule extends Module {
|
|||
identifier += ` ${requestShortener.shorten(this.options.addon)}`;
|
||||
}
|
||||
if (this.options.regExp) {
|
||||
identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`;
|
||||
identifier += ` ${this._prettyRegExp(this.options.regExp)}`;
|
||||
}
|
||||
if (this.options.include) {
|
||||
identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
|
||||
identifier += ` include: ${this._prettyRegExp(this.options.include)}`;
|
||||
}
|
||||
if (this.options.exclude) {
|
||||
identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`;
|
||||
identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`;
|
||||
}
|
||||
if (this.options.referencedExports) {
|
||||
identifier += ` referencedExports: ${this.options.referencedExports
|
||||
|
@ -272,6 +275,7 @@ class ContextModule extends Module {
|
|||
this.context,
|
||||
options.associatedObjectForCache
|
||||
);
|
||||
if (this.layer) identifier = `(${this.layer})/${identifier}`;
|
||||
if (this.options.mode) {
|
||||
identifier += ` ${this.options.mode}`;
|
||||
}
|
||||
|
@ -286,13 +290,13 @@ class ContextModule extends Module {
|
|||
)}`;
|
||||
}
|
||||
if (this.options.regExp) {
|
||||
identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`;
|
||||
identifier += ` ${this._prettyRegExp(this.options.regExp)}`;
|
||||
}
|
||||
if (this.options.include) {
|
||||
identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
|
||||
identifier += ` include: ${this._prettyRegExp(this.options.include)}`;
|
||||
}
|
||||
if (this.options.exclude) {
|
||||
identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`;
|
||||
identifier += ` exclude: ${this._prettyRegExp(this.options.exclude)}`;
|
||||
}
|
||||
if (this.options.referencedExports) {
|
||||
identifier += ` referencedExports: ${this.options.referencedExports
|
||||
|
@ -312,7 +316,7 @@ class ContextModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild({ fileSystemInfo }, callback) {
|
||||
|
|
|
@ -91,7 +91,7 @@ class DelegatedModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -57,7 +57,7 @@ class DependencyTemplates {
|
|||
}
|
||||
|
||||
clone() {
|
||||
const newInstance = new DependencyTemplates();
|
||||
const newInstance = new DependencyTemplates(this._hashFunction);
|
||||
newInstance._map = new Map(this._map);
|
||||
newInstance._hash = this._hash;
|
||||
return newInstance;
|
||||
|
|
|
@ -96,7 +96,7 @@ class DllModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -432,7 +432,7 @@ class ExternalModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -117,7 +117,7 @@ class ExternalModuleFactoryPlugin {
|
|||
|
||||
/**
|
||||
* @param {Externals} externals externals config
|
||||
* @param {function(Error=, ExternalModule=): void} callback callback
|
||||
* @param {function((Error | null)=, ExternalModule=): void} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
const handleExternals = (externals, callback) => {
|
||||
|
|
|
@ -1185,7 +1185,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {string} path file path
|
||||
* @param {function(WebpackError=, (FileSystemInfoEntry | "ignore" | null)=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, (FileSystemInfoEntry | "ignore" | null)=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
getFileTimestamp(path, callback) {
|
||||
|
@ -1196,7 +1196,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {string} path context path
|
||||
* @param {function(WebpackError=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, (ResolvedContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
getContextTimestamp(path, callback) {
|
||||
|
@ -1217,7 +1217,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {string} path context path
|
||||
* @param {function(WebpackError=, (ContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, (ContextFileSystemInfoEntry | "ignore" | null)=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
_getUnresolvedContextTimestamp(path, callback) {
|
||||
|
@ -1228,7 +1228,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {string} path file path
|
||||
* @param {function(WebpackError=, string=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, string=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
getFileHash(path, callback) {
|
||||
|
@ -1239,7 +1239,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {string} path context path
|
||||
* @param {function(WebpackError=, string=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, string=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
getContextHash(path, callback) {
|
||||
|
@ -1259,7 +1259,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {string} path context path
|
||||
* @param {function(WebpackError=, ContextHash=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, ContextHash=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
_getUnresolvedContextHash(path, callback) {
|
||||
|
@ -1270,7 +1270,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {string} path context path
|
||||
* @param {function(WebpackError=, ResolvedContextTimestampAndHash=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, ResolvedContextTimestampAndHash=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
getContextTsh(path, callback) {
|
||||
|
@ -1290,7 +1290,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {string} path context path
|
||||
* @param {function(WebpackError=, ContextTimestampAndHash=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, ContextTimestampAndHash=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
_getUnresolvedContextTsh(path, callback) {
|
||||
|
@ -1330,7 +1330,7 @@ class FileSystemInfo {
|
|||
/**
|
||||
* @param {string} context context directory
|
||||
* @param {Iterable<string>} deps dependencies
|
||||
* @param {function(Error=, ResolveBuildDependenciesResult=): void} callback callback function
|
||||
* @param {function((Error | null)=, ResolveBuildDependenciesResult=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
resolveBuildDependencies(context, deps, callback) {
|
||||
|
@ -1798,7 +1798,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {Map<string, string | false>} resolveResults results from resolving
|
||||
* @param {function(Error=, boolean=): void} callback callback with true when resolveResults resolve the same way
|
||||
* @param {function((Error | null)=, boolean=): void} callback callback with true when resolveResults resolve the same way
|
||||
* @returns {void}
|
||||
*/
|
||||
checkResolveResultsValid(resolveResults, callback) {
|
||||
|
@ -1880,7 +1880,7 @@ class FileSystemInfo {
|
|||
* @param {Object} options options object (for future extensions)
|
||||
* @param {boolean=} options.hash should use hash to snapshot
|
||||
* @param {boolean=} options.timestamp should use timestamp to snapshot
|
||||
* @param {function(WebpackError=, Snapshot=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, (Snapshot | null)=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
createSnapshot(startTime, files, directories, missing, options, callback) {
|
||||
|
@ -2379,7 +2379,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {Snapshot} snapshot the snapshot made
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
checkSnapshotValid(snapshot, callback) {
|
||||
|
@ -2399,7 +2399,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {Snapshot} snapshot the snapshot made
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
_checkSnapshotValidNoCache(snapshot, callback) {
|
||||
|
@ -2948,7 +2948,7 @@ class FileSystemInfo {
|
|||
* @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromFile called when context item is a file
|
||||
* @param {function(string, IStats, function(Error=, ItemType=): void): void} options.fromDirectory called when context item is a directory
|
||||
* @param {function(string[], ItemType[]): T} options.reduce called from all context items
|
||||
* @param {function(Error=, (T)=): void} callback callback
|
||||
* @param {function((Error | null)=, (T)=): void} callback callback
|
||||
*/
|
||||
_readContext(
|
||||
{
|
||||
|
@ -3131,7 +3131,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {ContextFileSystemInfoEntry} entry entry
|
||||
* @param {function(Error=, ResolvedContextFileSystemInfoEntry=): void} callback callback
|
||||
* @param {function((Error | null)=, ResolvedContextFileSystemInfoEntry=): void} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
_resolveContextTimestamp(entry, callback) {
|
||||
|
@ -3239,7 +3239,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {ContextHash} entry context hash
|
||||
* @param {function(Error=, string=): void} callback callback
|
||||
* @param {function((Error | null)=, string=): void} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
_resolveContextHash(entry, callback) {
|
||||
|
@ -3395,7 +3395,7 @@ class FileSystemInfo {
|
|||
|
||||
/**
|
||||
* @param {ContextTimestampAndHash} entry entry
|
||||
* @param {function(Error=, ResolvedContextTimestampAndHash=): void} callback callback
|
||||
* @param {function((Error | null)=, ResolvedContextTimestampAndHash=): void} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
_resolveContextTsh(entry, callback) {
|
||||
|
|
|
@ -51,7 +51,7 @@ module.exports.makeWebpackError = makeWebpackError;
|
|||
|
||||
/**
|
||||
* @template T
|
||||
* @param {function(WebpackError=, T=): void} callback webpack error callback
|
||||
* @param {function((WebpackError | null)=, T=): void} callback webpack error callback
|
||||
* @param {string} hook name of hook
|
||||
* @returns {Callback<T>} generic callback
|
||||
*/
|
||||
|
|
|
@ -691,7 +691,7 @@ class Module extends DependenciesBlock {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -27,7 +27,7 @@ const ArrayQueue = require("./util/ArrayQueue");
|
|||
/**
|
||||
* @template T
|
||||
* @callback Callback
|
||||
* @param {Error=} err
|
||||
* @param {(Error | null)=} err
|
||||
* @param {T=} result
|
||||
*/
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ const asyncLib = require("neo-async");
|
|||
/**
|
||||
* @template T
|
||||
* @callback Callback
|
||||
* @param {Error=} err
|
||||
* @param {(Error | null)=} err
|
||||
* @param {T=} result
|
||||
*/
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ class NormalModule extends Module {
|
|||
}
|
||||
|
||||
// Info from Build
|
||||
/** @type {WebpackError=} */
|
||||
/** @type {(WebpackError | null)=} */
|
||||
this.error = null;
|
||||
/** @private @type {Source=} */
|
||||
this._source = null;
|
||||
|
@ -355,11 +355,13 @@ class NormalModule extends Module {
|
|||
* @returns {string | null} an identifier for library inclusion
|
||||
*/
|
||||
libIdent(options) {
|
||||
return contextify(
|
||||
let ident = contextify(
|
||||
options.context,
|
||||
this.userRequest,
|
||||
options.associatedObjectForCache
|
||||
);
|
||||
if (this.layer) ident = `(${this.layer})/${ident}`;
|
||||
return ident;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -730,7 +732,7 @@ class NormalModule extends Module {
|
|||
* @param {ResolverWithOptions} resolver the resolver
|
||||
* @param {InputFileSystem} fs the file system
|
||||
* @param {NormalModuleCompilationHooks} hooks the hooks
|
||||
* @param {function(WebpackError=): void} callback callback function
|
||||
* @param {function((WebpackError | null)=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
_doBuild(options, compilation, resolver, fs, hooks, callback) {
|
||||
|
@ -1236,7 +1238,7 @@ class NormalModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -74,7 +74,7 @@ class RawModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -78,7 +78,7 @@ class RuntimeModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -15,7 +15,7 @@ const Stats = require("./Stats");
|
|||
/**
|
||||
* @template T
|
||||
* @callback Callback
|
||||
* @param {Error=} err
|
||||
* @param {(Error | null)=} err
|
||||
* @param {T=} result
|
||||
*/
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ const { makePathsRelative } = require("../util/identifier");
|
|||
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").AssetGeneratorOptions} AssetGeneratorOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").AssetModuleOutputPath} AssetModuleOutputPath */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").RawPublicPath} RawPublicPath */
|
||||
/** @typedef {import("../Compilation")} Compilation */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
|
@ -74,6 +75,41 @@ const mergeRelatedInfo = (a, b) => {
|
|||
return result;
|
||||
};
|
||||
|
||||
const encodeDataUri = (encoding, source) => {
|
||||
let encodedContent;
|
||||
|
||||
switch (encoding) {
|
||||
case "base64": {
|
||||
encodedContent = source.buffer().toString("base64");
|
||||
break;
|
||||
}
|
||||
case false: {
|
||||
const content = source.source();
|
||||
|
||||
if (typeof content !== "string") {
|
||||
encodedContent = content.toString("utf-8");
|
||||
}
|
||||
|
||||
encodedContent = encodeURIComponent(encodedContent).replace(
|
||||
/[!'()*]/g,
|
||||
character => "%" + character.codePointAt(0).toString(16)
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new Error(`Unsupported encoding '${encoding}'`);
|
||||
}
|
||||
|
||||
return encodedContent;
|
||||
};
|
||||
|
||||
const decodeDataUriContent = (encoding, content) => {
|
||||
const isBase64 = encoding === "base64";
|
||||
return isBase64
|
||||
? Buffer.from(content, "base64")
|
||||
: Buffer.from(decodeURIComponent(content), "ascii");
|
||||
};
|
||||
|
||||
const JS_TYPES = new Set(["javascript"]);
|
||||
const JS_AND_ASSET_TYPES = new Set(["javascript", "asset"]);
|
||||
|
||||
|
@ -82,13 +118,15 @@ class AssetGenerator extends Generator {
|
|||
* @param {AssetGeneratorOptions["dataUrl"]=} dataUrlOptions the options for the data url
|
||||
* @param {string=} filename override for output.assetModuleFilename
|
||||
* @param {RawPublicPath=} publicPath override for output.assetModulePublicPath
|
||||
* @param {AssetModuleOutputPath=} outputPath the output path for the emitted file which is not included in the runtime import
|
||||
* @param {boolean=} emit generate output asset
|
||||
*/
|
||||
constructor(dataUrlOptions, filename, publicPath, emit) {
|
||||
constructor(dataUrlOptions, filename, publicPath, outputPath, emit) {
|
||||
super();
|
||||
this.dataUrlOptions = dataUrlOptions;
|
||||
this.filename = filename;
|
||||
this.publicPath = publicPath;
|
||||
this.outputPath = outputPath;
|
||||
this.emit = emit;
|
||||
}
|
||||
|
||||
|
@ -158,33 +196,18 @@ class AssetGenerator extends Generator {
|
|||
}
|
||||
|
||||
let encodedContent;
|
||||
|
||||
if (
|
||||
module.resourceResolveData &&
|
||||
module.resourceResolveData.encoding === encoding
|
||||
module.resourceResolveData.encoding === encoding &&
|
||||
decodeDataUriContent(
|
||||
module.resourceResolveData.encoding,
|
||||
module.resourceResolveData.encodedContent
|
||||
).equals(originalSource.buffer())
|
||||
) {
|
||||
encodedContent = module.resourceResolveData.encodedContent;
|
||||
} else {
|
||||
switch (encoding) {
|
||||
case "base64": {
|
||||
encodedContent = originalSource.buffer().toString("base64");
|
||||
break;
|
||||
}
|
||||
case false: {
|
||||
const content = originalSource.source();
|
||||
|
||||
if (typeof content !== "string") {
|
||||
encodedContent = content.toString("utf-8");
|
||||
}
|
||||
|
||||
encodedContent = encodeURIComponent(encodedContent).replace(
|
||||
/[!'()*]/g,
|
||||
character => "%" + character.codePointAt(0).toString(16)
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new Error(`Unsupported encoding '${encoding}'`);
|
||||
}
|
||||
encodedContent = encodeDataUri(encoding, originalSource);
|
||||
}
|
||||
|
||||
encodedSource = `data:${mimeType}${
|
||||
|
@ -256,6 +279,21 @@ class AssetGenerator extends Generator {
|
|||
sourceFilename,
|
||||
...assetInfo
|
||||
};
|
||||
if (this.outputPath) {
|
||||
const { path: outputPath, info } =
|
||||
runtimeTemplate.compilation.getAssetPathWithInfo(
|
||||
this.outputPath,
|
||||
{
|
||||
module,
|
||||
runtime,
|
||||
filename: sourceFilename,
|
||||
chunkGraph,
|
||||
contentHash
|
||||
}
|
||||
);
|
||||
assetInfo = mergeAssetInfo(assetInfo, info);
|
||||
filename = path.posix.join(outputPath, filename);
|
||||
}
|
||||
module.buildInfo.filename = filename;
|
||||
module.buildInfo.assetInfo = assetInfo;
|
||||
if (getData) {
|
||||
|
|
|
@ -137,9 +137,11 @@ class AssetModulesPlugin {
|
|||
|
||||
let filename = undefined;
|
||||
let publicPath = undefined;
|
||||
let outputPath = undefined;
|
||||
if (type !== "asset/inline") {
|
||||
filename = generatorOptions.filename;
|
||||
publicPath = generatorOptions.publicPath;
|
||||
outputPath = generatorOptions.outputPath;
|
||||
}
|
||||
|
||||
const AssetGenerator = getAssetGenerator();
|
||||
|
@ -148,6 +150,7 @@ class AssetModulesPlugin {
|
|||
dataUrl,
|
||||
filename,
|
||||
publicPath,
|
||||
outputPath,
|
||||
generatorOptions.emit !== false
|
||||
);
|
||||
});
|
||||
|
|
|
@ -69,7 +69,7 @@ class RawDataUrlModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -106,7 +106,7 @@ class ResolverCachePlugin {
|
|||
* @param {Resolver} resolver the resolver
|
||||
* @param {Object} resolveContext context for resolving meta info
|
||||
* @param {Object} request the request info object
|
||||
* @param {function(Error=, Object=): void} callback callback function
|
||||
* @param {function((Error | null)=, Object=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
const doRealResolve = (
|
||||
|
|
47
lib/cli.js
47
lib/cli.js
|
@ -37,6 +37,7 @@ const webpackSchema = require("../schemas/WebpackOptions.json");
|
|||
/**
|
||||
* @typedef {Object} ArgumentConfig
|
||||
* @property {string} description
|
||||
* @property {string} [negatedDescription]
|
||||
* @property {string} path
|
||||
* @property {boolean} multiple
|
||||
* @property {"enum"|"string"|"path"|"number"|"boolean"|"RegExp"|"reset"} type
|
||||
|
@ -96,11 +97,42 @@ const getArguments = (schema = webpackSchema) => {
|
|||
*/
|
||||
const getDescription = path => {
|
||||
for (const { schema } of path) {
|
||||
if (schema.cli && schema.cli.helper) continue;
|
||||
if (schema.cli) {
|
||||
if (schema.cli.helper) continue;
|
||||
if (schema.cli.description) return schema.cli.description;
|
||||
}
|
||||
if (schema.description) return schema.description;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {PathItem[]} path path in the schema
|
||||
* @returns {string | undefined} negative description
|
||||
*/
|
||||
const getNegatedDescription = path => {
|
||||
for (const { schema } of path) {
|
||||
if (schema.cli) {
|
||||
if (schema.cli.helper) continue;
|
||||
if (schema.cli.negatedDescription) return schema.cli.negatedDescription;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {PathItem[]} path path in the schema
|
||||
* @returns {string | undefined} reset description
|
||||
*/
|
||||
const getResetDescription = path => {
|
||||
for (const { schema } of path) {
|
||||
if (schema.cli) {
|
||||
if (schema.cli.helper) continue;
|
||||
if (schema.cli.resetDescription) return schema.cli.resetDescription;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {any} schemaPart schema
|
||||
|
@ -142,13 +174,17 @@ const getArguments = (schema = webpackSchema) => {
|
|||
const addResetFlag = path => {
|
||||
const schemaPath = path[0].path;
|
||||
const name = pathToArgumentName(`${schemaPath}.reset`);
|
||||
const description = getDescription(path);
|
||||
const description =
|
||||
getResetDescription(path) ||
|
||||
`Clear all items provided in '${schemaPath}' configuration. ${getDescription(
|
||||
path
|
||||
)}`;
|
||||
flags[name] = {
|
||||
configs: [
|
||||
{
|
||||
type: "reset",
|
||||
multiple: false,
|
||||
description: `Clear all items provided in '${schemaPath}' configuration. ${description}`,
|
||||
description,
|
||||
path: schemaPath
|
||||
}
|
||||
],
|
||||
|
@ -167,6 +203,7 @@ const getArguments = (schema = webpackSchema) => {
|
|||
const argConfigBase = schemaToArgumentConfig(path[0].schema);
|
||||
if (!argConfigBase) return 0;
|
||||
|
||||
const negatedDescription = getNegatedDescription(path);
|
||||
const name = pathToArgumentName(path[0].path);
|
||||
/** @type {ArgumentConfig} */
|
||||
const argConfig = {
|
||||
|
@ -176,6 +213,10 @@ const getArguments = (schema = webpackSchema) => {
|
|||
path: path[0].path
|
||||
};
|
||||
|
||||
if (negatedDescription) {
|
||||
argConfig.negatedDescription = negatedDescription;
|
||||
}
|
||||
|
||||
if (!flags[name]) {
|
||||
flags[name] = {
|
||||
configs: [],
|
||||
|
|
|
@ -297,6 +297,8 @@ const getNormalizedWebpackOptions = config => {
|
|||
chunkLoading: output.chunkLoading,
|
||||
chunkLoadingGlobal: output.chunkLoadingGlobal,
|
||||
chunkLoadTimeout: output.chunkLoadTimeout,
|
||||
cssFilename: output.cssFilename,
|
||||
cssChunkFilename: output.cssChunkFilename,
|
||||
clean: output.clean,
|
||||
compareBeforeEmit: output.compareBeforeEmit,
|
||||
crossOriginLoading: output.crossOriginLoading,
|
||||
|
|
|
@ -79,12 +79,14 @@ class ContainerEntryModule extends Module {
|
|||
* @returns {string | null} an identifier for library inclusion
|
||||
*/
|
||||
libIdent(options) {
|
||||
return `webpack/container/entry/${this._name}`;
|
||||
return `${this.layer ? `(${this.layer})/` : ""}webpack/container/entry/${
|
||||
this._name
|
||||
}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -60,9 +60,9 @@ class FallbackModule extends Module {
|
|||
* @returns {string | null} an identifier for library inclusion
|
||||
*/
|
||||
libIdent(options) {
|
||||
return `webpack/container/fallback/${this.requests[0]}/and ${
|
||||
this.requests.length - 1
|
||||
} more`;
|
||||
return `${this.layer ? `(${this.layer})/` : ""}webpack/container/fallback/${
|
||||
this.requests[0]
|
||||
}/and ${this.requests.length - 1} more`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,7 @@ class FallbackModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -67,12 +67,14 @@ class RemoteModule extends Module {
|
|||
* @returns {string | null} an identifier for library inclusion
|
||||
*/
|
||||
libIdent(options) {
|
||||
return `webpack/container/remote/${this.request}`;
|
||||
return `${this.layer ? `(${this.layer})/` : ""}webpack/container/remote/${
|
||||
this.request
|
||||
}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -216,7 +216,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
"for(var i = 0; i < links.length; i++) {",
|
||||
Template.indent([
|
||||
"var l = links[i];",
|
||||
`if(${
|
||||
`if(l.rel == "stylesheet" && (${
|
||||
withHmr
|
||||
? 'l.href.startsWith(url) || l.getAttribute("href").startsWith(url)'
|
||||
: 'l.href == url || l.getAttribute("href") == url'
|
||||
|
@ -224,7 +224,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
uniqueName
|
||||
? ' || l.getAttribute("data-webpack") == uniqueName + ":" + key'
|
||||
: ""
|
||||
}) { link = l; break; }`
|
||||
})) { link = l; break; }`
|
||||
]),
|
||||
"}",
|
||||
"if(!done) return link;",
|
||||
|
@ -253,6 +253,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
"link.onload = onLinkComplete.bind(null, link.onload);"
|
||||
]),
|
||||
"} else onLinkComplete(undefined, { type: 'load', target: link });", // We assume any existing stylesheet is render blocking
|
||||
withHmr ? "hmr ? document.head.insertBefore(link, hmr) :" : "",
|
||||
"needAttach && document.head.appendChild(link);",
|
||||
"return link;"
|
||||
]
|
||||
|
@ -433,7 +434,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|||
]),
|
||||
"}"
|
||||
]
|
||||
)}, true);`
|
||||
)}, oldTag);`
|
||||
]
|
||||
)}));`
|
||||
])});`
|
||||
|
|
|
@ -123,9 +123,7 @@ class Profiler {
|
|||
* @returns {Trace} The trace object
|
||||
*/
|
||||
const createTrace = (fs, outputPath) => {
|
||||
const trace = new Tracer({
|
||||
noStream: true
|
||||
});
|
||||
const trace = new Tracer();
|
||||
const profiler = new Profiler(inspector);
|
||||
if (/\/|\\/.test(outputPath)) {
|
||||
const dirPath = dirname(fs, outputPath);
|
||||
|
@ -173,6 +171,7 @@ const createTrace = (fs, outputPath) => {
|
|||
counter,
|
||||
profiler,
|
||||
end: callback => {
|
||||
trace.push("]");
|
||||
// Wait until the write stream finishes.
|
||||
fsStream.on("close", () => {
|
||||
callback();
|
||||
|
@ -242,10 +241,10 @@ class ProfilingPlugin {
|
|||
stage: Infinity
|
||||
},
|
||||
(stats, callback) => {
|
||||
if (compiler.watchMode) return callback();
|
||||
tracer.profiler.stopProfiling().then(parsedResults => {
|
||||
if (parsedResults === undefined) {
|
||||
tracer.profiler.destroy();
|
||||
tracer.trace.flush();
|
||||
tracer.end(callback);
|
||||
return;
|
||||
}
|
||||
|
@ -293,7 +292,6 @@ class ProfilingPlugin {
|
|||
});
|
||||
|
||||
tracer.profiler.destroy();
|
||||
tracer.trace.flush();
|
||||
tracer.end(callback);
|
||||
});
|
||||
}
|
||||
|
@ -346,11 +344,15 @@ const interceptAllJavascriptModulesPluginHooks = (compilation, tracer) => {
|
|||
|
||||
const makeInterceptorFor = (instance, tracer) => hookName => ({
|
||||
register: ({ name, type, context, fn }) => {
|
||||
const newFn = makeNewProfiledTapFn(hookName, tracer, {
|
||||
name,
|
||||
type,
|
||||
fn
|
||||
});
|
||||
const newFn =
|
||||
// Don't tap our own hooks to ensure stream can close cleanly
|
||||
name === pluginName
|
||||
? fn
|
||||
: makeNewProfiledTapFn(hookName, tracer, {
|
||||
name,
|
||||
type,
|
||||
fn
|
||||
});
|
||||
return {
|
||||
name,
|
||||
type,
|
||||
|
|
|
@ -25,6 +25,18 @@ class CreateScriptUrlDependency extends NullDependency {
|
|||
get type() {
|
||||
return "create script url";
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const { write } = context;
|
||||
write(this.range);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
const { read } = context;
|
||||
this.range = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
CreateScriptUrlDependency.Template = class CreateScriptUrlDependencyTemplate extends (
|
||||
|
|
|
@ -16,7 +16,7 @@ const LoaderImportDependency = require("./LoaderImportDependency");
|
|||
|
||||
/**
|
||||
* @callback LoadModuleCallback
|
||||
* @param {Error=} err error object
|
||||
* @param {(Error | null)=} err error object
|
||||
* @param {string | Buffer=} source source code
|
||||
* @param {object=} map source map
|
||||
* @param {Module=} module loaded module if successful
|
||||
|
@ -24,7 +24,7 @@ const LoaderImportDependency = require("./LoaderImportDependency");
|
|||
|
||||
/**
|
||||
* @callback ImportModuleCallback
|
||||
* @param {Error=} err error object
|
||||
* @param {(Error | null)=} err error object
|
||||
* @param {any=} exports exports of the evaluated module
|
||||
*/
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ const { registerNotSerializable } = require("../util/serialization");
|
|||
/** @typedef {import("../RequestShortener")} RequestShortener */
|
||||
/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
||||
/** @typedef {import("../WebpackError")} WebpackError */
|
||||
/** @typedef {import("../dependencies/HarmonyImportDependency")} HarmonyImportDependency */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
||||
|
||||
|
@ -38,7 +39,7 @@ const { registerNotSerializable } = require("../util/serialization");
|
|||
* @property {function(Module): { client: string, data: string, active: boolean }} module
|
||||
*/
|
||||
|
||||
const IGNORED_DEPENDENCY_TYPES = new Set([
|
||||
const HMR_DEPENDENCY_TYPES = new Set([
|
||||
"import.meta.webpackHot.accept",
|
||||
"import.meta.webpackHot.decline",
|
||||
"module.hot.accept",
|
||||
|
@ -146,7 +147,7 @@ class LazyCompilationProxyModule extends Module {
|
|||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
@ -351,32 +352,55 @@ class LazyCompilationPlugin {
|
|||
"LazyCompilationPlugin",
|
||||
(originalModule, createData, resolveData) => {
|
||||
if (
|
||||
resolveData.dependencies.every(
|
||||
resolveData.dependencies.every(dep =>
|
||||
HMR_DEPENDENCY_TYPES.has(dep.type)
|
||||
)
|
||||
) {
|
||||
// for HMR only resolving, try to determine if the HMR accept/decline refers to
|
||||
// an import() or not
|
||||
const hmrDep = resolveData.dependencies[0];
|
||||
const originModule =
|
||||
compilation.moduleGraph.getParentModule(hmrDep);
|
||||
const isReferringToDynamicImport = originModule.blocks.some(
|
||||
block =>
|
||||
block.dependencies.some(
|
||||
dep =>
|
||||
dep.type === "import()" &&
|
||||
/** @type {HarmonyImportDependency} */ (dep).request ===
|
||||
hmrDep.request
|
||||
)
|
||||
);
|
||||
if (!isReferringToDynamicImport) return;
|
||||
} else if (
|
||||
!resolveData.dependencies.every(
|
||||
dep =>
|
||||
IGNORED_DEPENDENCY_TYPES.has(dep.type) ||
|
||||
HMR_DEPENDENCY_TYPES.has(dep.type) ||
|
||||
(this.imports &&
|
||||
(dep.type === "import()" ||
|
||||
dep.type === "import() context element")) ||
|
||||
(this.entries && dep.type === "entry")
|
||||
) &&
|
||||
!/webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client|webpack-hot-middleware[/\\]client/.test(
|
||||
)
|
||||
)
|
||||
return;
|
||||
if (
|
||||
/webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client|webpack-hot-middleware[/\\]client/.test(
|
||||
resolveData.request
|
||||
) &&
|
||||
checkTest(this.test, originalModule)
|
||||
) {
|
||||
const moduleInfo = backend.module(originalModule);
|
||||
if (!moduleInfo) return;
|
||||
const { client, data, active } = moduleInfo;
|
||||
) ||
|
||||
!checkTest(this.test, originalModule)
|
||||
)
|
||||
return;
|
||||
const moduleInfo = backend.module(originalModule);
|
||||
if (!moduleInfo) return;
|
||||
const { client, data, active } = moduleInfo;
|
||||
|
||||
return new LazyCompilationProxyModule(
|
||||
compiler.context,
|
||||
originalModule,
|
||||
resolveData.request,
|
||||
client,
|
||||
data,
|
||||
active
|
||||
);
|
||||
}
|
||||
return new LazyCompilationProxyModule(
|
||||
compiler.context,
|
||||
originalModule,
|
||||
resolveData.request,
|
||||
client,
|
||||
data,
|
||||
active
|
||||
);
|
||||
}
|
||||
);
|
||||
compilation.dependencyFactories.set(
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
/**
|
||||
* @callback BackendHandler
|
||||
* @param {Compiler} compiler compiler
|
||||
* @param {function(Error?, any?): void} callback callback
|
||||
* @param {function((Error | null)=, any=): void} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
|
|
|
@ -1708,7 +1708,7 @@ ${defineGetters}`
|
|||
info.globalScope = globalScope;
|
||||
info.moduleScope = moduleScope;
|
||||
} catch (err) {
|
||||
err.message += `\nwhile analysing module ${m.identifier()} for concatenation`;
|
||||
err.message += `\nwhile analyzing module ${m.identifier()} for concatenation`;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ class Lockfile {
|
|||
/**
|
||||
* @template R
|
||||
* @param {function(function(Error=, R=): void): void} fn function
|
||||
* @returns {function(function(Error=, R=): void): void} cached function
|
||||
* @returns {function(function((Error | null)=, R=): void): void} cached function
|
||||
*/
|
||||
const cachedWithoutKey = fn => {
|
||||
let inFlight = false;
|
||||
|
@ -201,10 +201,10 @@ const cachedWithoutKey = fn => {
|
|||
* @template R
|
||||
* @param {function(T, function(Error=, R=): void): void} fn function
|
||||
* @param {function(T, function(Error=, R=): void): void=} forceFn function for the second try
|
||||
* @returns {(function(T, function(Error=, R=): void): void) & { force: function(T, function(Error=, R=): void): void }} cached function
|
||||
* @returns {(function(T, function((Error | null)=, R=): void): void) & { force: function(T, function((Error | null)=, R=): void): void }} cached function
|
||||
*/
|
||||
const cachedWithKey = (fn, forceFn = fn) => {
|
||||
/** @typedef {{ result?: R, error?: Error, callbacks?: (function(Error=, R=): void)[], force?: true }} CacheEntry */
|
||||
/** @typedef {{ result?: R, error?: Error, callbacks?: (function((Error | null)=, R=): void)[], force?: true }} CacheEntry */
|
||||
/** @type {Map<T, CacheEntry>} */
|
||||
const cache = new Map();
|
||||
const resultFn = (arg, callback) => {
|
||||
|
@ -358,7 +358,7 @@ class HttpUriPlugin {
|
|||
|
||||
const getLockfile = cachedWithoutKey(
|
||||
/**
|
||||
* @param {function(Error=, Lockfile=): void} callback callback
|
||||
* @param {function((Error | null)=, Lockfile=): void} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
callback => {
|
||||
|
@ -465,7 +465,7 @@ class HttpUriPlugin {
|
|||
*
|
||||
* @param {string} url URL
|
||||
* @param {string} integrity integrity
|
||||
* @param {function(Error=, { entry: LockfileEntry, content: Buffer, storeLock: boolean }=): void} callback callback
|
||||
* @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer, storeLock: boolean }=): void} callback callback
|
||||
*/
|
||||
const resolveContent = (url, integrity, callback) => {
|
||||
const handleResult = (err, result) => {
|
||||
|
@ -510,7 +510,7 @@ class HttpUriPlugin {
|
|||
/**
|
||||
* @param {string} url URL
|
||||
* @param {FetchResult} cachedResult result from cache
|
||||
* @param {function(Error=, FetchResult=): void} callback callback
|
||||
* @param {function((Error | null)=, FetchResult=): void} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
const fetchContentRaw = (url, cachedResult, callback) => {
|
||||
|
@ -662,7 +662,7 @@ class HttpUriPlugin {
|
|||
const fetchContent = cachedWithKey(
|
||||
/**
|
||||
* @param {string} url URL
|
||||
* @param {function(Error=, { validUntil: number, etag?: string, entry: LockfileEntry, content: Buffer, fresh: boolean } | { validUntil: number, etag?: string, location: string, fresh: boolean }=): void} callback callback
|
||||
* @param {function((Error | null)=, { validUntil: number, etag?: string, entry: LockfileEntry, content: Buffer, fresh: boolean } | { validUntil: number, etag?: string, location: string, fresh: boolean }=): void} callback callback
|
||||
* @returns {void}
|
||||
*/ (url, callback) => {
|
||||
cache.get(url, null, (err, cachedResult) => {
|
||||
|
@ -693,7 +693,7 @@ class HttpUriPlugin {
|
|||
const getInfo = cachedWithKey(
|
||||
/**
|
||||
* @param {string} url the url
|
||||
* @param {function(Error=, { entry: LockfileEntry, content: Buffer }=): void} callback callback
|
||||
* @param {function((Error | null)=, { entry: LockfileEntry, content: Buffer }=): void} callback callback
|
||||
* @returns {void}
|
||||
*/
|
||||
(url, callback) => {
|
||||
|
|
|
@ -101,14 +101,16 @@ class ConsumeSharedModule extends Module {
|
|||
*/
|
||||
libIdent(options) {
|
||||
const { shareKey, shareScope, import: request } = this.options;
|
||||
return `webpack/sharing/consume/${shareScope}/${shareKey}${
|
||||
return `${
|
||||
this.layer ? `(${this.layer})/` : ""
|
||||
}webpack/sharing/consume/${shareScope}/${shareKey}${
|
||||
request ? `/${request}` : ""
|
||||
}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -67,12 +67,14 @@ class ProvideSharedModule extends Module {
|
|||
* @returns {string | null} an identifier for library inclusion
|
||||
*/
|
||||
libIdent(options) {
|
||||
return `webpack/sharing/provide/${this._shareScope}/${this._name}`;
|
||||
return `${this.layer ? `(${this.layer})/` : ""}webpack/sharing/provide/${
|
||||
this._shareScope
|
||||
}/${this._name}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
|
|
|
@ -22,7 +22,7 @@ exports.isRequiredVersion = str => {
|
|||
* @param {InputFileSystem} fs file system
|
||||
* @param {string} directory directory to start looking into
|
||||
* @param {string[]} descriptionFiles possible description filenames
|
||||
* @param {function(Error=, {data: object, path: string}=): void} callback callback
|
||||
* @param {function((Error | null)=, {data: object, path: string}=): void} callback callback
|
||||
*/
|
||||
const getDescriptionFile = (fs, directory, descriptionFiles, callback) => {
|
||||
let i = 0;
|
||||
|
|
|
@ -1658,84 +1658,121 @@ const collapse = children => {
|
|||
return newChildren;
|
||||
};
|
||||
|
||||
const spaceLimited = (itemsAndGroups, max) => {
|
||||
const spaceLimited = (
|
||||
itemsAndGroups,
|
||||
max,
|
||||
filteredChildrenLineReserved = false
|
||||
) => {
|
||||
if (max < 1) {
|
||||
return {
|
||||
children: undefined,
|
||||
filteredChildren: getTotalItems(itemsAndGroups)
|
||||
};
|
||||
}
|
||||
/** @type {any[] | undefined} */
|
||||
let children = undefined;
|
||||
/** @type {number | undefined} */
|
||||
let filteredChildren = undefined;
|
||||
// This are the groups, which take 1+ lines each
|
||||
const groups = itemsAndGroups.filter(c => c.children || c.filteredChildren);
|
||||
const groups = [];
|
||||
// The sizes of the groups are stored in groupSizes
|
||||
const groupSizes = groups.map(g => getItemSize(g));
|
||||
const groupSizes = [];
|
||||
// This are the items, which take 1 line each
|
||||
const items = itemsAndGroups.filter(c => !c.children && !c.filteredChildren);
|
||||
const items = [];
|
||||
// The total of group sizes
|
||||
let groupsSize = groupSizes.reduce((a, b) => a + b, 0);
|
||||
let groupsSize = 0;
|
||||
|
||||
for (const itemOrGroup of itemsAndGroups) {
|
||||
// is item
|
||||
if (!itemOrGroup.children && !itemOrGroup.filteredChildren) {
|
||||
items.push(itemOrGroup);
|
||||
} else {
|
||||
groups.push(itemOrGroup);
|
||||
const size = getItemSize(itemOrGroup);
|
||||
groupSizes.push(size);
|
||||
groupsSize += size;
|
||||
}
|
||||
}
|
||||
|
||||
if (groupsSize + items.length <= max) {
|
||||
// The total size in the current state fits into the max
|
||||
// keep all
|
||||
children = groups.concat(items);
|
||||
} else if (
|
||||
groups.length > 0 &&
|
||||
groups.length + Math.min(1, items.length) < max
|
||||
) {
|
||||
// If each group would take 1 line the total would be below the maximum
|
||||
// collapse some groups, keep items
|
||||
while (groupsSize + items.length + (filteredChildren ? 1 : 0) > max) {
|
||||
children = groups.length > 0 ? groups.concat(items) : items;
|
||||
} else if (groups.length === 0) {
|
||||
// slice items to max
|
||||
// inner space marks that lines for filteredChildren already reserved
|
||||
const limit = max - (filteredChildrenLineReserved ? 0 : 1);
|
||||
filteredChildren = items.length - limit;
|
||||
items.length = limit;
|
||||
children = items;
|
||||
} else {
|
||||
// limit is the size when all groups are collapsed
|
||||
const limit =
|
||||
groups.length +
|
||||
(filteredChildrenLineReserved || items.length === 0 ? 0 : 1);
|
||||
if (limit < max) {
|
||||
// calculate how much we are over the size limit
|
||||
// this allows to approach the limit faster
|
||||
// it's always > 1
|
||||
const oversize =
|
||||
items.length + groupsSize + (filteredChildren ? 1 : 0) - max;
|
||||
// Find the maximum group and process only this one
|
||||
const maxGroupSize = Math.max(...groupSizes);
|
||||
if (maxGroupSize < items.length) {
|
||||
filteredChildren = items.length;
|
||||
items.length = 0;
|
||||
continue;
|
||||
}
|
||||
for (let i = 0; i < groups.length; i++) {
|
||||
if (groupSizes[i] === maxGroupSize) {
|
||||
const group = groups[i];
|
||||
// run this algorithm recursively and limit the size of the children to
|
||||
// current size - oversize / number of groups
|
||||
// So it should always end up being smaller
|
||||
const headerSize = !group.children
|
||||
? 0
|
||||
: group.filteredChildren
|
||||
? 2
|
||||
: 1;
|
||||
const limited = spaceLimited(
|
||||
group.children,
|
||||
groupSizes[i] - headerSize - oversize / groups.length
|
||||
);
|
||||
groups[i] = {
|
||||
...group,
|
||||
children: limited.children,
|
||||
filteredChildren:
|
||||
(group.filteredChildren || 0) + limited.filteredChildren
|
||||
};
|
||||
const newSize = getItemSize(groups[i]);
|
||||
groupsSize -= groupSizes[i] - newSize;
|
||||
groupSizes[i] = newSize;
|
||||
break;
|
||||
let oversize;
|
||||
// If each group would take 1 line the total would be below the maximum
|
||||
// collapse some groups, keep items
|
||||
while (
|
||||
(oversize =
|
||||
groupsSize +
|
||||
items.length +
|
||||
(filteredChildren && !filteredChildrenLineReserved ? 1 : 0) -
|
||||
max) > 0
|
||||
) {
|
||||
// Find the maximum group and process only this one
|
||||
const maxGroupSize = Math.max(...groupSizes);
|
||||
if (maxGroupSize < items.length) {
|
||||
filteredChildren = items.length;
|
||||
items.length = 0;
|
||||
continue;
|
||||
}
|
||||
for (let i = 0; i < groups.length; i++) {
|
||||
if (groupSizes[i] === maxGroupSize) {
|
||||
const group = groups[i];
|
||||
// run this algorithm recursively and limit the size of the children to
|
||||
// current size - oversize / number of groups
|
||||
// So it should always end up being smaller
|
||||
const headerSize = group.filteredChildren ? 2 : 1;
|
||||
const limited = spaceLimited(
|
||||
group.children,
|
||||
maxGroupSize -
|
||||
// we should use ceil to always feet in max
|
||||
Math.ceil(oversize / groups.length) -
|
||||
// we substitute size of group head
|
||||
headerSize,
|
||||
headerSize === 2
|
||||
);
|
||||
groups[i] = {
|
||||
...group,
|
||||
children: limited.children,
|
||||
filteredChildren: limited.filteredChildren
|
||||
? (group.filteredChildren || 0) + limited.filteredChildren
|
||||
: group.filteredChildren
|
||||
};
|
||||
const newSize = getItemSize(groups[i]);
|
||||
groupsSize -= maxGroupSize - newSize;
|
||||
groupSizes[i] = newSize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
children = groups.concat(items);
|
||||
} else if (limit === max) {
|
||||
// If we have only enough space to show one line per group and one line for the filtered items
|
||||
// collapse all groups and items
|
||||
children = collapse(groups);
|
||||
filteredChildren = items.length;
|
||||
} else {
|
||||
// If we have no space
|
||||
// collapse complete group
|
||||
filteredChildren = getTotalItems(itemsAndGroups);
|
||||
}
|
||||
children = groups.concat(items);
|
||||
} else if (
|
||||
groups.length > 0 &&
|
||||
groups.length + Math.min(1, items.length) <= max
|
||||
) {
|
||||
// If we have only enough space to show one line per group and one line for the filtered items
|
||||
// collapse all groups and items
|
||||
children = groups.length ? collapse(groups) : undefined;
|
||||
filteredChildren = items.length;
|
||||
} else {
|
||||
// If we have no space
|
||||
// collapse complete group
|
||||
filteredChildren = getTotalItems(itemsAndGroups);
|
||||
}
|
||||
|
||||
return {
|
||||
children,
|
||||
filteredChildren
|
||||
|
@ -1777,6 +1814,9 @@ const reasonGroup = (children, reasons) => {
|
|||
};
|
||||
};
|
||||
|
||||
const GROUP_EXTENSION_REGEXP = /(\.[^.]+?)(?:\?|(?: \+ \d+ modules?)?$)/;
|
||||
const GROUP_PATH_REGEXP = /(.+)[/\\][^/\\]+?(?:\?|(?: \+ \d+ modules?)?$)/;
|
||||
|
||||
/** @type {Record<string, (groupConfigs: GroupConfig[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} */
|
||||
const ASSETS_GROUPERS = {
|
||||
_: (groupConfigs, context, options) => {
|
||||
|
@ -1825,10 +1865,10 @@ const ASSETS_GROUPERS = {
|
|||
groupConfigs.push({
|
||||
getKeys: asset => {
|
||||
const extensionMatch =
|
||||
groupAssetsByExtension && /(\.[^.]+)(?:\?.*|$)/.exec(asset.name);
|
||||
groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name);
|
||||
const extension = extensionMatch ? extensionMatch[1] : "";
|
||||
const pathMatch =
|
||||
groupAssetsByPath && /(.+)[/\\][^/\\]+(?:\?.*|$)/.exec(asset.name);
|
||||
groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name);
|
||||
const path = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
|
||||
const keys = [];
|
||||
if (groupAssetsByPath) {
|
||||
|
@ -2025,10 +2065,10 @@ const MODULES_GROUPERS = type => ({
|
|||
const dataUrl = /^data:[^,;]+/.exec(resource);
|
||||
if (dataUrl) return [dataUrl[0]];
|
||||
const extensionMatch =
|
||||
groupModulesByExtension && /(\.[^.]+)(?:\?.*|$)/.exec(resource);
|
||||
groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource);
|
||||
const extension = extensionMatch ? extensionMatch[1] : "";
|
||||
const pathMatch =
|
||||
groupModulesByPath && /(.+)[/\\][^/\\]+(?:\?.*|$)/.exec(resource);
|
||||
groupModulesByPath && GROUP_PATH_REGEXP.exec(resource);
|
||||
const path = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
|
||||
const keys = [];
|
||||
if (groupModulesByPath) {
|
||||
|
|
|
@ -57,6 +57,10 @@ const isValidId = id => {
|
|||
return typeof id === "number" || id;
|
||||
};
|
||||
|
||||
const moreCount = (list, count) => {
|
||||
return list && list.length > 0 ? `+ ${count}` : `${count}`;
|
||||
};
|
||||
|
||||
/** @type {Record<string, (thing: any, context: StatsPrinterContext, printer: StatsPrinter) => string | void>} */
|
||||
const SIMPLE_PRINTERS = {
|
||||
"compilation.summary!": (
|
||||
|
@ -182,13 +186,24 @@ const SIMPLE_PRINTERS = {
|
|||
},
|
||||
"compilation.assetsByChunkName": () => "",
|
||||
|
||||
"compilation.filteredModules": filteredModules =>
|
||||
"compilation.filteredModules": (
|
||||
filteredModules,
|
||||
{ compilation: { modules } }
|
||||
) =>
|
||||
filteredModules > 0
|
||||
? `${filteredModules} ${plural(filteredModules, "module", "modules")}`
|
||||
? `${moreCount(modules, filteredModules)} ${plural(
|
||||
filteredModules,
|
||||
"module",
|
||||
"modules"
|
||||
)}`
|
||||
: undefined,
|
||||
"compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) =>
|
||||
filteredAssets > 0
|
||||
? `${filteredAssets} ${plural(filteredAssets, "asset", "assets")}`
|
||||
? `${moreCount(assets, filteredAssets)} ${plural(
|
||||
filteredAssets,
|
||||
"asset",
|
||||
"assets"
|
||||
)}`
|
||||
: undefined,
|
||||
"compilation.logging": (logging, context, printer) =>
|
||||
Array.isArray(logging)
|
||||
|
@ -281,15 +296,19 @@ const SIMPLE_PRINTERS = {
|
|||
"asset.separator!": () => "\n",
|
||||
"asset.filteredRelated": (filteredRelated, { asset: { related } }) =>
|
||||
filteredRelated > 0
|
||||
? `${filteredRelated} related ${plural(
|
||||
? `${moreCount(related, filteredRelated)} related ${plural(
|
||||
filteredRelated,
|
||||
"asset",
|
||||
"assets"
|
||||
)}`
|
||||
: undefined,
|
||||
"asset.filteredChildren": filteredChildren =>
|
||||
"asset.filteredChildren": (filteredChildren, { asset: { children } }) =>
|
||||
filteredChildren > 0
|
||||
? `${filteredChildren} ${plural(filteredChildren, "asset", "assets")}`
|
||||
? `${moreCount(children, filteredChildren)} ${plural(
|
||||
filteredChildren,
|
||||
"asset",
|
||||
"assets"
|
||||
)}`
|
||||
: undefined,
|
||||
|
||||
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
||||
|
@ -385,21 +404,29 @@ const SIMPLE_PRINTERS = {
|
|||
"module.issuerPath": (issuerPath, { module }) =>
|
||||
module.profile ? undefined : "",
|
||||
"module.profile": profile => undefined,
|
||||
"module.filteredModules": filteredModules =>
|
||||
"module.filteredModules": (filteredModules, { module: { modules } }) =>
|
||||
filteredModules > 0
|
||||
? `${filteredModules} nested ${plural(
|
||||
? `${moreCount(modules, filteredModules)} nested ${plural(
|
||||
filteredModules,
|
||||
"module",
|
||||
"modules"
|
||||
)}`
|
||||
: undefined,
|
||||
"module.filteredReasons": filteredReasons =>
|
||||
"module.filteredReasons": (filteredReasons, { module: { reasons } }) =>
|
||||
filteredReasons > 0
|
||||
? `${filteredReasons} ${plural(filteredReasons, "reason", "reasons")}`
|
||||
? `${moreCount(reasons, filteredReasons)} ${plural(
|
||||
filteredReasons,
|
||||
"reason",
|
||||
"reasons"
|
||||
)}`
|
||||
: undefined,
|
||||
"module.filteredChildren": filteredChildren =>
|
||||
"module.filteredChildren": (filteredChildren, { module: { children } }) =>
|
||||
filteredChildren > 0
|
||||
? `${filteredChildren} ${plural(filteredChildren, "module", "modules")}`
|
||||
? `${moreCount(children, filteredChildren)} ${plural(
|
||||
filteredChildren,
|
||||
"module",
|
||||
"modules"
|
||||
)}`
|
||||
: undefined,
|
||||
"module.separator!": () => "\n",
|
||||
|
||||
|
@ -417,9 +444,16 @@ const SIMPLE_PRINTERS = {
|
|||
"moduleReason.active": (active, { formatFlag }) =>
|
||||
active ? undefined : formatFlag("inactive"),
|
||||
"moduleReason.resolvedModule": (module, { magenta }) => magenta(module),
|
||||
"moduleReason.filteredChildren": filteredChildren =>
|
||||
"moduleReason.filteredChildren": (
|
||||
filteredChildren,
|
||||
{ moduleReason: { children } }
|
||||
) =>
|
||||
filteredChildren > 0
|
||||
? `${filteredChildren} ${plural(filteredChildren, "reason", "reasons")}`
|
||||
? `${moreCount(children, filteredChildren)} ${plural(
|
||||
filteredChildren,
|
||||
"reason",
|
||||
"reasons"
|
||||
)}`
|
||||
: undefined,
|
||||
|
||||
"module.profile.total": (value, { formatTime }) => formatTime(value),
|
||||
|
@ -447,10 +481,21 @@ const SIMPLE_PRINTERS = {
|
|||
size ? formatSize(size) : undefined,
|
||||
"chunkGroup.auxiliaryAssetsSize": (size, { formatSize }) =>
|
||||
size ? `(${formatSize(size)})` : undefined,
|
||||
"chunkGroup.filteredAssets": n =>
|
||||
n > 0 ? `${n} ${plural(n, "asset", "assets")}` : undefined,
|
||||
"chunkGroup.filteredAuxiliaryAssets": n =>
|
||||
n > 0 ? `${n} auxiliary ${plural(n, "asset", "assets")}` : undefined,
|
||||
"chunkGroup.filteredAssets": (n, { chunkGroup: { assets } }) =>
|
||||
n > 0
|
||||
? `${moreCount(assets, n)} ${plural(n, "asset", "assets")}`
|
||||
: undefined,
|
||||
"chunkGroup.filteredAuxiliaryAssets": (
|
||||
n,
|
||||
{ chunkGroup: { auxiliaryAssets } }
|
||||
) =>
|
||||
n > 0
|
||||
? `${moreCount(auxiliaryAssets, n)} auxiliary ${plural(
|
||||
n,
|
||||
"asset",
|
||||
"assets"
|
||||
)}`
|
||||
: undefined,
|
||||
"chunkGroup.is!": () => "=",
|
||||
"chunkGroupAsset.name": (asset, { green }) => green(asset),
|
||||
"chunkGroupAsset.size": (size, { formatSize, chunkGroup }) =>
|
||||
|
@ -510,9 +555,9 @@ const SIMPLE_PRINTERS = {
|
|||
"chunk.recorded": (recorded, { formatFlag, green }) =>
|
||||
recorded ? green(formatFlag("recorded")) : undefined,
|
||||
"chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined),
|
||||
"chunk.filteredModules": filteredModules =>
|
||||
"chunk.filteredModules": (filteredModules, { chunk: { modules } }) =>
|
||||
filteredModules > 0
|
||||
? `${filteredModules} chunk ${plural(
|
||||
? `${moreCount(modules, filteredModules)} chunk ${plural(
|
||||
filteredModules,
|
||||
"module",
|
||||
"modules"
|
||||
|
|
|
@ -19,7 +19,7 @@ let inHandleResult = 0;
|
|||
/**
|
||||
* @template T
|
||||
* @callback Callback
|
||||
* @param {WebpackError=} err
|
||||
* @param {(WebpackError | null)=} err
|
||||
* @param {T=} result
|
||||
*/
|
||||
|
||||
|
|
11
package.json
11
package.json
|
@ -28,7 +28,7 @@
|
|||
"tapable": "^2.1.1",
|
||||
"terser-webpack-plugin": "^5.1.3",
|
||||
"watchpack": "^2.3.1",
|
||||
"webpack-sources": "^3.2.2"
|
||||
"webpack-sources": "^3.2.3"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"webpack-cli": {
|
||||
|
@ -143,13 +143,6 @@
|
|||
"test:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.{basictest,longtest,test}.js\"",
|
||||
"test:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.basictest.js\"",
|
||||
"test:unit": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
|
||||
"travis:integration": "yarn cover:integration --ci $JEST",
|
||||
"travis:basic": "yarn cover:basic --ci $JEST",
|
||||
"travis:lintunit": "yarn lint && yarn cover:unit --ci $JEST",
|
||||
"travis:benchmark": "yarn benchmark --ci",
|
||||
"appveyor:integration": "yarn cover:integration --ci %JEST%",
|
||||
"appveyor:unit": "yarn cover:unit --ci %JEST%",
|
||||
"appveyor:benchmark": "yarn benchmark --ci",
|
||||
"build:examples": "cd examples && node buildAll.js",
|
||||
"type-report": "rimraf coverage && yarn cover:types && yarn cover:report && open-cli coverage/lcov-report/index.html",
|
||||
"pretest": "yarn lint",
|
||||
|
@ -159,7 +152,7 @@
|
|||
"type-lint": "tsc",
|
||||
"typings-test": "tsc -p tsconfig.types.test.json",
|
||||
"module-typings-test": "tsc -p tsconfig.module.test.json",
|
||||
"spellcheck": "cspell \"{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}\" \"*.md\"",
|
||||
"spellcheck": "cspell \"**/*\"",
|
||||
"special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals",
|
||||
"special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write",
|
||||
"fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -108,6 +108,9 @@
|
|||
"filename": {
|
||||
"$ref": "#/definitions/FilenameTemplate"
|
||||
},
|
||||
"outputPath": {
|
||||
"$ref": "#/definitions/AssetModuleOutputPath"
|
||||
},
|
||||
"publicPath": {
|
||||
"$ref": "#/definitions/RawPublicPath"
|
||||
}
|
||||
|
@ -136,6 +139,19 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"AssetModuleOutputPath": {
|
||||
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"absolutePath": false
|
||||
},
|
||||
{
|
||||
"instanceof": "Function",
|
||||
"tsType": "((pathData: import(\"../lib/Compilation\").PathData, assetInfo?: import(\"../lib/Compilation\").AssetInfo) => string)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AssetParserDataUrlFunction": {
|
||||
"description": "Function that executes for module and should return whenever asset should be inlined as DataUrl.",
|
||||
"instanceof": "Function",
|
||||
|
@ -182,6 +198,9 @@
|
|||
"filename": {
|
||||
"$ref": "#/definitions/FilenameTemplate"
|
||||
},
|
||||
"outputPath": {
|
||||
"$ref": "#/definitions/AssetModuleOutputPath"
|
||||
},
|
||||
"publicPath": {
|
||||
"$ref": "#/definitions/RawPublicPath"
|
||||
}
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function n(t,{instancePath:r="",parentData:e,parentDataProperty:a,rootData:s=t}={}){let o=null,l=0;const i=l;let p=!1;const c=l;if(l==l)if(t&&"object"==typeof t&&!Array.isArray(t)){const n=l;for(const n in t)if("encoding"!==n&&"mimetype"!==n){const t={params:{additionalProperty:n}};null===o?o=[t]:o.push(t),l++;break}if(n===l){if(void 0!==t.encoding){let n=t.encoding;const r=l;if(!1!==n&&"base64"!==n){const t={params:{}};null===o?o=[t]:o.push(t),l++}var u=r===l}else u=!0;if(u)if(void 0!==t.mimetype){const n=l;if("string"!=typeof t.mimetype){const t={params:{type:"string"}};null===o?o=[t]:o.push(t),l++}u=n===l}else u=!0}}else{const t={params:{type:"object"}};null===o?o=[t]:o.push(t),l++}var f=c===l;if(p=p||f,!p){const n=l;if(!(t instanceof Function)){const t={params:{}};null===o?o=[t]:o.push(t),l++}f=n===l,p=p||f}if(!p){const t={params:{}};return null===o?o=[t]:o.push(t),l++,n.errors=o,!1}return l=i,null!==o&&(i?o.length=i:o=null),n.errors=o,0===l}function r(e,{instancePath:a="",parentData:s,parentDataProperty:o,rootData:l=e}={}){let i=null,p=0;if(0===p){if(!e||"object"!=typeof e||Array.isArray(e))return r.errors=[{params:{type:"object"}}],!1;{const s=p;for(const t in e)if("dataUrl"!==t&&"emit"!==t&&"filename"!==t&&"publicPath"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(s===p){if(void 0!==e.dataUrl){const t=p;n(e.dataUrl,{instancePath:a+"/dataUrl",parentData:e,parentDataProperty:"dataUrl",rootData:l})||(i=null===i?n.errors:i.concat(n.errors),p=i.length);var c=t===p}else c=!0;if(c){if(void 0!==e.emit){const t=p;if("boolean"!=typeof e.emit)return r.errors=[{params:{type:"boolean"}}],!1;c=t===p}else c=!0;if(c){if(void 0!==e.filename){let n=e.filename;const a=p,s=p;let o=!1;const l=p;if(p===l)if("string"==typeof n){if(n.includes("!")||!1!==t.test(n)){const t={params:{}};null===i?i=[t]:i.push(t),p++}else if(n.length<1){const t={params:{}};null===i?i=[t]:i.push(t),p++}}else{const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var u=l===p;if(o=o||u,!o){const t=p;if(!(n instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}u=t===p,o=o||u}if(!o){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),c=a===p}else c=!0;if(c)if(void 0!==e.publicPath){let t=e.publicPath;const n=p,a=p;let s=!1;const o=p;if("string"!=typeof t){const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var f=o===p;if(s=s||f,!s){const n=p;if(!(t instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}f=n===p,s=s||f}if(!s){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=a,null!==i&&(a?i.length=a:i=null),c=n===p}else c=!0}}}}}return r.errors=i,0===p}function e(t,{instancePath:n="",parentData:a,parentDataProperty:s,rootData:o=t}={}){let l=null,i=0;return r(t,{instancePath:n,parentData:a,parentDataProperty:s,rootData:o})||(l=null===l?r.errors:l.concat(r.errors),i=l.length),e.errors=l,0===i}module.exports=e,module.exports.default=e;
|
||||
const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function n(t,{instancePath:r="",parentData:e,parentDataProperty:a,rootData:s=t}={}){let o=null,l=0;const i=l;let p=!1;const u=l;if(l==l)if(t&&"object"==typeof t&&!Array.isArray(t)){const n=l;for(const n in t)if("encoding"!==n&&"mimetype"!==n){const t={params:{additionalProperty:n}};null===o?o=[t]:o.push(t),l++;break}if(n===l){if(void 0!==t.encoding){let n=t.encoding;const r=l;if(!1!==n&&"base64"!==n){const t={params:{}};null===o?o=[t]:o.push(t),l++}var c=r===l}else c=!0;if(c)if(void 0!==t.mimetype){const n=l;if("string"!=typeof t.mimetype){const t={params:{type:"string"}};null===o?o=[t]:o.push(t),l++}c=n===l}else c=!0}}else{const t={params:{type:"object"}};null===o?o=[t]:o.push(t),l++}var f=u===l;if(p=p||f,!p){const n=l;if(!(t instanceof Function)){const t={params:{}};null===o?o=[t]:o.push(t),l++}f=n===l,p=p||f}if(!p){const t={params:{}};return null===o?o=[t]:o.push(t),l++,n.errors=o,!1}return l=i,null!==o&&(i?o.length=i:o=null),n.errors=o,0===l}function r(e,{instancePath:a="",parentData:s,parentDataProperty:o,rootData:l=e}={}){let i=null,p=0;if(0===p){if(!e||"object"!=typeof e||Array.isArray(e))return r.errors=[{params:{type:"object"}}],!1;{const s=p;for(const t in e)if("dataUrl"!==t&&"emit"!==t&&"filename"!==t&&"outputPath"!==t&&"publicPath"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(s===p){if(void 0!==e.dataUrl){const t=p;n(e.dataUrl,{instancePath:a+"/dataUrl",parentData:e,parentDataProperty:"dataUrl",rootData:l})||(i=null===i?n.errors:i.concat(n.errors),p=i.length);var u=t===p}else u=!0;if(u){if(void 0!==e.emit){const t=p;if("boolean"!=typeof e.emit)return r.errors=[{params:{type:"boolean"}}],!1;u=t===p}else u=!0;if(u){if(void 0!==e.filename){let n=e.filename;const a=p,s=p;let o=!1;const l=p;if(p===l)if("string"==typeof n){if(n.includes("!")||!1!==t.test(n)){const t={params:{}};null===i?i=[t]:i.push(t),p++}else if(n.length<1){const t={params:{}};null===i?i=[t]:i.push(t),p++}}else{const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var c=l===p;if(o=o||c,!o){const t=p;if(!(n instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}c=t===p,o=o||c}if(!o){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),u=a===p}else u=!0;if(u){if(void 0!==e.outputPath){let n=e.outputPath;const a=p,s=p;let o=!1;const l=p;if(p===l)if("string"==typeof n){if(n.includes("!")||!1!==t.test(n)){const t={params:{}};null===i?i=[t]:i.push(t),p++}}else{const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var f=l===p;if(o=o||f,!o){const t=p;if(!(n instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}f=t===p,o=o||f}if(!o){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),u=a===p}else u=!0;if(u)if(void 0!==e.publicPath){let t=e.publicPath;const n=p,a=p;let s=!1;const o=p;if("string"!=typeof t){const t={params:{type:"string"}};null===i?i=[t]:i.push(t),p++}var h=o===p;if(s=s||h,!s){const n=p;if(!(t instanceof Function)){const t={params:{}};null===i?i=[t]:i.push(t),p++}h=n===p,s=s||h}if(!s){const t={params:{}};return null===i?i=[t]:i.push(t),p++,r.errors=i,!1}p=a,null!==i&&(a?i.length=a:i=null),u=n===p}else u=!0}}}}}}return r.errors=i,0===p}function e(t,{instancePath:n="",parentData:a,parentDataProperty:s,rootData:o=t}={}){let l=null,i=0;return r(t,{instancePath:n,parentData:a,parentDataProperty:s,rootData:o})||(l=null===l?r.errors:l.concat(r.errors),i=l.length),e.errors=l,0===i}module.exports=e,module.exports.default=e;
|
|
@ -3,4 +3,4 @@
|
|||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function r(n,{instancePath:e="",parentData:a,parentDataProperty:s,rootData:o=n}={}){let l=null,i=0;if(0===i){if(!n||"object"!=typeof n||Array.isArray(n))return r.errors=[{params:{type:"object"}}],!1;{const e=i;for(const t in n)if("emit"!==t&&"filename"!==t&&"publicPath"!==t)return r.errors=[{params:{additionalProperty:t}}],!1;if(e===i){if(void 0!==n.emit){const t=i;if("boolean"!=typeof n.emit)return r.errors=[{params:{type:"boolean"}}],!1;var p=t===i}else p=!0;if(p){if(void 0!==n.filename){let e=n.filename;const a=i,s=i;let o=!1;const c=i;if(i===c)if("string"==typeof e){if(e.includes("!")||!1!==t.test(e)){const t={params:{}};null===l?l=[t]:l.push(t),i++}else if(e.length<1){const t={params:{}};null===l?l=[t]:l.push(t),i++}}else{const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var u=c===i;if(o=o||u,!o){const t=i;if(!(e instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}u=t===i,o=o||u}if(!o){const t={params:{}};return null===l?l=[t]:l.push(t),i++,r.errors=l,!1}i=s,null!==l&&(s?l.length=s:l=null),p=a===i}else p=!0;if(p)if(void 0!==n.publicPath){let t=n.publicPath;const e=i,a=i;let s=!1;const o=i;if("string"!=typeof t){const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var c=o===i;if(s=s||c,!s){const r=i;if(!(t instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}c=r===i,s=s||c}if(!s){const t={params:{}};return null===l?l=[t]:l.push(t),i++,r.errors=l,!1}i=a,null!==l&&(a?l.length=a:l=null),p=e===i}else p=!0}}}}return r.errors=l,0===i}function n(t,{instancePath:e="",parentData:a,parentDataProperty:s,rootData:o=t}={}){let l=null,i=0;return r(t,{instancePath:e,parentData:a,parentDataProperty:s,rootData:o})||(l=null===l?r.errors:l.concat(r.errors),i=l.length),n.errors=l,0===i}module.exports=n,module.exports.default=n;
|
||||
const t=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function n(r,{instancePath:e="",parentData:s,parentDataProperty:a,rootData:o=r}={}){let l=null,i=0;if(0===i){if(!r||"object"!=typeof r||Array.isArray(r))return n.errors=[{params:{type:"object"}}],!1;{const e=i;for(const t in r)if("emit"!==t&&"filename"!==t&&"outputPath"!==t&&"publicPath"!==t)return n.errors=[{params:{additionalProperty:t}}],!1;if(e===i){if(void 0!==r.emit){const t=i;if("boolean"!=typeof r.emit)return n.errors=[{params:{type:"boolean"}}],!1;var u=t===i}else u=!0;if(u){if(void 0!==r.filename){let e=r.filename;const s=i,a=i;let o=!1;const c=i;if(i===c)if("string"==typeof e){if(e.includes("!")||!1!==t.test(e)){const t={params:{}};null===l?l=[t]:l.push(t),i++}else if(e.length<1){const t={params:{}};null===l?l=[t]:l.push(t),i++}}else{const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var p=c===i;if(o=o||p,!o){const t=i;if(!(e instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}p=t===i,o=o||p}if(!o){const t={params:{}};return null===l?l=[t]:l.push(t),i++,n.errors=l,!1}i=a,null!==l&&(a?l.length=a:l=null),u=s===i}else u=!0;if(u){if(void 0!==r.outputPath){let e=r.outputPath;const s=i,a=i;let o=!1;const p=i;if(i===p)if("string"==typeof e){if(e.includes("!")||!1!==t.test(e)){const t={params:{}};null===l?l=[t]:l.push(t),i++}}else{const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var c=p===i;if(o=o||c,!o){const t=i;if(!(e instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}c=t===i,o=o||c}if(!o){const t={params:{}};return null===l?l=[t]:l.push(t),i++,n.errors=l,!1}i=a,null!==l&&(a?l.length=a:l=null),u=s===i}else u=!0;if(u)if(void 0!==r.publicPath){let t=r.publicPath;const e=i,s=i;let a=!1;const o=i;if("string"!=typeof t){const t={params:{type:"string"}};null===l?l=[t]:l.push(t),i++}var f=o===i;if(a=a||f,!a){const n=i;if(!(t instanceof Function)){const t={params:{}};null===l?l=[t]:l.push(t),i++}f=n===i,a=a||f}if(!a){const t={params:{}};return null===l?l=[t]:l.push(t),i++,n.errors=l,!1}i=s,null!==l&&(s?l.length=s:l=null),u=e===i}else u=!0}}}}}return n.errors=l,0===i}function r(t,{instancePath:e="",parentData:s,parentDataProperty:a,rootData:o=t}={}){let l=null,i=0;return n(t,{instancePath:e,parentData:s,parentDataProperty:a,rootData:o})||(l=null===l?n.errors:l.concat(n.errors),i=l.length),r.errors=l,0===i}module.exports=r,module.exports.default=r;
|
|
@ -136,7 +136,7 @@ describe("BuildDependencies", () => {
|
|||
"export default 0;"
|
||||
);
|
||||
await exec("0", {
|
||||
invalidBuildDepdencies: true,
|
||||
invalidBuildDependencies: true,
|
||||
buildTwice: true,
|
||||
warnings: [/Can't resolve 'should-fail-resolving'/]
|
||||
});
|
||||
|
|
|
@ -5,6 +5,50 @@ describe("Cli", () => {
|
|||
expect(getArguments()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should generate the correct cli flags with custom schema", () => {
|
||||
const schema = {
|
||||
title: "custom CLI options",
|
||||
type: "object",
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
"with-reset-description": {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string"
|
||||
},
|
||||
description: "original description",
|
||||
cli: {
|
||||
resetDescription: "custom reset"
|
||||
}
|
||||
},
|
||||
"with-cli-description": {
|
||||
type: "string",
|
||||
description: "original description",
|
||||
cli: {
|
||||
description: "description for CLI option"
|
||||
}
|
||||
},
|
||||
"with-negative-description": {
|
||||
type: "boolean",
|
||||
description: "original description",
|
||||
cli: {
|
||||
negatedDescription: "custom negative description"
|
||||
}
|
||||
},
|
||||
"with-both-cli-and-negative-description": {
|
||||
type: "boolean",
|
||||
description: "original description",
|
||||
cli: {
|
||||
description: "description for CLI option",
|
||||
negatedDescription: "custom negative description"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(getArguments(schema)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
const test = (name, values, config, fn) => {
|
||||
it(`should correctly process arguments for ${name}`, () => {
|
||||
const args = getArguments();
|
||||
|
@ -264,6 +308,7 @@ describe("Cli", () => {
|
|||
`)
|
||||
);
|
||||
|
||||
// cspell:ignore filsystem
|
||||
test(
|
||||
"errors",
|
||||
{
|
||||
|
|
|
@ -185,6 +185,7 @@ describe("Compiler", () => {
|
|||
});
|
||||
});
|
||||
|
||||
// cspell:word asmjs
|
||||
it("should not evaluate constants in asm.js", done => {
|
||||
compile("./asmjs", {}, (stats, files) => {
|
||||
expect(Object.keys(files)).toEqual(["/main.js"]);
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
const ContextModule = require("../lib/ContextModule");
|
||||
|
||||
describe("contextModule", () => {
|
||||
let contextModule;
|
||||
let request;
|
||||
beforeEach(() => {
|
||||
request = "/some/request";
|
||||
});
|
||||
describe("#identifier", () => {
|
||||
it("returns an safe identifier for this module", () => {
|
||||
contextModule = new ContextModule(() => {}, {
|
||||
type: "javascript/auto",
|
||||
request,
|
||||
mode: "lazy",
|
||||
regExp: /a|b/
|
||||
});
|
||||
expect(contextModule.identifier()).toContain("/a%7Cb/");
|
||||
});
|
||||
});
|
||||
});
|
|
@ -9,24 +9,24 @@ const stripAnsi = require("strip-ansi");
|
|||
* @param {string} str String to quote
|
||||
* @returns {string} Escaped string
|
||||
*/
|
||||
const quotemeta = str => {
|
||||
const quoteMeta = str => {
|
||||
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
|
||||
};
|
||||
|
||||
describe("Defaults", () => {
|
||||
const cwd = process.cwd();
|
||||
const cwdRegExp = new RegExp(
|
||||
`${quotemeta(cwd)}((?:\\\\)?(?:[a-zA-Z.\\-_]+\\\\)*)`,
|
||||
`${quoteMeta(cwd)}((?:\\\\)?(?:[a-zA-Z.\\-_]+\\\\)*)`,
|
||||
"g"
|
||||
);
|
||||
const escapedCwd = JSON.stringify(cwd).slice(1, -1);
|
||||
const escapedCwdRegExp = new RegExp(
|
||||
`${quotemeta(escapedCwd)}((?:\\\\\\\\)?(?:[a-zA-Z.\\-_]+\\\\\\\\)*)`,
|
||||
`${quoteMeta(escapedCwd)}((?:\\\\\\\\)?(?:[a-zA-Z.\\-_]+\\\\\\\\)*)`,
|
||||
"g"
|
||||
);
|
||||
const normalize = str => {
|
||||
if (cwd.startsWith("/")) {
|
||||
str = str.replace(new RegExp(quotemeta(cwd), "g"), "<cwd>");
|
||||
str = str.replace(new RegExp(quoteMeta(cwd), "g"), "<cwd>");
|
||||
} else {
|
||||
str = str.replace(cwdRegExp, (m, g) => `<cwd>${g.replace(/\\/g, "/")}`);
|
||||
str = str.replace(
|
||||
|
@ -1452,7 +1452,7 @@ describe("Defaults", () => {
|
|||
+ "recordsOutputPath": "some-path",
|
||||
`)
|
||||
);
|
||||
test("ecamVersion", { output: { ecmaVersion: 2020 } }, e =>
|
||||
test("ecmaVersion", { output: { ecmaVersion: 2020 } }, e =>
|
||||
e.toMatchInlineSnapshot(`Compared values have no visual difference.`)
|
||||
);
|
||||
test("single runtimeChunk", { optimization: { runtimeChunk: "single" } }, e =>
|
||||
|
|
|
@ -116,7 +116,7 @@ async function compile(options) {
|
|||
});
|
||||
});
|
||||
} catch (err) {
|
||||
// capture sync throwm errors
|
||||
// capture sync thrown errors
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
|
@ -644,6 +644,7 @@ describe("loaders", () => {
|
|||
`);
|
||||
});
|
||||
|
||||
// cspell:ignore doesnt
|
||||
it("should emit error for doesnt-exist-loader", async () => {
|
||||
await expect(compile({ entry: "./doesnt-exist-loader!./entry-point.js" }))
|
||||
.resolves.toMatchInlineSnapshot(`
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
// cspell:ignore fghsub notry fghsub notry notry this's ijksub this's ijksub fghsub fghsub notry ijksub ijksub strrring strrring strr strrring strrring strr Sstrrringy strone stronetwo stronetwothree stronetwo stronetwothree stronetwothreefour onetwo onetwo twothree twothree twothree threefour onetwo onetwo threefour threefour fourfive startstrmid igmy igmyi igmya
|
||||
const BasicEvaluatedExpression = require("../lib/javascript/BasicEvaluatedExpression");
|
||||
const JavascriptParser = require("../lib/javascript/JavascriptParser");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ require("./helpers/warmup-webpack");
|
|||
|
||||
const path = require("path");
|
||||
|
||||
// cspell:word nodetest
|
||||
describe("NodeTemplatePlugin", () => {
|
||||
jest.setTimeout(20000);
|
||||
it("should compile and run a simple module", done => {
|
||||
|
|
|
@ -91,6 +91,7 @@ describe("NormalModule", () => {
|
|||
});
|
||||
describe("given a userRequest containing query parameters", () => {
|
||||
it("ignores paths in query parameters", () => {
|
||||
// cspell:word testpath
|
||||
userRequest =
|
||||
"F:\\some\\context\\loader?query=foo\\bar&otherPath=testpath/other";
|
||||
normalModule = new NormalModule({
|
||||
|
@ -284,7 +285,7 @@ describe("NormalModule", () => {
|
|||
});
|
||||
});
|
||||
describe("that is an array", () => {
|
||||
describe("of strings and or regexs", () => {
|
||||
describe("of strings and or regexps", () => {
|
||||
let someRules;
|
||||
beforeEach(() => {
|
||||
someRules = ["some rule", /some rule1/, "some rule2"];
|
||||
|
|
|
@ -4,7 +4,7 @@ const path = require("path");
|
|||
const ProfilingPlugin = require("../lib/debug/ProfilingPlugin");
|
||||
|
||||
describe("Profiling Plugin", () => {
|
||||
it("should persist the passed outpath", () => {
|
||||
it("should persist the passed output path", () => {
|
||||
const outputPath = path.join(__dirname, "invest_in_doge_coin");
|
||||
const plugin = new ProfilingPlugin({
|
||||
outputPath: outputPath
|
||||
|
@ -34,7 +34,7 @@ describe("Profiling Plugin", () => {
|
|||
|
||||
it("handles sending a profiling message when no session", () => {
|
||||
const profiler = new ProfilingPlugin.Profiler();
|
||||
return profiler.sendCommand("randy", "is a puppers");
|
||||
return profiler.sendCommand("randy", "is awesome");
|
||||
});
|
||||
|
||||
it("handles destroying when no session", () => {
|
||||
|
|
|
@ -111,7 +111,7 @@ describe("ProgressPlugin", function () {
|
|||
nanTest(createMultiCompiler)
|
||||
);
|
||||
it(
|
||||
"should not contain NaN as a percentage when it is applied to MultiCompiler (paralellism: 1)",
|
||||
"should not contain NaN as a percentage when it is applied to MultiCompiler (parallelism: 1)",
|
||||
nanTest(() => createMultiCompiler(undefined, { parallelism: 1 }))
|
||||
);
|
||||
|
||||
|
@ -190,6 +190,7 @@ describe("ProgressPlugin", function () {
|
|||
|
||||
expect(logs.length).toBeGreaterThan(20);
|
||||
logs.forEach(log => expect(log.length).toBeLessThanOrEqual(35));
|
||||
// cspell:ignore mization nsPlugin
|
||||
expect(logs).toContain(
|
||||
"75% sealing ...mization ...nsPlugin",
|
||||
"trims each detail string equally"
|
||||
|
|
|
@ -25,7 +25,7 @@ See also: [Jest CLI docs](https://jestjs.io/docs/cli)
|
|||
We use Jest for our tests. For more information on Jest you can visit their [homepage](https://jestjs.io/)!
|
||||
|
||||
### Class Tests
|
||||
All test files can be found in *.test.js. There are many tests that simply test API's of a specific class/file (such as `Compiler`, `Errors`, Integration, `Parser`, `RuleSet`, Validation).
|
||||
All test files can be found in *.test.js. There are many tests that simply test APIs of a specific class/file (such as `Compiler`, `Errors`, Integration, `Parser`, `RuleSet`, Validation).
|
||||
If the feature you are contributing involves one of those classes, then best to start there to understand the structure.
|
||||
|
||||
### xCases
|
||||
|
@ -69,4 +69,4 @@ If you are still nervous or don't quite understand, please submit an issue and t
|
|||
|
||||
|
||||
## Footnotes
|
||||
<sup>1</sup> webpack's parser supports the use of ES2015 features like arrow functions, harmony exports, etc. However as a library we follow NodeJS's timeline for dropping older versions of node. Because of this we expect your tests on Travis to pass all the way back to NodeJS v10; Therefore if you would like specific tests that use these features to be ignored if they are not supported, then you should add a `test.filter.js` file. This allows you to import the syntax needed for that test, meanwhile ignoring it on node versions (during CI) that don't support it. webpack has a variety of helpful examples you can refer to if you are just starting out. See the `./helpers` folder to find a list of the versions.
|
||||
<sup>1</sup> webpack's parser supports the use of ES2015 features like arrow functions, harmony exports, etc. However as a library we follow Node.js' timeline for dropping older versions of node. Because of this we expect your tests on GitHub Actions to pass all the way back to NodeJS v10; Therefore if you would like specific tests that use these features to be ignored if they are not supported, then you should add a `test.filter.js` file. This allows you to import the syntax needed for that test, meanwhile ignoring it on node versions (during CI) that don't support it. webpack has a variety of helpful examples you can refer to if you are just starting out. See the `./helpers` folder to find a list of the versions.
|
||||
|
|
|
@ -12,7 +12,7 @@ const webpack = require("..");
|
|||
* @param {string} str String to quote
|
||||
* @returns {string} Escaped string
|
||||
*/
|
||||
const quotemeta = str => {
|
||||
const quoteMeta = str => {
|
||||
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
|
||||
};
|
||||
|
||||
|
@ -184,11 +184,12 @@ describe("StatsTestCases", () => {
|
|||
.replace(/\u001b\[([0-9;]*)m/g, "<CLR=$1>")
|
||||
.replace(/[.0-9]+(<\/CLR>)?(\s?ms)/g, "X$1$2");
|
||||
}
|
||||
// cspell:ignore Xdir
|
||||
const testPath = path.join(base, testName);
|
||||
actual = actual
|
||||
.replace(/\r\n?/g, "\n")
|
||||
.replace(/webpack [^ )]+(\)?) compiled/g, "webpack x.x.x$1 compiled")
|
||||
.replace(new RegExp(quotemeta(testPath), "g"), "Xdir/" + testName)
|
||||
.replace(new RegExp(quoteMeta(testPath), "g"), "Xdir/" + testName)
|
||||
.replace(/(\w)\\(\w)/g, "$1/$2")
|
||||
.replace(/, additional resolving: X ms/g, "");
|
||||
expect(actual).toMatchSnapshot();
|
||||
|
|
|
@ -16,6 +16,7 @@ describe("Template", () => {
|
|||
items.push(item);
|
||||
}
|
||||
});
|
||||
// cspell:ignore sdfas sadfome
|
||||
it("should generate sanitized path identifiers", () => {
|
||||
expect(Template.toPath("path/to-sdfas/sadfome$$.js")).toBe(
|
||||
"path-to-sdfas-sadfome$$-js"
|
||||
|
|
|
@ -404,6 +404,7 @@ describe("Validation", () => {
|
|||
`)
|
||||
);
|
||||
|
||||
// cspell:Ignore protuction
|
||||
createTestCase(
|
||||
"invalid mode",
|
||||
{
|
||||
|
@ -603,7 +604,7 @@ describe("Validation", () => {
|
|||
`)
|
||||
);
|
||||
createTestCase(
|
||||
"opimization.moduleIds",
|
||||
"optimization.moduleIds",
|
||||
{
|
||||
optimization: {
|
||||
hashedModuleIds: true
|
||||
|
|
|
@ -131,7 +131,7 @@ for (const name of Object.keys(wasmHashes)) {
|
|||
});
|
||||
};
|
||||
|
||||
const uncodeRangeTest = (name, start, end) => {
|
||||
const unicodeRangeTest = (name, start, end) => {
|
||||
const codePoints = [];
|
||||
for (let i = start; i <= end; i++) {
|
||||
codePoints.push(i);
|
||||
|
@ -139,11 +139,12 @@ for (const name of Object.keys(wasmHashes)) {
|
|||
unicodeTest(name, codePoints);
|
||||
};
|
||||
|
||||
uncodeRangeTest("Latin-1 Supplement", 0xa0, 0xff);
|
||||
uncodeRangeTest("Latin Extended", 0x100, 0x24f);
|
||||
uncodeRangeTest("Thaana", 0x780, 0x7bf);
|
||||
uncodeRangeTest("Devanagari", 0x900, 0x97f);
|
||||
uncodeRangeTest("Emoticons", 0x1f600, 0x1f64f);
|
||||
// cspell:word Thaana
|
||||
unicodeRangeTest("Latin-1 Supplement", 0xa0, 0xff);
|
||||
unicodeRangeTest("Latin Extended", 0x100, 0x24f);
|
||||
unicodeRangeTest("Thaana", 0x780, 0x7bf);
|
||||
unicodeRangeTest("Devanagari", 0x900, 0x97f);
|
||||
unicodeRangeTest("Emoticons", 0x1f600, 0x1f64f);
|
||||
|
||||
unicodeTest("with zero char", "abc\0💩");
|
||||
unicodeTest("weird code point after long code point", [1497, 243248]);
|
||||
|
|
|
@ -396,7 +396,7 @@ const describeCases = config => {
|
|||
done
|
||||
)
|
||||
) {
|
||||
compiler.close();
|
||||
compiler.close(() => {});
|
||||
return;
|
||||
}
|
||||
compiler.close(done);
|
||||
|
|
|
@ -1283,6 +1283,19 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-generator-asset-output-path": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
|
||||
"multiple": false,
|
||||
"path": "module.generator.asset.outputPath",
|
||||
"type": "string",
|
||||
},
|
||||
],
|
||||
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
|
||||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-generator-asset-public-path": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
@ -1322,6 +1335,19 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-generator-asset-resource-output-path": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
|
||||
"multiple": false,
|
||||
"path": "module.generator.asset/resource.outputPath",
|
||||
"type": "string",
|
||||
},
|
||||
],
|
||||
"description": "Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.",
|
||||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"module-generator-asset-resource-public-path": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
@ -8973,3 +8999,75 @@ Object {
|
|||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Cli should generate the correct cli flags with custom schema 1`] = `
|
||||
Object {
|
||||
"with-both-cli-and-negative-description": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "description for CLI option",
|
||||
"multiple": false,
|
||||
"negatedDescription": "custom negative description",
|
||||
"path": "with-both-cli-and-negative-description",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "description for CLI option",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"with-cli-description": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "description for CLI option",
|
||||
"multiple": false,
|
||||
"path": "with-cli-description",
|
||||
"type": "string",
|
||||
},
|
||||
],
|
||||
"description": "description for CLI option",
|
||||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"with-negative-description": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "original description",
|
||||
"multiple": false,
|
||||
"negatedDescription": "custom negative description",
|
||||
"path": "with-negative-description",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "original description",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"with-reset-description": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "original description",
|
||||
"multiple": true,
|
||||
"path": "with-reset-description[]",
|
||||
"type": "string",
|
||||
},
|
||||
],
|
||||
"description": "original description",
|
||||
"multiple": true,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"with-reset-description-reset": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "custom reset",
|
||||
"multiple": false,
|
||||
"path": "with-reset-description",
|
||||
"type": "reset",
|
||||
},
|
||||
],
|
||||
"description": "custom reset",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -1363,13 +1363,46 @@ webpack x.x.x compiled <CLR=32,BOLD>successfully</CLR> in X ms"
|
|||
|
||||
exports[`StatsTestCases should print correct stats for max-modules 1`] = `
|
||||
"asset main.js 5.47 KiB [emitted] (name: main)
|
||||
31 modules
|
||||
./index.js 181 bytes [built] [code generated]
|
||||
./a.js?1 33 bytes [built] [code generated]
|
||||
./a.js?2 33 bytes [built] [code generated]
|
||||
./a.js?3 33 bytes [built] [code generated]
|
||||
./a.js?4 33 bytes [built] [code generated]
|
||||
./a.js?5 33 bytes [built] [code generated]
|
||||
./a.js?6 33 bytes [built] [code generated]
|
||||
./a.js?7 33 bytes [built] [code generated]
|
||||
./a.js?8 33 bytes [built] [code generated]
|
||||
./a.js?9 33 bytes [built] [code generated]
|
||||
./a.js?10 33 bytes [built] [code generated]
|
||||
./c.js?1 33 bytes [built] [code generated]
|
||||
./c.js?2 33 bytes [built] [code generated]
|
||||
./c.js?3 33 bytes [built] [code generated]
|
||||
./c.js?4 33 bytes [built] [code generated]
|
||||
./c.js?5 33 bytes [built] [code generated]
|
||||
./c.js?6 33 bytes [built] [code generated]
|
||||
./c.js?7 33 bytes [built] [code generated]
|
||||
./c.js?8 33 bytes [built] [code generated]
|
||||
+ 12 modules
|
||||
webpack x.x.x compiled successfully in X ms"
|
||||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for max-modules-default 1`] = `
|
||||
"asset main.js 5.47 KiB [emitted] (name: main)
|
||||
31 modules
|
||||
./index.js 181 bytes [built] [code generated]
|
||||
./a.js?1 33 bytes [built] [code generated]
|
||||
./a.js?2 33 bytes [built] [code generated]
|
||||
./a.js?3 33 bytes [built] [code generated]
|
||||
./a.js?4 33 bytes [built] [code generated]
|
||||
./a.js?5 33 bytes [built] [code generated]
|
||||
./a.js?6 33 bytes [built] [code generated]
|
||||
./a.js?7 33 bytes [built] [code generated]
|
||||
./a.js?8 33 bytes [built] [code generated]
|
||||
./a.js?9 33 bytes [built] [code generated]
|
||||
./a.js?10 33 bytes [built] [code generated]
|
||||
./c.js?1 33 bytes [built] [code generated]
|
||||
./c.js?2 33 bytes [built] [code generated]
|
||||
./c.js?3 33 bytes [built] [code generated]
|
||||
+ 17 modules
|
||||
webpack x.x.x compiled successfully in X ms"
|
||||
`;
|
||||
|
||||
|
@ -2661,27 +2694,27 @@ exclude1:
|
|||
hidden assets 28.9 KiB 2 assets
|
||||
sourceMap exclude1-main.js.map 12.5 KiB [emitted] [dev] (auxiliary name: main)
|
||||
hidden assets 25 KiB 2 assets
|
||||
1 related asset
|
||||
1 related asset
|
||||
+ 1 related asset
|
||||
+ 1 related asset
|
||||
asset exclude1-chunk_js.js 804 bytes [emitted]
|
||||
hidden assets 1.57 KiB 2 assets
|
||||
sourceMap exclude1-chunk_js.js.map 295 bytes [emitted] [dev]
|
||||
hidden assets 590 bytes 2 assets
|
||||
1 related asset
|
||||
1 related asset
|
||||
+ 1 related asset
|
||||
+ 1 related asset
|
||||
assets by path *.css 144 bytes
|
||||
asset exclude1-chunk_js.css 74 bytes [emitted]
|
||||
hidden assets 148 bytes 2 assets
|
||||
sourceMap exclude1-chunk_js.css.map 197 bytes [emitted] [dev]
|
||||
hidden assets 394 bytes 2 assets
|
||||
1 related asset
|
||||
1 related asset
|
||||
+ 1 related asset
|
||||
+ 1 related asset
|
||||
asset exclude1-main.css 70 bytes [emitted] (name: main)
|
||||
hidden assets 140 bytes 2 assets
|
||||
sourceMap exclude1-main.css.map 187 bytes [emitted] [dev] (auxiliary name: main)
|
||||
hidden assets 374 bytes 2 assets
|
||||
1 related asset
|
||||
1 related asset
|
||||
+ 1 related asset
|
||||
+ 1 related asset
|
||||
|
||||
exclude2:
|
||||
assets by path *.js 15.2 KiB
|
||||
|
@ -3089,7 +3122,27 @@ exports[`StatsTestCases should print correct stats for scope-hoisting-bailouts 1
|
|||
"runtime modules 6.83 KiB 10 modules
|
||||
built modules 615 bytes [built]
|
||||
code generated modules 530 bytes [code generated]
|
||||
modules by path ./*.js 377 bytes 7 modules
|
||||
./index.js 150 bytes [built] [code generated]
|
||||
Statement (ExpressionStatement) with side effects in source code at 7:0-25
|
||||
ModuleConcatenation bailout: Cannot concat with ./cjs.js: Module is not an ECMAScript module
|
||||
ModuleConcatenation bailout: Cannot concat with ./eval.js: Module uses eval()
|
||||
ModuleConcatenation bailout: Cannot concat with ./module-id.js: Module uses module.id
|
||||
ModuleConcatenation bailout: Cannot concat with ./module-loaded.js: Module uses module.loaded
|
||||
./entry.js 32 bytes [built] [code generated]
|
||||
./cjs.js 59 bytes [built] [code generated]
|
||||
CommonJS bailout: module.exports is used directly at 3:0-14
|
||||
Statement (ExpressionStatement) with side effects in source code at 1:0-26
|
||||
ModuleConcatenation bailout: Module is not an ECMAScript module
|
||||
./ref-from-cjs.js 45 bytes [built] [code generated]
|
||||
./eval.js 35 bytes [built] [code generated]
|
||||
Statement (ExportDefaultDeclaration) with side effects in source code at 1:0-34
|
||||
ModuleConcatenation bailout: Module uses eval()
|
||||
./module-id.js 26 bytes [built] [code generated]
|
||||
Statement (ExportDefaultDeclaration) with side effects in source code at 1:0-25
|
||||
ModuleConcatenation bailout: Module uses module.id
|
||||
./module-loaded.js 30 bytes [built] [code generated]
|
||||
Statement (ExportDefaultDeclaration) with side effects in source code at 1:0-29
|
||||
ModuleConcatenation bailout: Module uses module.loaded
|
||||
./concatenated.js + 2 modules 111 bytes [built] [code generated]
|
||||
ModuleConcatenation bailout: Cannot concat with external \\"external\\": Module external \\"external\\" is not in the same chunk(s) (expected in chunk(s) unnamed chunk(s), module is in chunk(s) index)
|
||||
external \\"external\\" 42 bytes [built] [code generated]
|
||||
|
@ -3124,14 +3177,18 @@ Entrypoint second 13.5 KiB = b-vendor.js 419 bytes b-second.js 13.1 KiB
|
|||
runtime modules 15.1 KiB 20 modules
|
||||
cacheable modules 975 bytes
|
||||
code generated modules 857 bytes [code generated]
|
||||
modules by path ./*.js + 1 modules 459 bytes 3 modules
|
||||
modules by path ./*.js 106 bytes
|
||||
./vendor.js 25 bytes [built] [code generated]
|
||||
./lazy_shared.js 56 bytes [built] [code generated]
|
||||
ModuleConcatenation bailout: Cannot concat with ./common_lazy_shared.js: Module ./common_lazy_shared.js is referenced from different chunks by these modules: ./lazy_first.js, ./lazy_second.js
|
||||
./common_lazy_shared.js 25 bytes [built] [code generated]
|
||||
./first.js + 2 modules 292 bytes [built] [code generated]
|
||||
ModuleConcatenation bailout: Cannot concat with ./vendor.js: Module ./vendor.js is not in the same chunk(s) (expected in chunk(s) first, module is in chunk(s) vendor)
|
||||
./second.js + 1 modules 227 bytes [built] [code generated]
|
||||
ModuleConcatenation bailout: Cannot concat with ./vendor.js: Module ./vendor.js is not in the same chunk(s) (expected in chunk(s) second, module is in chunk(s) vendor)
|
||||
./vendor.js 25 bytes [built] [code generated]
|
||||
./lazy_first.js + 1 modules 116 bytes [built] [code generated]
|
||||
ModuleConcatenation bailout: Cannot concat with ./common_lazy_shared.js: Module ./common_lazy_shared.js is referenced from different chunks by these modules: ./lazy_shared.js
|
||||
./lazy_shared.js 56 bytes [built] [code generated]
|
||||
ModuleConcatenation bailout: Cannot concat with ./common_lazy_shared.js: Module ./common_lazy_shared.js is referenced from different chunks by these modules: ./lazy_first.js, ./lazy_second.js
|
||||
./lazy_second.js + 1 modules 116 bytes [built] [code generated]
|
||||
ModuleConcatenation bailout: Cannot concat with ./common_lazy_shared.js: Module ./common_lazy_shared.js is referenced from different chunks by these modules: ./lazy_shared.js
|
||||
./common_lazy_shared.js 25 bytes [built] [code generated]
|
||||
orphan modules 118 bytes [orphan]
|
||||
./common2.js 25 bytes [orphan] [built]
|
||||
./module_first.js 31 bytes [orphan] [built]
|
||||
|
@ -3149,16 +3206,7 @@ cacheable modules 823 bytes
|
|||
modules by path ./components/src/ 501 bytes
|
||||
orphan modules 315 bytes [orphan]
|
||||
modules by path ./components/src/CompAB/*.js 164 bytes 2 modules
|
||||
modules by path ./components/src/CompC/*.js 67 bytes
|
||||
./components/src/CompC/CompC.js 33 bytes [orphan] [built]
|
||||
[module unused]
|
||||
[inactive] harmony side effect evaluation ./CompC ./components/src/CompC/index.js 1:0-34
|
||||
[inactive] harmony export imported specifier ./CompC ./components/src/CompC/index.js 1:0-34
|
||||
[inactive] harmony export imported specifier ./CompC ./components/src/index.js 2:0-43 (skipped side-effect-free modules)
|
||||
./components/src/CompC/index.js 34 bytes [orphan] [built]
|
||||
[module unused]
|
||||
[inactive] harmony side effect evaluation ./CompC ./components/src/index.js 2:0-43
|
||||
[inactive] harmony export imported specifier ./CompC ./components/src/index.js 2:0-43
|
||||
modules by path ./components/src/CompC/*.js 67 bytes 2 modules
|
||||
./components/src/index.js 84 bytes [orphan] [built]
|
||||
[module unused]
|
||||
[inactive] from origin ./main.js + 1 modules
|
||||
|
@ -3187,20 +3235,21 @@ cacheable modules 823 bytes
|
|||
from origin ./main.js + 1 modules
|
||||
[inactive] harmony side effect evaluation ./utils ./main.js + 1 modules ./components/src/CompAB/CompB.js 1:0-30
|
||||
harmony import specifier ./utils ./main.js + 1 modules ./components/src/CompAB/CompB.js 5:2-5
|
||||
./main.js + 1 modules 221 bytes [built] [code generated]
|
||||
[no exports used]
|
||||
entry ./main.js main
|
||||
| ./main.js 144 bytes [built]
|
||||
| [no exports used]
|
||||
| ./components/src/CompAB/CompB.js 77 bytes [built]
|
||||
| [only some exports used: default]
|
||||
| [inactive] from origin ./components/src/CompAB/index.js
|
||||
| [inactive] harmony side effect evaluation ./CompB ./components/src/CompAB/index.js 2:0-43
|
||||
| [inactive] harmony export imported specifier ./CompB ./components/src/CompAB/index.js 2:0-43
|
||||
| [inactive] harmony export imported specifier ./CompAB ./components/src/index.js 1:0-40 (skipped side-effect-free modules)
|
||||
| harmony import specifier ./components ./main.js 4:15-20 (skipped side-effect-free modules)
|
||||
./foo.js 101 bytes [built] [code generated]
|
||||
import() ./foo ./main.js + 1 modules ./main.js 6:0-15
|
||||
modules by path ./*.js 322 bytes
|
||||
./main.js + 1 modules 221 bytes [built] [code generated]
|
||||
[no exports used]
|
||||
entry ./main.js main
|
||||
| ./main.js 144 bytes [built]
|
||||
| [no exports used]
|
||||
| ./components/src/CompAB/CompB.js 77 bytes [built]
|
||||
| [only some exports used: default]
|
||||
| [inactive] from origin ./components/src/CompAB/index.js
|
||||
| [inactive] harmony side effect evaluation ./CompB ./components/src/CompAB/index.js 2:0-43
|
||||
| [inactive] harmony export imported specifier ./CompB ./components/src/CompAB/index.js 2:0-43
|
||||
| [inactive] harmony export imported specifier ./CompAB ./components/src/index.js 1:0-40 (skipped side-effect-free modules)
|
||||
| harmony import specifier ./components ./main.js 4:15-20 (skipped side-effect-free modules)
|
||||
./foo.js 101 bytes [built] [code generated]
|
||||
import() ./foo ./main.js + 1 modules ./main.js 6:0-15
|
||||
webpack x.x.x compiled successfully in X ms"
|
||||
`;
|
||||
|
||||
|
@ -4110,8 +4159,16 @@ switched:
|
|||
./index.js 1.19 KiB [built] [code generated]
|
||||
chunk (runtime: main) switched-main-879072e3.js (main-879072e3) 1.68 KiB ={1}= ={59}= ={318}= ={410}= ={520}= ={663}= ={869}= ={997}= [initial] [rendered]
|
||||
> ./ main
|
||||
modules by path ./subfolder/*.js 1.1 KiB 11 modules
|
||||
modules by path ./*.js 594 bytes 9 modules
|
||||
modules by path ./subfolder/*.js 1.1 KiB
|
||||
./subfolder/big.js?1 267 bytes [built] [code generated]
|
||||
./subfolder/big.js?2 267 bytes [built] [code generated]
|
||||
./subfolder/small.js?1 66 bytes [built] [code generated]
|
||||
+ 8 modules
|
||||
modules by path ./*.js 594 bytes
|
||||
./small.js?1 66 bytes [built] [code generated]
|
||||
./small.js?2 66 bytes [built] [code generated]
|
||||
./small.js?3 66 bytes [built] [code generated]
|
||||
+ 6 modules
|
||||
chunk (runtime: main) switched-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.01 KiB (runtime) ={1}= ={59}= ={318}= ={410}= ={520}= ={581}= ={869}= ={997}= [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 3.01 KiB 5 modules
|
||||
|
@ -4123,13 +4180,13 @@ switched:
|
|||
./node_modules/small.js?2 66 bytes [built] [code generated]
|
||||
chunk (runtime: main) switched-main-7aeafcb2.js (main-7aeafcb2) 1.62 KiB ={1}= ={59}= ={318}= ={410}= ={520}= ={581}= ={663}= ={869}= [initial] [rendered]
|
||||
> ./ main
|
||||
modules by path ./inner-module/*.js 594 bytes 9 modules
|
||||
modules by path ./inner-module/*.js 594 bytes
|
||||
./inner-module/small.js?1 66 bytes [built] [code generated]
|
||||
+ 8 modules
|
||||
modules by path ./in-some-directory/*.js 531 bytes
|
||||
./in-some-directory/big.js?1 267 bytes [built] [code generated]
|
||||
./in-some-directory/small.js?1 66 bytes [built] [code generated]
|
||||
./in-some-directory/small.js?2 66 bytes [built] [code generated]
|
||||
./in-some-directory/small.js?3 66 bytes [built] [code generated]
|
||||
./in-some-directory/small.js?4 66 bytes [built] [code generated]
|
||||
+ 3 modules
|
||||
modules by path ./*.js 534 bytes
|
||||
./big.js?1 267 bytes [built] [code generated]
|
||||
./big.js?2 267 bytes [built] [code generated]
|
||||
|
|
|
@ -60,7 +60,7 @@ it("should be able to combine chunks by name", function () {
|
|||
case "d":
|
||||
return import(/* webpackChunkName: "name-3" */ "./dir7/d");
|
||||
default:
|
||||
throw new Error("Unexcepted test data");
|
||||
throw new Error("Unexpected test data");
|
||||
}
|
||||
}
|
||||
return testChunkLoading(load, false, true);
|
||||
|
@ -86,7 +86,7 @@ it("should be able to use weak mode (without context)", function () {
|
|||
case "c":
|
||||
return import(/* webpackMode: "weak" */ "./dir9/c");
|
||||
default:
|
||||
throw new Error("Unexcepted test data");
|
||||
throw new Error("Unexpected test data");
|
||||
}
|
||||
}
|
||||
require("./dir9/a"); // chunks served manually by the user
|
||||
|
|
|
@ -94,6 +94,7 @@ it("should be able to use named chunks in import()", function(done) {
|
|||
});
|
||||
|
||||
it("should be able to use named chunk in context import()", function(done) {
|
||||
// cspell:ignore mpty
|
||||
var mpty = "mpty";
|
||||
var sync = false;
|
||||
import("./e" + mpty + "2" /* webpackChunkName: "context-named-chunk" */).then(function(result) {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
it("should replace Object.defineProperty correctly with brakets", () => {
|
||||
it("should replace Object.defineProperty correctly with brackets", () => {
|
||||
expect(require("./module").test).toBe(true);
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module.exports = [
|
||||
[
|
||||
/export '__esModule' \(imported as 'm1'\) was not found in '\.\/analysable-module\.js'/
|
||||
/export '__esModule' \(imported as 'm1'\) was not found in '\.\/analyzable-module\.js'/
|
||||
],
|
||||
[
|
||||
/export '__esModule' \(imported as 'm1'\) was not found in '\.\/analysable-module\.js'/
|
||||
/export '__esModule' \(imported as 'm1'\) was not found in '\.\/analyzable-module\.js'/
|
||||
]
|
||||
];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as m1 from "./analysable-module.js";
|
||||
import * as m1 from "./analyzable-module.js";
|
||||
import * as m2 from "./weird-module.js";
|
||||
import * as m3 from "./esModule.js";
|
||||
import d1 from "./analysable-module.js";
|
||||
import d1 from "./analyzable-module.js";
|
||||
import d2 from "./weird-module.js";
|
||||
import d3 from "./esModule.js";
|
||||
|
||||
|
@ -22,7 +22,7 @@ it("should include non-enumerable properties (non-mjs)", () => {
|
|||
});
|
||||
|
||||
it("should include non-enumerable properties (non-mjs, promise)", () =>
|
||||
import("./analysable-module").then(m1 => {
|
||||
import("./analyzable-module").then(m1 => {
|
||||
const ns = m1;
|
||||
|
||||
expect(m1.prop).toBe(true);
|
||||
|
@ -108,7 +108,7 @@ it("should include non-enumerable properties with __esModule (non-mjs)", () => {
|
|||
});
|
||||
|
||||
it("should include non-enumerable properties with __esModule (non-mjs, promise)", () =>
|
||||
import("./analysable-module").then(m3 => {
|
||||
import("./analyzable-module").then(m3 => {
|
||||
const ns = m3;
|
||||
|
||||
expect(m3.prop).toBe(true);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import * as m1 from "./analysable-module.js";
|
||||
import * as m1 from "./analyzable-module.js";
|
||||
import * as m2 from "./weird-module.js";
|
||||
import * as m3 from "./esModule.js";
|
||||
import d1 from "./analysable-module.js";
|
||||
import d1 from "./analyzable-module.js";
|
||||
import d2 from "./weird-module.js";
|
||||
import d3 from "./esModule.js";
|
||||
|
||||
it("should include non-enumable properties (mjs)", () => {
|
||||
it("should include non-enumerable properties (mjs)", () => {
|
||||
const ns = m1;
|
||||
|
||||
expect(m1.prop).toBe(true);
|
||||
|
@ -21,8 +21,8 @@ it("should include non-enumable properties (mjs)", () => {
|
|||
expect(ns.__esModule).toBe(true);
|
||||
});
|
||||
|
||||
it("should include non-enumable properties (mjs, promise)", () =>
|
||||
import("./analysable-module.js").then(m1 => {
|
||||
it("should include non-enumerable properties (mjs, promise)", () =>
|
||||
import("./analyzable-module.js").then(m1 => {
|
||||
const ns = m1;
|
||||
|
||||
expect(m1.prop).toBe(true);
|
||||
|
@ -91,7 +91,7 @@ it("should not include prototype properties and symbols (mjs, promise)", () =>
|
|||
expect(ns.__esModule).toBe(true);
|
||||
}));
|
||||
|
||||
it("should include non-enumable properties with __esModule (non-mjs)", () => {
|
||||
it("should include non-enumerable properties with __esModule (non-mjs)", () => {
|
||||
const ns = m3;
|
||||
|
||||
expect(m3.prop).toBe(true);
|
||||
|
@ -107,8 +107,8 @@ it("should include non-enumable properties with __esModule (non-mjs)", () => {
|
|||
expect(ns.__esModule).toBe(true);
|
||||
});
|
||||
|
||||
it("should include non-enumable properties with __esModule (non-mjs, promise)", () =>
|
||||
import("./analysable-module.js").then(m3 => {
|
||||
it("should include non-enumerable properties with __esModule (non-mjs, promise)", () =>
|
||||
import("./analyzable-module.js").then(m3 => {
|
||||
const ns = m3;
|
||||
|
||||
expect(m3.prop).toBe(true);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module.exports = [
|
||||
[
|
||||
/export '__esModule' \(imported as 'm1'\) was not found in '\.\/analysable-module\.js'/
|
||||
/export '__esModule' \(imported as 'm1'\) was not found in '\.\/analyzable-module\.js'/
|
||||
],
|
||||
[/export 'default' \(imported as 'm3'\) was not found in '\.\/esModule\.js'/],
|
||||
[/export 'default' \(imported as 'd3'\) was not found in '\.\/esModule\.js'/],
|
||||
[
|
||||
/export '__esModule' \(imported as 'm1'\) was not found in '\.\/analysable-module\.js'/
|
||||
/export '__esModule' \(imported as 'm1'\) was not found in '\.\/analyzable-module\.js'/
|
||||
],
|
||||
[/export 'default' \(imported as 'm3'\) was not found in '\.\/esModule\.js'/],
|
||||
[/export 'default' \(imported as 'd3'\) was not found in '\.\/esModule\.js'/]
|
||||
|
|
|
@ -14,6 +14,6 @@ expect(function() {
|
|||
export default 1234;
|
||||
|
||||
if(eval("typeof exports !== \"undefined\"")) {
|
||||
// exports is node.js exports and not webpacks
|
||||
// exports is node.js exports and not webpack's
|
||||
expect(Object.keys(exports)).toEqual([]);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import {
|
|||
named6 as snamed6
|
||||
} from "./named-with-namespace-no-side";
|
||||
|
||||
it("should point out conflicts from named to namespace (without sideeffects)", () => {
|
||||
it("should point out conflicts from named to namespace (without side effects)", () => {
|
||||
expect(snamed1).toBe(1);
|
||||
expect(snamed2).toBe(2);
|
||||
expect(snamed3).toBe(2);
|
||||
|
|
|
@ -6,7 +6,7 @@ it("should allow to import a variable named define (call)", () => {
|
|||
expect(define()).toBe("ok");
|
||||
});
|
||||
|
||||
it("should allow to import a variable named define (expresion)", () => {
|
||||
it("should allow to import a variable named define (expression)", () => {
|
||||
const d = i(define);
|
||||
expect(d()).toBe("ok");
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import array from "./tracker";
|
||||
import { b } from "./module";
|
||||
|
||||
it("should evaulate modules in the correct order", () => {
|
||||
it("should evaluate modules in the correct order", () => {
|
||||
expect(b).toEqual("b");
|
||||
expect(array).toEqual(["b", "a"]);
|
||||
})
|
||||
|
|
|
@ -5,6 +5,15 @@ import dataSvg from "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53M
|
|||
const urlSvg = new URL(
|
||||
"data:image/svg;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MDAgNjAwIj48dGl0bGU+aWNvbi1zcXVhcmUtc21hbGw8L3RpdGxlPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0zMDAgLjFMNTY1IDE1MHYyOTkuOUwzMDAgNTk5LjggMzUgNDQ5LjlWMTUweiIvPjxwYXRoIGZpbGw9IiM4RUQ2RkIiIGQ9Ik01MTcuNyA0MzkuNUwzMDguOCA1NTcuOHYtOTJMNDM5IDM5NC4xbDc4LjcgNDUuNHptMTQuMy0xMi45VjE3OS40bC03Ni40IDQ0LjF2MTU5bDc2LjQgNDQuMXpNODEuNSA0MzkuNWwyMDguOSAxMTguMnYtOTJsLTEzMC4yLTcxLjYtNzguNyA0NS40em0tMTQuMy0xMi45VjE3OS40bDc2LjQgNDQuMXYxNTlsLTc2LjQgNDQuMXptOC45LTI2My4yTDI5MC40IDQyLjJ2ODlsLTEzNy4zIDc1LjUtMS4xLjYtNzUuOS00My45em00NDYuOSAwTDMwOC44IDQyLjJ2ODlMNDQ2IDIwNi44bDEuMS42IDc1LjktNDR6Ii8+PHBhdGggZmlsbD0iIzFDNzhDMCIgZD0iTTI5MC40IDQ0NC44TDE2MiAzNzQuMVYyMzQuMmwxMjguNCA3NC4xdjEzNi41em0xOC40IDBsMTI4LjQtNzAuNnYtMTQwbC0xMjguNCA3NC4xdjEzNi41ek0yOTkuNiAzMDN6bS0xMjktODVsMTI5LTcwLjlMNDI4LjUgMjE4bC0xMjguOSA3NC40LTEyOS03NC40eiIvPjwvc3ZnPgo="
|
||||
);
|
||||
const urlSvg2 = new URL(
|
||||
"data:image/svg+xml;p=1;q=2,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke=\"%23343a40\" stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e",
|
||||
import.meta.url
|
||||
);
|
||||
const helloWorld = new URL("data:text/plain,Hello", import.meta.url);
|
||||
const helloWorldBase64 = new URL(
|
||||
"data:text/plain;base64,SGVsbG8=",
|
||||
import.meta.url
|
||||
);
|
||||
|
||||
it("should generate various data-url types", () => {
|
||||
expect(png).toContain("data:image/png;base64,");
|
||||
|
@ -12,4 +21,11 @@ it("should generate various data-url types", () => {
|
|||
expect(jpg).toContain("data:image/jpeg;base64,");
|
||||
expect(dataSvg).toContain("data:image/svg+xml;base64,");
|
||||
expect(urlSvg.href).toContain("data:image/svg;base64,");
|
||||
expect(urlSvg2.href).toContain(
|
||||
"data:image/svg+xml;p=1;q=2,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke=\"%23343a40\" stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"
|
||||
);
|
||||
expect(helloWorld.href).toContain("data:text/plain,Hello%2C%20World%21");
|
||||
expect(helloWorldBase64.href).toContain(
|
||||
"data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="
|
||||
);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/** @type {import("../../../../").LoaderDefinition<{ f(): any }>} */
|
||||
module.exports = function (source) {
|
||||
return `${source}, World!`;
|
||||
};
|
|
@ -19,6 +19,11 @@ module.exports = {
|
|||
maxSize: Infinity
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
mimetype: "text/plain",
|
||||
type: "asset/inline",
|
||||
loader: "./loader"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import url from "../_images/file.png";
|
||||
import url2 from "../_images/file.jpg";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
it("should output asset with path", () => {
|
||||
expect(url).toEqual("images/file.png");
|
||||
expect(() => fs.statSync(url)).toThrowError(
|
||||
expect.objectContaining({
|
||||
code: "ENOENT"
|
||||
})
|
||||
);
|
||||
expect(url2).toEqual("images/file.jpg");
|
||||
|
||||
expect(fs.existsSync(path.join(__STATS__.outputPath, url))).toBe(false);
|
||||
expect(fs.existsSync(path.join(__STATS__.outputPath, url2))).toBe(true);
|
||||
});
|
||||
|
|
|
@ -8,10 +8,14 @@ module.exports = {
|
|||
rules: [
|
||||
{
|
||||
test: /\.png$/,
|
||||
type: "asset",
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
emit: false
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.jpg$/,
|
||||
type: "asset/resource"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import url from "../_images/file.png";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
it("should emit asset with module.generator.asset.outputPath", () => {
|
||||
expect(url).toEqual("https://cdn/assets/file.png");
|
||||
|
||||
const emitPath = path.join(__STATS__.outputPath, "cdn-assets/file.png")
|
||||
expect(fs.existsSync(emitPath)).toBe(true);
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
mode: "development",
|
||||
output: {
|
||||
assetModuleFilename: "file[ext]"
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.png$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
publicPath: "https://cdn/assets/",
|
||||
outputPath: "cdn-assets/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
it("should ignore missing modules as entries", function() {
|
||||
// a.js and b.js should be evaulated correctly
|
||||
// a.js and b.js should be evaluated correctly
|
||||
});
|
||||
|
||||
it("should use WebpackMissingModule when evaluating missing modules", function() {
|
||||
|
|
|
@ -1438,7 +1438,7 @@ async function _createFormWidget(positionTypeId, headerPK, contentId = null) {
|
|||
_isNewDataset
|
||||
)
|
||||
);
|
||||
const renderFormInConainter = contentId ? contentId : _getFormSelector();
|
||||
const renderFormInContainer = contentId ? contentId : _getFormSelector();
|
||||
await form.initForm(
|
||||
_getModuleName(),
|
||||
positionTypeId,
|
||||
|
@ -1447,7 +1447,7 @@ async function _createFormWidget(positionTypeId, headerPK, contentId = null) {
|
|||
_formData,
|
||||
_staticData,
|
||||
_isNewDataset,
|
||||
renderFormInConainter,
|
||||
renderFormInContainer,
|
||||
headerPK
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
it("should ignore case insenstive chars when generating maxSize filenames", () =>
|
||||
it("should ignore case insensitive chars when generating maxSize filenames", () =>
|
||||
import(/* webpackChunkName: "chunk" */ "./chunk").then(
|
||||
({ default: value }) => {
|
||||
expect(value).toContain("a111");
|
||||
|
|
|
@ -68,7 +68,7 @@ function run({ default: value2, asyncDep: value3 }) {
|
|||
__filename,
|
||||
path.resolve(__dirname, "../../../node_modules/.yarn-integrity")
|
||||
].concat(esm ? ["../../fixtures/buildDependencies/esm.mjs"] : []),
|
||||
invalid: options.invalidBuildDepdencies
|
||||
invalid: options.invalidBuildDependencies
|
||||
? ["should-fail-resolving"]
|
||||
: [],
|
||||
optionalDepsTest: [
|
||||
|
|
|
@ -20,9 +20,21 @@ it("should compile to lazy imported module", done => {
|
|||
expect(generation).toBe(1);
|
||||
import("./module").then(result => {
|
||||
expect(result).toHaveProperty("default", 43);
|
||||
setTimeout(() => {
|
||||
done();
|
||||
}, 1000);
|
||||
expect(generation).toBe(1);
|
||||
module.hot.accept("./module", () => {
|
||||
generation += 10;
|
||||
});
|
||||
NEXT(
|
||||
require("../../update")(done, true, () => {
|
||||
import("./module").then(result => {
|
||||
expect(result).toHaveProperty("default", 44);
|
||||
expect(generation).toBe(11);
|
||||
setTimeout(() => {
|
||||
done();
|
||||
}, 1000);
|
||||
}, done);
|
||||
})
|
||||
);
|
||||
}, done);
|
||||
})
|
||||
);
|
||||
|
|
|
@ -3,3 +3,5 @@ export default 42;
|
|||
export default 42;
|
||||
---
|
||||
export default 43;
|
||||
---
|
||||
export default 44;
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import value from "./module";
|
||||
|
||||
const neverCalled = () => import("./lazy");
|
||||
|
||||
it("should compile to lazy imported module", done => {
|
||||
let generation = 0;
|
||||
module.hot.accept("./module", () => {
|
||||
generation++;
|
||||
});
|
||||
expect(value).toBe(42);
|
||||
expect(generation).toBe(0);
|
||||
NEXT(
|
||||
require("../../update")(done, true, () => {
|
||||
expect(value).toBe(43);
|
||||
expect(generation).toBe(1);
|
||||
NEXT(
|
||||
require("../../update")(done, true, () => {
|
||||
expect(value).toBe(44);
|
||||
expect(generation).toBe(2);
|
||||
done();
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
export default 123;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue