Merge branch 'main' into support-cjs-static-named-exports
This commit is contained in:
commit
2f2991a967
|
@ -3,4 +3,5 @@ test/statsCases/** eol=lf
|
|||
examples/* eol=lf
|
||||
bin/* eol=lf
|
||||
*.svg eol=lf
|
||||
*.css eol=lf
|
||||
**/*webpack.lock.data/** -text
|
||||
|
|
|
@ -445,6 +445,14 @@ export type CompareBeforeEmit = boolean;
|
|||
* This option enables cross-origin loading of chunks.
|
||||
*/
|
||||
export type CrossOriginLoading = false | "anonymous" | "use-credentials";
|
||||
/**
|
||||
* Specifies the filename template of non-initial output css 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.
|
||||
*/
|
||||
export type CssChunkFilename = FilenameTemplate;
|
||||
/**
|
||||
* Specifies the filename template of output css 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.
|
||||
*/
|
||||
export type CssFilename = FilenameTemplate;
|
||||
/**
|
||||
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
|
||||
*/
|
||||
|
@ -1978,6 +1986,14 @@ export interface Output {
|
|||
* This option enables cross-origin loading of chunks.
|
||||
*/
|
||||
crossOriginLoading?: CrossOriginLoading;
|
||||
/**
|
||||
* Specifies the filename template of non-initial output css 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.
|
||||
*/
|
||||
cssChunkFilename?: CssChunkFilename;
|
||||
/**
|
||||
* Specifies the filename template of output css 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.
|
||||
*/
|
||||
cssFilename?: CssFilename;
|
||||
/**
|
||||
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
|
||||
*/
|
||||
|
@ -2694,6 +2710,14 @@ export interface AssetResourceGeneratorOptions {
|
|||
*/
|
||||
publicPath?: RawPublicPath;
|
||||
}
|
||||
/**
|
||||
* Generator options for css modules.
|
||||
*/
|
||||
export interface CssGeneratorOptions {}
|
||||
/**
|
||||
* Parser options for css modules.
|
||||
*/
|
||||
export interface CssParserOptions {}
|
||||
/**
|
||||
* No generator options are supported for this module type.
|
||||
*/
|
||||
|
@ -2772,6 +2796,10 @@ export interface ExperimentsCommon {
|
|||
* Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.
|
||||
*/
|
||||
cacheUnaffected?: boolean;
|
||||
/**
|
||||
* Enable css support.
|
||||
*/
|
||||
css?: boolean;
|
||||
/**
|
||||
* Apply defaults of next major version.
|
||||
*/
|
||||
|
@ -3114,6 +3142,14 @@ export interface OutputNormalized {
|
|||
* This option enables cross-origin loading of chunks.
|
||||
*/
|
||||
crossOriginLoading?: CrossOriginLoading;
|
||||
/**
|
||||
* Specifies the filename template of non-initial output css 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.
|
||||
*/
|
||||
cssChunkFilename?: CssChunkFilename;
|
||||
/**
|
||||
* Specifies the filename template of output css 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.
|
||||
*/
|
||||
cssFilename?: CssFilename;
|
||||
/**
|
||||
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,535 @@
|
|||
# example.js
|
||||
|
||||
```javascript
|
||||
import "./style.css";
|
||||
import "./style2.css";
|
||||
import { main } from "./style.module.css";
|
||||
import("./lazy-style.css");
|
||||
|
||||
document.getElementsByTagName("main")[0].className = main;
|
||||
```
|
||||
|
||||
# style.css
|
||||
|
||||
```javascript
|
||||
@import "style-imported.css";
|
||||
@import "https://fonts.googleapis.com/css?family=Open+Sans";
|
||||
|
||||
body {
|
||||
background: green;
|
||||
font-family: "Open Sans";
|
||||
}
|
||||
```
|
||||
|
||||
# dist/output.js
|
||||
|
||||
```javascript
|
||||
/******/ (() => { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ 3:
|
||||
/*!*************************!*\
|
||||
!*** ./images/file.png ***!
|
||||
\*************************/
|
||||
/*! default exports */
|
||||
/*! exports [not provided] [no usage info] */
|
||||
/*! runtime requirements: module, __webpack_require__.p, __webpack_require__.* */
|
||||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||||
|
||||
module.exports = __webpack_require__.p + "89a353e9c515885abd8e.png";
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
```
|
||||
|
||||
<details><summary><code>/* webpack runtime code */</code></summary>
|
||||
|
||||
``` js
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = __webpack_modules__;
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/ensure chunk */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.f = {};
|
||||
/******/ // This file contains only the entry chunk.
|
||||
/******/ // The chunk loading function for additional chunks
|
||||
/******/ __webpack_require__.e = (chunkId) => {
|
||||
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
||||
/******/ __webpack_require__.f[key](chunkId, promises);
|
||||
/******/ return promises;
|
||||
/******/ }, []));
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/get css chunk filename */
|
||||
/******/ (() => {
|
||||
/******/ // This function allow to reference async chunks
|
||||
/******/ __webpack_require__.k = (chunkId) => {
|
||||
/******/ // return url for filenames based on template
|
||||
/******/ return "" + chunkId + ".output.css";
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/get javascript chunk filename */
|
||||
/******/ (() => {
|
||||
/******/ // This function allow to reference async chunks
|
||||
/******/ __webpack_require__.u = (chunkId) => {
|
||||
/******/ // return url for filenames based on template
|
||||
/******/ return "" + chunkId + ".output.js";
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/load script */
|
||||
/******/ (() => {
|
||||
/******/ var inProgress = {};
|
||||
/******/ var dataWebpackPrefix = "app:";
|
||||
/******/ // loadScript function to load a script via script tag
|
||||
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
||||
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
||||
/******/ var script, needAttach;
|
||||
/******/ if(key !== undefined) {
|
||||
/******/ var scripts = document.getElementsByTagName("script");
|
||||
/******/ for(var i = 0; i < scripts.length; i++) {
|
||||
/******/ var s = scripts[i];
|
||||
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ if(!script) {
|
||||
/******/ needAttach = true;
|
||||
/******/ script = document.createElement('script');
|
||||
/******/
|
||||
/******/ script.charset = 'utf-8';
|
||||
/******/ script.timeout = 120;
|
||||
/******/ if (__webpack_require__.nc) {
|
||||
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
||||
/******/ }
|
||||
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
||||
/******/ script.src = url;
|
||||
/******/ }
|
||||
/******/ inProgress[url] = [done];
|
||||
/******/ var onScriptComplete = (prev, event) => {
|
||||
/******/ // avoid mem leaks in IE.
|
||||
/******/ script.onerror = script.onload = null;
|
||||
/******/ clearTimeout(timeout);
|
||||
/******/ var doneFns = inProgress[url];
|
||||
/******/ delete inProgress[url];
|
||||
/******/ script.parentNode && script.parentNode.removeChild(script);
|
||||
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
||||
/******/ if(prev) return prev(event);
|
||||
/******/ }
|
||||
/******/ ;
|
||||
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
||||
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
||||
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
||||
/******/ needAttach && document.head.appendChild(script);
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/make namespace object */
|
||||
/******/ (() => {
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = (exports) => {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/publicPath */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.p = "dist/";
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/css loading */
|
||||
/******/ (() => {
|
||||
/******/ // object to store loaded and loading chunks
|
||||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
||||
/******/ var installedChunks = {};
|
||||
/******/
|
||||
/******/ var uniqueName = "app";
|
||||
/******/ var loadCssChunkData = (chunkId, link) => {
|
||||
/******/ var data, token = "", token2, exports = {}, exportsWithId = [], exportsWithDashes = [], i = 0, cc = 1;
|
||||
/******/ try { if(!link) link = loadStylesheet(chunkId); data = link.sheet.cssRules; data = data[data.length - 1].style; } catch(e) { data = getComputedStyle(document.head); }
|
||||
/******/ data = data.getPropertyValue("--webpack-" + uniqueName + "-" + chunkId);
|
||||
/******/ if(!data) return;
|
||||
/******/ for(; cc; i++) {
|
||||
/******/ cc = data.charCodeAt(i);
|
||||
/******/ if(cc == 40) { token2 = token; token = ""; }
|
||||
/******/ else if(cc == 41) { exports[token2.replace(/^_/, "")] = token.replace(/^_/, ""); token = ""; }
|
||||
/******/ else if(cc == 47 || cc == 37) { token = token.replace(/^_/, ""); exports[token] = token; exportsWithId.push(token); if(cc == 37) exportsWithDashes.push(token); token = ""; }
|
||||
/******/ else if(!cc || cc == 44) { token = token.replace(/^_/, ""); exportsWithId.forEach((x) => (exports[x] = uniqueName + "-" + token + "-" + exports[x])); exportsWithDashes.forEach((x) => (exports[x] = "--" + exports[x])); __webpack_require__.r(exports); __webpack_require__.m[token] = ((exports, module) => {
|
||||
/******/ module.exports = exports;
|
||||
/******/ }).bind(null, exports); token = ""; exports = {}; exportsWithId.length = 0; }
|
||||
/******/ else if(cc == 92) { token += data[++i] }
|
||||
/******/ else { token += data[i]; }
|
||||
/******/ }
|
||||
/******/ installedChunks[chunkId] = 0;
|
||||
/******/ }
|
||||
/******/ var loadingAttribute = "data-webpack-loading";
|
||||
/******/ var loadStylesheet = (chunkId, url, done) => {
|
||||
/******/ var link, needAttach, key = "chunk-" + chunkId;
|
||||
/******/
|
||||
/******/ var links = document.getElementsByTagName("link");
|
||||
/******/ for(var i = 0; i < links.length; i++) {
|
||||
/******/ var l = links[i];
|
||||
/******/ if(l.getAttribute("href") == url || l.getAttribute("data-webpack") == uniqueName + ":" + key) { link = l; break; }
|
||||
/******/ }
|
||||
/******/ if(!url) return link;
|
||||
/******/
|
||||
/******/ if(!link) {
|
||||
/******/ needAttach = true;
|
||||
/******/ link = document.createElement('link');
|
||||
/******/ link.setAttribute("data-webpack", uniqueName + ":" + key);
|
||||
/******/ link.setAttribute(loadingAttribute, 1);
|
||||
/******/ link.rel = "stylesheet";
|
||||
/******/
|
||||
/******/ link.href = url;
|
||||
/******/ }
|
||||
/******/ var onLinkComplete = (prev, event) => {
|
||||
/******/ link.onerror = link.onload = null;
|
||||
/******/ link.removeAttribute(loadingAttribute);
|
||||
/******/ clearTimeout(timeout);
|
||||
/******/ if(event && event.type != "load") link.parentNode.removeChild(link)
|
||||
/******/ done(event);
|
||||
/******/ if(prev) return prev(event);
|
||||
/******/ };
|
||||
/******/ if(link.getAttribute(loadingAttribute)) {
|
||||
/******/ var timeout = setTimeout(onLinkComplete.bind(null, undefined, { type: 'timeout', target: link }), 120000);
|
||||
/******/ 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;
|
||||
/******/ };
|
||||
/******/ loadCssChunkData(0);
|
||||
/******/
|
||||
/******/ __webpack_require__.f.css = (chunkId, promises) => {
|
||||
/******/ // css chunk loading
|
||||
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
||||
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
||||
/******/
|
||||
/******/ // a Promise means "currently loading".
|
||||
/******/ if(installedChunkData) {
|
||||
/******/ promises.push(installedChunkData[2]);
|
||||
/******/ } else {
|
||||
/******/ if(true) { // all chunks have CSS
|
||||
/******/ // setup Promise in chunk cache
|
||||
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
||||
/******/ promises.push(installedChunkData[2] = promise);
|
||||
/******/
|
||||
/******/ // start chunk loading
|
||||
/******/ var url = __webpack_require__.p + __webpack_require__.k(chunkId);
|
||||
/******/ // create error before stack unwound to get useful stacktrace later
|
||||
/******/ var error = new Error();
|
||||
/******/ var loadingEnded = (event) => {
|
||||
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
||||
/******/ installedChunkData = installedChunks[chunkId];
|
||||
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
||||
/******/ if(installedChunkData) {
|
||||
/******/ if(event.type !== "load") {
|
||||
/******/ var errorType = event && event.type;
|
||||
/******/ var realSrc = event && event.target && event.target.src;
|
||||
/******/ error.message = 'Loading css chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
||||
/******/ error.name = 'ChunkLoadError';
|
||||
/******/ error.type = errorType;
|
||||
/******/ error.request = realSrc;
|
||||
/******/ installedChunkData[1](error);
|
||||
/******/ } else {
|
||||
/******/ loadCssChunkData(chunkId, link);
|
||||
/******/ installedChunkData[0]();
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ var link = loadStylesheet(chunkId, url, loadingEnded);
|
||||
/******/ } else installedChunks[chunkId] = 0;
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // no hmr
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/jsonp chunk loading */
|
||||
/******/ (() => {
|
||||
/******/ // no baseURI
|
||||
/******/
|
||||
/******/ // object to store loaded and loading chunks
|
||||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
||||
/******/ var installedChunks = {
|
||||
/******/ 0: 0
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
||||
/******/ // JSONP chunk loading for javascript
|
||||
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
||||
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
||||
/******/
|
||||
/******/ // a Promise means "currently loading".
|
||||
/******/ if(installedChunkData) {
|
||||
/******/ promises.push(installedChunkData[2]);
|
||||
/******/ } else {
|
||||
/******/ if(0 == chunkId) {
|
||||
/******/ // setup Promise in chunk cache
|
||||
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
||||
/******/ promises.push(installedChunkData[2] = promise);
|
||||
/******/
|
||||
/******/ // start chunk loading
|
||||
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
||||
/******/ // create error before stack unwound to get useful stacktrace later
|
||||
/******/ var error = new Error();
|
||||
/******/ var loadingEnded = (event) => {
|
||||
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
||||
/******/ installedChunkData = installedChunks[chunkId];
|
||||
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
||||
/******/ if(installedChunkData) {
|
||||
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
||||
/******/ var realSrc = event && event.target && event.target.src;
|
||||
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
||||
/******/ error.name = 'ChunkLoadError';
|
||||
/******/ error.type = errorType;
|
||||
/******/ error.request = realSrc;
|
||||
/******/ installedChunkData[1](error);
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
||||
/******/ } else installedChunks[chunkId] = 0;
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // no prefetching
|
||||
/******/
|
||||
/******/ // no preloaded
|
||||
/******/
|
||||
/******/ // no HMR
|
||||
/******/
|
||||
/******/ // no HMR manifest
|
||||
/******/
|
||||
/******/ // no on chunks loaded
|
||||
/******/
|
||||
/******/ // install a JSONP callback for chunk loading
|
||||
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
||||
/******/ var [chunkIds, moreModules, runtime] = data;
|
||||
/******/ // add "moreModules" to the modules object,
|
||||
/******/ // then flag all "chunkIds" as loaded and fire callback
|
||||
/******/ var moduleId, chunkId, i = 0;
|
||||
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
||||
/******/ for(moduleId in moreModules) {
|
||||
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
||||
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ if(runtime) var result = runtime(__webpack_require__);
|
||||
/******/ }
|
||||
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
||||
/******/ for(;i < chunkIds.length; i++) {
|
||||
/******/ chunkId = chunkIds[i];
|
||||
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
||||
/******/ installedChunks[chunkId][0]();
|
||||
/******/ }
|
||||
/******/ installedChunks[chunkIds[i]] = 0;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ var chunkLoadingGlobal = self["webpackChunkapp"] = self["webpackChunkapp"] || [];
|
||||
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
||||
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
||||
/******/ })();
|
||||
/******/
|
||||
/************************************************************************/
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
``` js
|
||||
var __webpack_exports__ = {};
|
||||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
||||
(() => {
|
||||
/*!********************!*\
|
||||
!*** ./example.js ***!
|
||||
\********************/
|
||||
/*! namespace exports */
|
||||
/*! exports [not provided] [no usage info] */
|
||||
/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.e, __webpack_require__.* */
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./style.css */ 1);
|
||||
/* harmony import */ var _style2_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style2.css */ 5);
|
||||
/* harmony import */ var _style_module_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.module.css */ 6);
|
||||
|
||||
|
||||
|
||||
__webpack_require__.e(/*! import() */ 1).then(__webpack_require__.bind(__webpack_require__, /*! ./lazy-style.css */ 7));
|
||||
|
||||
document.getElementsByTagName("main")[0].className = _style_module_css__WEBPACK_IMPORTED_MODULE_2__.main;
|
||||
|
||||
})();
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
```
|
||||
|
||||
# dist/output.css
|
||||
|
||||
```javascript
|
||||
@import url("https://fonts.googleapis.com/css?family=Open+Sans");
|
||||
.img {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
background: url(89a353e9c515885abd8e.png);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
background: green;
|
||||
font-family: "Open Sans";
|
||||
}
|
||||
|
||||
body {
|
||||
background: red;
|
||||
}
|
||||
|
||||
:root {
|
||||
--app-6-large: 72px;
|
||||
}
|
||||
|
||||
.app-6-main {
|
||||
font-size: var(--app-6-large);
|
||||
color: darkblue;
|
||||
}
|
||||
|
||||
head{--webpack-app-0:_4,_2,_1,_5,large%main/_6;}
|
||||
```
|
||||
|
||||
## production
|
||||
|
||||
```javascript
|
||||
@import url("https://fonts.googleapis.com/css?family=Open+Sans");
|
||||
.img {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
background: url(89a353e9c515885abd8e.png);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
background: green;
|
||||
font-family: "Open Sans";
|
||||
}
|
||||
|
||||
body {
|
||||
background: red;
|
||||
}
|
||||
|
||||
:root {
|
||||
--app-491-b: 72px;
|
||||
}
|
||||
|
||||
.app-491-D {
|
||||
font-size: var(--app-491-b);
|
||||
color: darkblue;
|
||||
}
|
||||
|
||||
head{--webpack-app-179:_548,_431,_258,_268,b%D/_491;}
|
||||
```
|
||||
|
||||
# dist/1.output.css
|
||||
|
||||
```javascript
|
||||
body {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
head{--webpack-app-1:_7;}
|
||||
```
|
||||
|
||||
# Info
|
||||
|
||||
## Unoptimized
|
||||
|
||||
```
|
||||
assets by chunk 16.8 KiB (name: main)
|
||||
asset output.js 16.4 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
|
||||
chunk (runtime: main) output.js, output.css (main) 218 bytes (javascript) 335 bytes (css) 14.6 KiB (asset) 42 bytes (css-import) 9.94 KiB (runtime) [entry] [rendered]
|
||||
> ./example.js main
|
||||
runtime modules 9.94 KiB 9 modules
|
||||
dependent modules 42 bytes (javascript) 14.6 KiB (asset) 335 bytes (css) 42 bytes (css-import) [dependent] 6 modules
|
||||
./example.js 176 bytes [built] [code generated]
|
||||
[no exports]
|
||||
[used exports unknown]
|
||||
entry ./example.js main
|
||||
chunk (runtime: main) 1.output.css 23 bytes
|
||||
> ./lazy-style.css ./example.js 4:0-26
|
||||
./lazy-style.css 23 bytes [built] [code generated]
|
||||
[no exports]
|
||||
[used exports unknown]
|
||||
import() ./lazy-style.css ./example.js 4:0-26
|
||||
webpack 5.64.4 compiled successfully
|
||||
```
|
||||
|
||||
## Production mode
|
||||
|
||||
```
|
||||
assets by chunk 4.2 KiB (name: main)
|
||||
asset output.js 3.82 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.2 KiB (14.6 KiB) = output.js 3.82 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]
|
||||
[no exports]
|
||||
import() ./lazy-style.css ./example.js 4:0-26
|
||||
chunk (runtime: main) output.js, output.css (main) 218 bytes (javascript) 335 bytes (css) 14.6 KiB (asset) 42 bytes (css-import) 9.95 KiB (runtime) [entry] [rendered]
|
||||
> ./example.js main
|
||||
runtime modules 9.95 KiB 9 modules
|
||||
dependent modules 42 bytes (javascript) 14.6 KiB (asset) 335 bytes (css) 42 bytes (css-import) [dependent] 6 modules
|
||||
./example.js 176 bytes [built] [code generated]
|
||||
[no exports]
|
||||
[no exports used]
|
||||
entry ./example.js main
|
||||
webpack 5.64.4 compiled successfully
|
||||
```
|
|
@ -0,0 +1 @@
|
|||
require("../build-common");
|
|
@ -0,0 +1,6 @@
|
|||
import "./style.css";
|
||||
import "./style2.css";
|
||||
import { main } from "./style.module.css";
|
||||
import("./lazy-style.css");
|
||||
|
||||
document.getElementsByTagName("main")[0].className = main;
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,14 @@
|
|||
<html>
|
||||
<head>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="dist/0.output.css"
|
||||
data-webpack="app:chunk-0"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<main>Hello World</main>
|
||||
<p class="img"></p>
|
||||
<script src="dist/output.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
color: blue;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
.img {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
background: url("./images/file.png");
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
@import "style-imported.css";
|
||||
@import "https://fonts.googleapis.com/css?family=Open+Sans";
|
||||
|
||||
body {
|
||||
background: green;
|
||||
font-family: "Open Sans";
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
:root {
|
||||
--large: 72px;
|
||||
}
|
||||
|
||||
.main {
|
||||
font-size: var(--large);
|
||||
color: darkblue;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background: red;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
# example.js
|
||||
|
||||
```javascript
|
||||
_{{example.js}}_
|
||||
```
|
||||
|
||||
# style.css
|
||||
|
||||
```javascript
|
||||
_{{style.css}}_
|
||||
```
|
||||
|
||||
# dist/output.js
|
||||
|
||||
```javascript
|
||||
_{{dist/output.js}}_
|
||||
```
|
||||
|
||||
# dist/output.css
|
||||
|
||||
```javascript
|
||||
_{{dist/output.css}}_
|
||||
```
|
||||
|
||||
## production
|
||||
|
||||
```javascript
|
||||
_{{production:dist/output.css}}_
|
||||
```
|
||||
|
||||
# dist/1.output.css
|
||||
|
||||
```javascript
|
||||
_{{dist/1.output.css}}_
|
||||
```
|
||||
|
||||
# Info
|
||||
|
||||
## Unoptimized
|
||||
|
||||
```
|
||||
_{{stdout}}_
|
||||
```
|
||||
|
||||
## Production mode
|
||||
|
||||
```
|
||||
_{{production:stdout}}_
|
||||
```
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
output: {
|
||||
uniqueName: "app"
|
||||
},
|
||||
experiments: {
|
||||
css: true
|
||||
}
|
||||
};
|
|
@ -80,6 +80,8 @@ class Chunk {
|
|||
this.preventIntegration = false;
|
||||
/** @type {(string | function(PathData, AssetInfo=): string)?} */
|
||||
this.filenameTemplate = undefined;
|
||||
/** @type {(string | function(PathData, AssetInfo=): string)?} */
|
||||
this.cssFilenameTemplate = undefined;
|
||||
/** @private @type {SortableSet<ChunkGroup>} */
|
||||
this._groups = new SortableSet(undefined, compareChunkGroupsByIndex);
|
||||
/** @type {RuntimeSpec} */
|
||||
|
|
|
@ -3193,47 +3193,87 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|||
this;
|
||||
const results = this.codeGenerationResults;
|
||||
const errors = [];
|
||||
asyncLib.eachLimit(
|
||||
jobs,
|
||||
this.options.parallelism,
|
||||
({ module, hash, runtime, runtimes }, callback) => {
|
||||
this._codeGenerationModule(
|
||||
module,
|
||||
runtime,
|
||||
runtimes,
|
||||
hash,
|
||||
dependencyTemplates,
|
||||
chunkGraph,
|
||||
moduleGraph,
|
||||
runtimeTemplate,
|
||||
errors,
|
||||
results,
|
||||
(err, codeGenerated) => {
|
||||
if (codeGenerated) statModulesGenerated++;
|
||||
else statModulesFromCache++;
|
||||
callback(err);
|
||||
/** @type {Set<Module> | undefined} */
|
||||
let notCodeGeneratedModules = undefined;
|
||||
const runIteration = () => {
|
||||
let delayedJobs = [];
|
||||
let delayedModules = new Set();
|
||||
asyncLib.eachLimit(
|
||||
jobs,
|
||||
this.options.parallelism,
|
||||
(job, callback) => {
|
||||
const { module } = job;
|
||||
const { codeGenerationDependencies } = module;
|
||||
if (codeGenerationDependencies !== undefined) {
|
||||
if (
|
||||
notCodeGeneratedModules === undefined ||
|
||||
codeGenerationDependencies.some(dep => {
|
||||
const referencedModule = moduleGraph.getModule(dep);
|
||||
return notCodeGeneratedModules.has(referencedModule);
|
||||
})
|
||||
) {
|
||||
delayedJobs.push(job);
|
||||
delayedModules.add(module);
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
err => {
|
||||
if (err) return callback(err);
|
||||
if (errors.length > 0) {
|
||||
errors.sort(
|
||||
compareSelect(err => err.module, compareModulesByIdentifier)
|
||||
const { hash, runtime, runtimes } = job;
|
||||
this._codeGenerationModule(
|
||||
module,
|
||||
runtime,
|
||||
runtimes,
|
||||
hash,
|
||||
dependencyTemplates,
|
||||
chunkGraph,
|
||||
moduleGraph,
|
||||
runtimeTemplate,
|
||||
errors,
|
||||
results,
|
||||
(err, codeGenerated) => {
|
||||
if (codeGenerated) statModulesGenerated++;
|
||||
else statModulesFromCache++;
|
||||
callback(err);
|
||||
}
|
||||
);
|
||||
for (const error of errors) {
|
||||
this.errors.push(error);
|
||||
},
|
||||
err => {
|
||||
if (err) return callback(err);
|
||||
if (delayedJobs.length > 0) {
|
||||
if (delayedJobs.length === jobs.length) {
|
||||
return callback(
|
||||
new Error(
|
||||
`Unable to make progress during code generation because of circular code generation dependency: ${Array.from(
|
||||
delayedModules,
|
||||
m => m.identifier()
|
||||
).join(", ")}`
|
||||
)
|
||||
);
|
||||
}
|
||||
jobs = delayedJobs;
|
||||
delayedJobs = [];
|
||||
notCodeGeneratedModules = delayedModules;
|
||||
delayedModules = new Set();
|
||||
return runIteration();
|
||||
}
|
||||
if (errors.length > 0) {
|
||||
errors.sort(
|
||||
compareSelect(err => err.module, compareModulesByIdentifier)
|
||||
);
|
||||
for (const error of errors) {
|
||||
this.errors.push(error);
|
||||
}
|
||||
}
|
||||
this.logger.log(
|
||||
`${Math.round(
|
||||
(100 * statModulesGenerated) /
|
||||
(statModulesGenerated + statModulesFromCache)
|
||||
)}% code generated (${statModulesGenerated} generated, ${statModulesFromCache} from cache)`
|
||||
);
|
||||
callback();
|
||||
}
|
||||
this.logger.log(
|
||||
`${Math.round(
|
||||
(100 * statModulesGenerated) /
|
||||
(statModulesGenerated + statModulesFromCache)
|
||||
)}% code generated (${statModulesGenerated} generated, ${statModulesFromCache} from cache)`
|
||||
);
|
||||
callback();
|
||||
}
|
||||
);
|
||||
);
|
||||
};
|
||||
runIteration();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3283,7 +3323,8 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
|
|||
moduleGraph,
|
||||
dependencyTemplates,
|
||||
runtimeTemplate,
|
||||
runtime
|
||||
runtime,
|
||||
codeGenerationResults: results
|
||||
});
|
||||
} catch (err) {
|
||||
errors.push(new CodeGenerationError(module, err));
|
||||
|
|
|
@ -172,6 +172,16 @@ class Dependency {
|
|||
this._loc = loc;
|
||||
}
|
||||
|
||||
setLoc(startLine, startColumn, endLine, endColumn) {
|
||||
this._locSL = startLine;
|
||||
this._locSC = startColumn;
|
||||
this._locEL = endLine;
|
||||
this._locEC = endColumn;
|
||||
this._locI = undefined;
|
||||
this._locN = undefined;
|
||||
this._loc = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string | null} an identifier to merge equal requests
|
||||
*/
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
||||
/** @typedef {import("./ConcatenationScope")} ConcatenationScope */
|
||||
/** @typedef {import("./Dependency")} Dependency */
|
||||
/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */
|
||||
|
@ -28,8 +29,16 @@
|
|||
* @property {RuntimeSpec} runtime current runtimes, for which code is generated
|
||||
* @property {InitFragment<GenerateContext>[]} initFragments mutable array of init fragments for the current module
|
||||
* @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules
|
||||
* @property {CodeGenerationResults} codeGenerationResults the code generation results
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} CssDependencyTemplateContextExtras
|
||||
* @property {Map<string, string>} cssExports the css exports
|
||||
*/
|
||||
|
||||
/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */
|
||||
|
||||
class DependencyTemplate {
|
||||
/* istanbul ignore next */
|
||||
/**
|
||||
|
|
|
@ -53,6 +53,7 @@ const { register } = require("./util/serialization");
|
|||
*/
|
||||
|
||||
const TYPES = new Set(["javascript"]);
|
||||
const CSS_TYPES = new Set(["css-import"]);
|
||||
const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]);
|
||||
const RUNTIME_REQUIREMENTS_FOR_SCRIPT = new Set([RuntimeGlobals.loadScript]);
|
||||
const RUNTIME_REQUIREMENTS_FOR_MODULE = new Set([
|
||||
|
@ -392,7 +393,7 @@ class ExternalModule extends Module {
|
|||
* @returns {Set<string>} types available (do not mutate)
|
||||
*/
|
||||
getSourceTypes() {
|
||||
return TYPES;
|
||||
return this.externalType === "css-import" ? CSS_TYPES : TYPES;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -409,7 +410,9 @@ class ExternalModule extends Module {
|
|||
* @returns {boolean} true, if the chunk is ok for the module
|
||||
*/
|
||||
chunkCondition(chunk, { chunkGraph }) {
|
||||
return chunkGraph.getNumberOfEntryModules(chunk) > 0;
|
||||
return this.externalType === "css-import"
|
||||
? true
|
||||
: chunkGraph.getNumberOfEntryModules(chunk) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -526,8 +529,14 @@ class ExternalModule extends Module {
|
|||
return { request, externalType };
|
||||
}
|
||||
|
||||
_getSourceData(runtimeTemplate, moduleGraph, chunkGraph, runtime) {
|
||||
const { request, externalType } = this._getRequestAndExternalType();
|
||||
_getSourceData(
|
||||
request,
|
||||
externalType,
|
||||
runtimeTemplate,
|
||||
moduleGraph,
|
||||
chunkGraph,
|
||||
runtime
|
||||
) {
|
||||
switch (externalType) {
|
||||
case "this":
|
||||
case "window":
|
||||
|
@ -614,60 +623,90 @@ class ExternalModule extends Module {
|
|||
runtime,
|
||||
concatenationScope
|
||||
}) {
|
||||
const sourceData = this._getSourceData(
|
||||
runtimeTemplate,
|
||||
moduleGraph,
|
||||
chunkGraph,
|
||||
runtime
|
||||
);
|
||||
const { request, externalType } = this._getRequestAndExternalType();
|
||||
switch (externalType) {
|
||||
case "asset": {
|
||||
const sources = new Map();
|
||||
sources.set(
|
||||
"javascript",
|
||||
new RawSource(`module.exports = ${JSON.stringify(request)};`)
|
||||
);
|
||||
const data = new Map();
|
||||
data.set("url", request);
|
||||
return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS, data };
|
||||
}
|
||||
case "css-import": {
|
||||
const sources = new Map();
|
||||
sources.set(
|
||||
"css-import",
|
||||
new RawSource(`@import url(${JSON.stringify(request)});`)
|
||||
);
|
||||
return {
|
||||
sources,
|
||||
runtimeRequirements: EMPTY_RUNTIME_REQUIREMENTS
|
||||
};
|
||||
}
|
||||
default: {
|
||||
const sourceData = this._getSourceData(
|
||||
request,
|
||||
externalType,
|
||||
runtimeTemplate,
|
||||
moduleGraph,
|
||||
chunkGraph,
|
||||
runtime
|
||||
);
|
||||
|
||||
let sourceString = sourceData.expression;
|
||||
if (sourceData.iife)
|
||||
sourceString = `(function() { return ${sourceString}; }())`;
|
||||
if (concatenationScope) {
|
||||
sourceString = `${runtimeTemplate.supportsConst() ? "const" : "var"} ${
|
||||
ConcatenationScope.NAMESPACE_OBJECT_EXPORT
|
||||
} = ${sourceString};`;
|
||||
concatenationScope.registerNamespaceExport(
|
||||
ConcatenationScope.NAMESPACE_OBJECT_EXPORT
|
||||
);
|
||||
} else {
|
||||
sourceString = `module.exports = ${sourceString};`;
|
||||
}
|
||||
if (sourceData.init) sourceString = `${sourceData.init}\n${sourceString}`;
|
||||
let sourceString = sourceData.expression;
|
||||
if (sourceData.iife)
|
||||
sourceString = `(function() { return ${sourceString}; }())`;
|
||||
if (concatenationScope) {
|
||||
sourceString = `${
|
||||
runtimeTemplate.supportsConst() ? "const" : "var"
|
||||
} ${ConcatenationScope.NAMESPACE_OBJECT_EXPORT} = ${sourceString};`;
|
||||
concatenationScope.registerNamespaceExport(
|
||||
ConcatenationScope.NAMESPACE_OBJECT_EXPORT
|
||||
);
|
||||
} else {
|
||||
sourceString = `module.exports = ${sourceString};`;
|
||||
}
|
||||
if (sourceData.init)
|
||||
sourceString = `${sourceData.init}\n${sourceString}`;
|
||||
|
||||
let data = undefined;
|
||||
if (sourceData.chunkInitFragments) {
|
||||
data = new Map();
|
||||
data.set("chunkInitFragments", sourceData.chunkInitFragments);
|
||||
}
|
||||
let data = undefined;
|
||||
if (sourceData.chunkInitFragments) {
|
||||
data = new Map();
|
||||
data.set("chunkInitFragments", sourceData.chunkInitFragments);
|
||||
}
|
||||
|
||||
const sources = new Map();
|
||||
if (this.useSourceMap || this.useSimpleSourceMap) {
|
||||
sources.set(
|
||||
"javascript",
|
||||
new OriginalSource(sourceString, this.identifier())
|
||||
);
|
||||
} else {
|
||||
sources.set("javascript", new RawSource(sourceString));
|
||||
}
|
||||
const sources = new Map();
|
||||
if (this.useSourceMap || this.useSimpleSourceMap) {
|
||||
sources.set(
|
||||
"javascript",
|
||||
new OriginalSource(sourceString, this.identifier())
|
||||
);
|
||||
} else {
|
||||
sources.set("javascript", new RawSource(sourceString));
|
||||
}
|
||||
|
||||
let runtimeRequirements = sourceData.runtimeRequirements;
|
||||
if (!concatenationScope) {
|
||||
if (!runtimeRequirements) {
|
||||
runtimeRequirements = RUNTIME_REQUIREMENTS;
|
||||
} else {
|
||||
const set = new Set(runtimeRequirements);
|
||||
set.add(RuntimeGlobals.module);
|
||||
runtimeRequirements = set;
|
||||
let runtimeRequirements = sourceData.runtimeRequirements;
|
||||
if (!concatenationScope) {
|
||||
if (!runtimeRequirements) {
|
||||
runtimeRequirements = RUNTIME_REQUIREMENTS;
|
||||
} else {
|
||||
const set = new Set(runtimeRequirements);
|
||||
set.add(RuntimeGlobals.module);
|
||||
runtimeRequirements = set;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
sources,
|
||||
runtimeRequirements:
|
||||
runtimeRequirements || EMPTY_RUNTIME_REQUIREMENTS,
|
||||
data
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
sources,
|
||||
runtimeRequirements: runtimeRequirements || EMPTY_RUNTIME_REQUIREMENTS,
|
||||
data
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
||||
/** @typedef {import("./Compilation")} Compilation */
|
||||
/** @typedef {import("./ConcatenationScope")} ConcatenationScope */
|
||||
/** @typedef {import("./DependencyTemplate")} DependencyTemplate */
|
||||
|
@ -27,6 +28,7 @@
|
|||
* @property {Set<string>} runtimeRequirements the requirements for runtime
|
||||
* @property {RuntimeSpec} runtime the runtime
|
||||
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules
|
||||
* @property {CodeGenerationResults=} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)
|
||||
* @property {string} type which kind of code should be generated
|
||||
* @property {function(): Map<string, any>=} getData get access to the code generation data
|
||||
*/
|
||||
|
|
|
@ -19,6 +19,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|||
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
|
||||
/** @typedef {import("./Chunk")} Chunk */
|
||||
/** @typedef {import("./ChunkGroup")} ChunkGroup */
|
||||
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
||||
/** @typedef {import("./Compilation")} Compilation */
|
||||
/** @typedef {import("./ConcatenationScope")} ConcatenationScope */
|
||||
/** @typedef {import("./Dependency")} Dependency */
|
||||
|
@ -56,6 +57,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|||
* @property {ChunkGraph} chunkGraph the chunk graph
|
||||
* @property {RuntimeSpec} runtime the runtimes code should be generated for
|
||||
* @property {ConcatenationScope=} concatenationScope when in concatenated module, information about other concatenated modules
|
||||
* @property {CodeGenerationResults} codeGenerationResults code generation results of other modules (need to have a codeGenerationDependency to use that)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -165,6 +167,8 @@ class Module extends DependenciesBlock {
|
|||
this.buildInfo = undefined;
|
||||
/** @type {Dependency[] | undefined} */
|
||||
this.presentationalDependencies = undefined;
|
||||
/** @type {Dependency[] | undefined} */
|
||||
this.codeGenerationDependencies = undefined;
|
||||
}
|
||||
|
||||
// TODO remove in webpack 6
|
||||
|
@ -493,6 +497,19 @@ class Module extends DependenciesBlock {
|
|||
this.presentationalDependencies.push(presentationalDependency);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Dependency} codeGenerationDependency dependency being tied to module.
|
||||
* This is a Dependency where the code generation result of the referenced module is needed during code generation.
|
||||
* The Dependency should also be added to normal dependencies via addDependency.
|
||||
* @returns {void}
|
||||
*/
|
||||
addCodeGenerationDependency(codeGenerationDependency) {
|
||||
if (this.codeGenerationDependencies === undefined) {
|
||||
this.codeGenerationDependencies = [];
|
||||
}
|
||||
this.codeGenerationDependencies.push(codeGenerationDependency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all dependencies and blocks
|
||||
* @returns {void}
|
||||
|
@ -501,6 +518,9 @@ class Module extends DependenciesBlock {
|
|||
if (this.presentationalDependencies !== undefined) {
|
||||
this.presentationalDependencies.length = 0;
|
||||
}
|
||||
if (this.codeGenerationDependencies !== undefined) {
|
||||
this.codeGenerationDependencies.length = 0;
|
||||
}
|
||||
super.clearDependenciesAndBlocks();
|
||||
}
|
||||
|
||||
|
@ -799,7 +819,8 @@ class Module extends DependenciesBlock {
|
|||
runtimeTemplate,
|
||||
moduleGraph: chunkGraph.moduleGraph,
|
||||
chunkGraph,
|
||||
runtime: undefined
|
||||
runtime: undefined,
|
||||
codeGenerationResults: undefined
|
||||
};
|
||||
const sources = this.codeGeneration(codeGenContext).sources;
|
||||
return type ? sources.get(type) : sources.get(first(this.getSourceTypes()));
|
||||
|
@ -976,6 +997,7 @@ class Module extends DependenciesBlock {
|
|||
write(this.buildMeta);
|
||||
write(this.buildInfo);
|
||||
write(this.presentationalDependencies);
|
||||
write(this.codeGenerationDependencies);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
|
@ -993,6 +1015,7 @@ class Module extends DependenciesBlock {
|
|||
this.buildMeta = read();
|
||||
this.buildInfo = read();
|
||||
this.presentationalDependencies = read();
|
||||
this.codeGenerationDependencies = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const NormalModule = require("./NormalModule");
|
||||
const createHash = require("./util/createHash");
|
||||
const memoize = require("./util/memoize");
|
||||
|
||||
|
@ -138,7 +139,10 @@ ModuleFilenameHelpers.createFilename = (
|
|||
);
|
||||
identifier = memoize(() => requestShortener.shorten(module.identifier()));
|
||||
moduleId = () => chunkGraph.getModuleId(module);
|
||||
absoluteResourcePath = () => module.identifier().split("!").pop();
|
||||
absoluteResourcePath = () =>
|
||||
module instanceof NormalModule
|
||||
? module.resource
|
||||
: module.identifier().split("!").pop();
|
||||
hash = getHash(identifier, hashFunction);
|
||||
}
|
||||
const resource = memoize(() => shortIdentifier().split("!").pop());
|
||||
|
|
|
@ -1168,7 +1168,8 @@ class NormalModule extends Module {
|
|||
moduleGraph,
|
||||
chunkGraph,
|
||||
runtime,
|
||||
concatenationScope
|
||||
concatenationScope,
|
||||
codeGenerationResults
|
||||
}) {
|
||||
/** @type {Set<string>} */
|
||||
const runtimeRequirements = new Set();
|
||||
|
@ -1200,6 +1201,7 @@ class NormalModule extends Module {
|
|||
runtimeRequirements,
|
||||
runtime,
|
||||
concatenationScope,
|
||||
codeGenerationResults,
|
||||
getData,
|
||||
type
|
||||
});
|
||||
|
|
|
@ -164,7 +164,7 @@ exports.scriptNonce = "__webpack_require__.nc";
|
|||
* function to load a script tag.
|
||||
* Arguments: (url: string, done: (event) => void), key?: string | number, chunkId?: string | number) => void
|
||||
* done function is called when loading has finished or timeout occurred.
|
||||
* It will attach to existing script tags with data-webpack == key or src == url.
|
||||
* It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url.
|
||||
*/
|
||||
exports.loadScript = "__webpack_require__.l";
|
||||
|
||||
|
@ -190,11 +190,21 @@ exports.runtimeId = "__webpack_require__.j";
|
|||
*/
|
||||
exports.getChunkScriptFilename = "__webpack_require__.u";
|
||||
|
||||
/**
|
||||
* the filename of the css part of the chunk
|
||||
*/
|
||||
exports.getChunkCssFilename = "__webpack_require__.k";
|
||||
|
||||
/**
|
||||
* the filename of the script part of the hot update chunk
|
||||
*/
|
||||
exports.getChunkUpdateScriptFilename = "__webpack_require__.hu";
|
||||
|
||||
/**
|
||||
* the filename of the css part of the hot update chunk
|
||||
*/
|
||||
exports.getChunkUpdateCssFilename = "__webpack_require__.hk";
|
||||
|
||||
/**
|
||||
* startup signal from runtime
|
||||
* This will be called when the runtime chunk has been loaded.
|
||||
|
|
|
@ -261,6 +261,31 @@ class RuntimePlugin {
|
|||
);
|
||||
return true;
|
||||
});
|
||||
compilation.hooks.runtimeRequirementInTree
|
||||
.for(RuntimeGlobals.getChunkCssFilename)
|
||||
.tap("RuntimePlugin", (chunk, set) => {
|
||||
if (
|
||||
typeof compilation.outputOptions.cssChunkFilename === "string" &&
|
||||
/\[(full)?hash(:\d+)?\]/.test(
|
||||
compilation.outputOptions.cssChunkFilename
|
||||
)
|
||||
) {
|
||||
set.add(RuntimeGlobals.getFullHash);
|
||||
}
|
||||
compilation.addRuntimeModule(
|
||||
chunk,
|
||||
new GetChunkFilenameRuntimeModule(
|
||||
"css",
|
||||
"css",
|
||||
RuntimeGlobals.getChunkCssFilename,
|
||||
chunk =>
|
||||
chunk.cssFilenameTemplate ||
|
||||
compilation.outputOptions.cssChunkFilename,
|
||||
false
|
||||
)
|
||||
);
|
||||
return true;
|
||||
});
|
||||
compilation.hooks.runtimeRequirementInTree
|
||||
.for(RuntimeGlobals.getChunkUpdateScriptFilename)
|
||||
.tap("RuntimePlugin", (chunk, set) => {
|
||||
|
|
|
@ -16,6 +16,7 @@ const { forEachRuntime, subtractRuntime } = require("./util/runtime");
|
|||
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */
|
||||
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
|
||||
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
||||
/** @typedef {import("./Compilation")} Compilation */
|
||||
/** @typedef {import("./Dependency")} Dependency */
|
||||
/** @typedef {import("./Module")} Module */
|
||||
|
@ -1014,6 +1015,26 @@ class RuntimeTemplate {
|
|||
runtimeRequirements.add(RuntimeGlobals.exports);
|
||||
return `${RuntimeGlobals.makeNamespaceObject}(${exportsArgument});\n`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} options options object
|
||||
* @param {Module} options.module the module
|
||||
* @param {string} options.publicPath the public path
|
||||
* @param {RuntimeSpec=} options.runtime runtime
|
||||
* @param {CodeGenerationResults} options.codeGenerationResults the code generation results
|
||||
* @returns {string} the url of the asset
|
||||
*/
|
||||
assetUrl({ publicPath, runtime, module, codeGenerationResults }) {
|
||||
if (!module) {
|
||||
return "data:,";
|
||||
}
|
||||
const codeGen = codeGenerationResults.get(module, runtime);
|
||||
const { data } = codeGen;
|
||||
const url = data.get("url");
|
||||
if (url) return url;
|
||||
const filename = data.get("filename");
|
||||
return publicPath + filename;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RuntimeTemplate;
|
||||
|
|
|
@ -370,7 +370,8 @@ class Template {
|
|||
dependencyTemplates: renderContext.dependencyTemplates,
|
||||
moduleGraph: renderContext.moduleGraph,
|
||||
runtimeTemplate: renderContext.runtimeTemplate,
|
||||
runtime: renderContext.chunk.runtime
|
||||
runtime: renderContext.chunk.runtime,
|
||||
codeGenerationResults
|
||||
});
|
||||
if (!codeGenResult) continue;
|
||||
runtimeSource = codeGenResult.sources.get("runtime");
|
||||
|
|
|
@ -49,7 +49,7 @@ class Watching {
|
|||
this.watchOptions = {};
|
||||
}
|
||||
if (typeof this.watchOptions.aggregateTimeout !== "number") {
|
||||
this.watchOptions.aggregateTimeout = 200;
|
||||
this.watchOptions.aggregateTimeout = 20;
|
||||
}
|
||||
this.compiler = compiler;
|
||||
this.running = false;
|
||||
|
|
|
@ -118,11 +118,47 @@ class WebpackOptionsApply extends OptionsApply {
|
|||
if (options.externalsPresets.webAsync) {
|
||||
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
||||
const ExternalsPlugin = require("./ExternalsPlugin");
|
||||
new ExternalsPlugin("import", /^(https?:\/\/|std:)/).apply(compiler);
|
||||
new ExternalsPlugin(
|
||||
"import",
|
||||
options.experiments.css
|
||||
? ({ request, dependencyType }, callback) => {
|
||||
if (dependencyType === "url") {
|
||||
if (/^(\/\/|https?:\/\/)/.test(request))
|
||||
return callback(null, `asset ${request}`);
|
||||
} else if (dependencyType === "css-import") {
|
||||
if (/^(\/\/|https?:\/\/)/.test(request))
|
||||
return callback(null, `css-import ${request}`);
|
||||
} else if (/^(\/\/|https?:\/\/|std:)/.test(request)) {
|
||||
if (/^\.css(\?|$)/.test(request))
|
||||
return callback(null, `css-import ${request}`);
|
||||
return callback(null, `import ${request}`);
|
||||
}
|
||||
callback();
|
||||
}
|
||||
: /^(\/\/|https?:\/\/|std:)/
|
||||
).apply(compiler);
|
||||
} else if (options.externalsPresets.web) {
|
||||
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
|
||||
const ExternalsPlugin = require("./ExternalsPlugin");
|
||||
new ExternalsPlugin("module", /^(https?:\/\/|std:)/).apply(compiler);
|
||||
new ExternalsPlugin(
|
||||
"module",
|
||||
options.experiments.css
|
||||
? ({ request, dependencyType }, callback) => {
|
||||
if (dependencyType === "url") {
|
||||
if (/^(\/\/|https?:\/\/)/.test(request))
|
||||
return callback(null, `asset ${request}`);
|
||||
} else if (dependencyType === "css-import") {
|
||||
if (/^(\/\/|https?:\/\/)/.test(request))
|
||||
return callback(null, `css-import ${request}`);
|
||||
} else if (/^(\/\/|https?:\/\/|std:)/.test(request)) {
|
||||
if (/^\.css(\?|$)/.test(request))
|
||||
return callback(null, `css-import ${request}`);
|
||||
return callback(null, `module ${request}`);
|
||||
}
|
||||
callback();
|
||||
}
|
||||
: /^(\/\/|https?:\/\/|std:)/
|
||||
).apply(compiler);
|
||||
}
|
||||
|
||||
new ChunkPrefetchPreloadPlugin().apply(compiler);
|
||||
|
@ -253,6 +289,11 @@ class WebpackOptionsApply extends OptionsApply {
|
|||
}).apply(compiler);
|
||||
}
|
||||
|
||||
if (options.experiments.css) {
|
||||
const CssModulesPlugin = require("./css/CssModulesPlugin");
|
||||
new CssModulesPlugin().apply(compiler);
|
||||
}
|
||||
|
||||
if (options.experiments.lazyCompilation) {
|
||||
const LazyCompilationPlugin = require("./hmr/LazyCompilationPlugin");
|
||||
const lazyOptions =
|
||||
|
|
|
@ -191,6 +191,8 @@ class AssetGenerator extends Generator {
|
|||
encoding ? `;${encoding}` : ""
|
||||
},${encodedContent}`;
|
||||
}
|
||||
const data = getData();
|
||||
data.set("url", encodedSource);
|
||||
return new RawSource(
|
||||
`${RuntimeGlobals.module}.exports = ${JSON.stringify(
|
||||
encodedSource
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { RawSource } = require("webpack-sources");
|
||||
const Module = require("../Module");
|
||||
const RuntimeGlobals = require("../RuntimeGlobals");
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
|
||||
/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
|
||||
/** @typedef {import("../Compilation")} Compilation */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */
|
||||
/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */
|
||||
/** @typedef {import("../Module").NeedBuildContext} NeedBuildContext */
|
||||
/** @typedef {import("../RequestShortener")} RequestShortener */
|
||||
/** @typedef {import("../ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
||||
/** @typedef {import("../WebpackError")} WebpackError */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
||||
|
||||
const TYPES = new Set(["javascript"]);
|
||||
|
||||
class RawDataUrlModule extends Module {
|
||||
/**
|
||||
* @param {string} url raw url
|
||||
* @param {string} identifier unique identifier
|
||||
* @param {string=} readableIdentifier readable identifier
|
||||
*/
|
||||
constructor(url, identifier, readableIdentifier) {
|
||||
super("asset/raw-data-url", null);
|
||||
this.url = url;
|
||||
this.identifierStr = identifier || this.url;
|
||||
this.readableIdentifierStr = readableIdentifier || this.identifierStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Set<string>} types available (do not mutate)
|
||||
*/
|
||||
getSourceTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string} a unique identifier of the module
|
||||
*/
|
||||
identifier() {
|
||||
return this.identifierStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string=} type the source type for which the size should be estimated
|
||||
* @returns {number} the estimated size of the module (must be non-zero)
|
||||
*/
|
||||
size(type) {
|
||||
return Math.max(1, this.url.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {RequestShortener} requestShortener the request shortener
|
||||
* @returns {string} a user readable identifier of the module
|
||||
*/
|
||||
readableIdentifier(requestShortener) {
|
||||
return requestShortener.shorten(this.readableIdentifierStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NeedBuildContext} context context info
|
||||
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
||||
* @returns {void}
|
||||
*/
|
||||
needBuild(context, callback) {
|
||||
return callback(null, !this.buildMeta);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {WebpackOptions} options webpack options
|
||||
* @param {Compilation} compilation the compilation
|
||||
* @param {ResolverWithOptions} resolver the resolver
|
||||
* @param {InputFileSystem} fs the file system
|
||||
* @param {function(WebpackError=): void} callback callback function
|
||||
* @returns {void}
|
||||
*/
|
||||
build(options, compilation, resolver, fs, callback) {
|
||||
this.buildMeta = {};
|
||||
this.buildInfo = {
|
||||
cacheable: true
|
||||
};
|
||||
callback();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {CodeGenerationContext} context context for code generation
|
||||
* @returns {CodeGenerationResult} result
|
||||
*/
|
||||
codeGeneration(context) {
|
||||
const sources = new Map();
|
||||
sources.set(
|
||||
"javascript",
|
||||
new RawSource(`module.exports = ${JSON.stringify(this.url)};`)
|
||||
);
|
||||
const data = new Map();
|
||||
data.set("url", this.url);
|
||||
const runtimeRequirements = new Set();
|
||||
runtimeRequirements.add(RuntimeGlobals.module);
|
||||
return { sources, runtimeRequirements, data };
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Hash} hash the hash used to track dependencies
|
||||
* @param {UpdateHashContext} context context
|
||||
* @returns {void}
|
||||
*/
|
||||
updateHash(hash, context) {
|
||||
hash.update(this.url);
|
||||
super.updateHash(hash, context);
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const { write } = context;
|
||||
|
||||
write(this.url);
|
||||
write(this.identifierStr);
|
||||
write(this.readableIdentifierStr);
|
||||
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
const { read } = context;
|
||||
|
||||
this.url = read();
|
||||
this.identifierStr = read();
|
||||
this.readableIdentifierStr = read();
|
||||
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
makeSerializable(RawDataUrlModule, "webpack/lib/asset/RawDataUrlModule");
|
||||
|
||||
module.exports = RawDataUrlModule;
|
|
@ -184,6 +184,7 @@ const applyWebpackOptionsDefaults = options => {
|
|||
cache,
|
||||
syncWebAssembly: options.experiments.syncWebAssembly,
|
||||
asyncWebAssembly: options.experiments.asyncWebAssembly,
|
||||
css: options.experiments.css,
|
||||
futureDefaults
|
||||
});
|
||||
|
||||
|
@ -239,6 +240,7 @@ const applyWebpackOptionsDefaults = options => {
|
|||
applyOptimizationDefaults(options.optimization, {
|
||||
development,
|
||||
production,
|
||||
css: options.experiments.css,
|
||||
records: !!(options.recordsInputPath || options.recordsOutputPath)
|
||||
});
|
||||
|
||||
|
@ -276,6 +278,7 @@ const applyExperimentsDefaults = (experiments, { production, development }) => {
|
|||
D(experiments, "lazyCompilation", undefined);
|
||||
D(experiments, "buildHttp", undefined);
|
||||
D(experiments, "cacheUnaffected", experiments.futureDefaults);
|
||||
D(experiments, "css", experiments.futureDefaults);
|
||||
|
||||
if (typeof experiments.buildHttp === "object") {
|
||||
D(experiments.buildHttp, "frozen", production);
|
||||
|
@ -458,12 +461,13 @@ const applyJavascriptParserOptionsDefaults = (
|
|||
* @param {boolean} options.cache is caching enabled
|
||||
* @param {boolean} options.syncWebAssembly is syncWebAssembly enabled
|
||||
* @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled
|
||||
* @param {boolean} options.css is css enabled
|
||||
* @param {boolean} options.futureDefaults is future defaults enabled
|
||||
* @returns {void}
|
||||
*/
|
||||
const applyModuleDefaults = (
|
||||
module,
|
||||
{ cache, syncWebAssembly, asyncWebAssembly, futureDefaults }
|
||||
{ cache, syncWebAssembly, asyncWebAssembly, css, futureDefaults }
|
||||
) => {
|
||||
if (cache) {
|
||||
D(module, "unsafeCache", module => {
|
||||
|
@ -587,6 +591,41 @@ const applyModuleDefaults = (
|
|||
...wasm
|
||||
});
|
||||
}
|
||||
if (css) {
|
||||
const cssRule = {
|
||||
type: "css",
|
||||
resolve: {
|
||||
fullySpecified: true,
|
||||
preferRelative: true
|
||||
}
|
||||
};
|
||||
const cssModulesRule = {
|
||||
type: "css/module",
|
||||
resolve: {
|
||||
fullySpecified: true
|
||||
}
|
||||
};
|
||||
rules.push({
|
||||
test: /\.css$/i,
|
||||
oneOf: [
|
||||
{
|
||||
test: /\.module\.css$/i,
|
||||
...cssModulesRule
|
||||
},
|
||||
{
|
||||
...cssRule
|
||||
}
|
||||
]
|
||||
});
|
||||
rules.push({
|
||||
mimetype: "text/css+module",
|
||||
...cssModulesRule
|
||||
});
|
||||
rules.push({
|
||||
mimetype: "text/css",
|
||||
...cssRule
|
||||
});
|
||||
}
|
||||
rules.push(
|
||||
{
|
||||
dependency: "url",
|
||||
|
@ -692,6 +731,20 @@ const applyOutputDefaults = (
|
|||
}
|
||||
return output.module ? "[id].mjs" : "[id].js";
|
||||
});
|
||||
F(output, "cssFilename", () => {
|
||||
const filename = output.filename;
|
||||
if (typeof filename !== "function") {
|
||||
return filename.replace(/\.[mc]?js(\?|$)/, ".css$1");
|
||||
}
|
||||
return "[id].css";
|
||||
});
|
||||
F(output, "cssChunkFilename", () => {
|
||||
const chunkFilename = output.chunkFilename;
|
||||
if (typeof chunkFilename !== "function") {
|
||||
return chunkFilename.replace(/\.[mc]?js(\?|$)/, ".css$1");
|
||||
}
|
||||
return "[id].css";
|
||||
});
|
||||
D(output, "assetModuleFilename", "[hash][ext][query]");
|
||||
D(output, "webassemblyModuleFilename", "[hash].module.wasm");
|
||||
D(output, "compareBeforeEmit", true);
|
||||
|
@ -1030,12 +1083,13 @@ const applyPerformanceDefaults = (performance, { production }) => {
|
|||
* @param {Object} options options
|
||||
* @param {boolean} options.production is production
|
||||
* @param {boolean} options.development is development
|
||||
* @param {boolean} options.css is css enabled
|
||||
* @param {boolean} options.records using records
|
||||
* @returns {void}
|
||||
*/
|
||||
const applyOptimizationDefaults = (
|
||||
optimization,
|
||||
{ production, development, records }
|
||||
{ production, development, css, records }
|
||||
) => {
|
||||
D(optimization, "removeAvailableModules", false);
|
||||
D(optimization, "removeEmptyChunks", true);
|
||||
|
@ -1086,7 +1140,9 @@ const applyOptimizationDefaults = (
|
|||
});
|
||||
const { splitChunks } = optimization;
|
||||
if (splitChunks) {
|
||||
A(splitChunks, "defaultSizeTypes", () => ["javascript", "unknown"]);
|
||||
A(splitChunks, "defaultSizeTypes", () =>
|
||||
css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"]
|
||||
);
|
||||
D(splitChunks, "hidePathInfo", production);
|
||||
D(splitChunks, "chunks", "async");
|
||||
D(splitChunks, "usedExports", optimization.usedExports === true);
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Sergey Melyukov @smelukov
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { ReplaceSource } = require("webpack-sources");
|
||||
const Generator = require("../Generator");
|
||||
const InitFragment = require("../InitFragment");
|
||||
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
|
||||
/** @typedef {import("../Generator").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../NormalModule")} NormalModule */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
|
||||
const TYPES = new Set(["css"]);
|
||||
|
||||
class CssGenerator extends Generator {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NormalModule} module module for which the code should be generated
|
||||
* @param {GenerateContext} generateContext context for generate
|
||||
* @returns {Source} generated code
|
||||
*/
|
||||
generate(module, generateContext) {
|
||||
const originalSource = module.originalSource();
|
||||
const source = new ReplaceSource(originalSource);
|
||||
const initFragments = [];
|
||||
const cssExports = new Map();
|
||||
|
||||
const templateContext = {
|
||||
runtimeTemplate: generateContext.runtimeTemplate,
|
||||
dependencyTemplates: generateContext.dependencyTemplates,
|
||||
moduleGraph: generateContext.moduleGraph,
|
||||
chunkGraph: generateContext.chunkGraph,
|
||||
module,
|
||||
runtime: generateContext.runtime,
|
||||
runtimeRequirements: generateContext.runtimeRequirements,
|
||||
concatenationScope: generateContext.concatenationScope,
|
||||
codeGenerationResults: generateContext.codeGenerationResults,
|
||||
initFragments,
|
||||
cssExports
|
||||
};
|
||||
|
||||
const handleDependency = dependency => {
|
||||
const constructor = /** @type {new (...args: any[]) => Dependency} */ (
|
||||
dependency.constructor
|
||||
);
|
||||
const template = generateContext.dependencyTemplates.get(constructor);
|
||||
if (!template) {
|
||||
throw new Error(
|
||||
"No template for dependency: " + dependency.constructor.name
|
||||
);
|
||||
}
|
||||
|
||||
template.apply(dependency, source, templateContext);
|
||||
};
|
||||
module.dependencies.forEach(handleDependency);
|
||||
if (module.presentationalDependencies !== undefined)
|
||||
module.presentationalDependencies.forEach(handleDependency);
|
||||
|
||||
if (cssExports.size > 0) {
|
||||
const data = generateContext.getData();
|
||||
data.set("css-exports", cssExports);
|
||||
}
|
||||
|
||||
return InitFragment.addToSource(source, initFragments, generateContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NormalModule} module fresh module
|
||||
* @returns {Set<string>} available types (do not mutate)
|
||||
*/
|
||||
getTypes(module) {
|
||||
return TYPES;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {NormalModule} module the module
|
||||
* @param {string=} type source type
|
||||
* @returns {number} estimate size of the module
|
||||
*/
|
||||
getSize(module, type) {
|
||||
const originalSource = module.originalSource();
|
||||
|
||||
if (!originalSource) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return originalSource.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Hash} hash hash that will be modified
|
||||
* @param {UpdateHashContext} updateHashContext context for updating hash
|
||||
*/
|
||||
updateHash(hash, { module }) {}
|
||||
}
|
||||
|
||||
module.exports = CssGenerator;
|
|
@ -0,0 +1,393 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { SyncWaterfallHook } = require("tapable");
|
||||
const Compilation = require("../Compilation");
|
||||
const RuntimeGlobals = require("../RuntimeGlobals");
|
||||
const RuntimeModule = require("../RuntimeModule");
|
||||
const Template = require("../Template");
|
||||
const compileBooleanMatcher = require("../util/compileBooleanMatcher");
|
||||
const { chunkHasCss } = require("./CssModulesPlugin");
|
||||
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
|
||||
/**
|
||||
* @typedef {Object} JsonpCompilationPluginHooks
|
||||
* @property {SyncWaterfallHook<[string, Chunk]>} createStylesheet
|
||||
*/
|
||||
|
||||
/** @type {WeakMap<Compilation, JsonpCompilationPluginHooks>} */
|
||||
const compilationHooksMap = new WeakMap();
|
||||
|
||||
class CssLoadingRuntimeModule extends RuntimeModule {
|
||||
/**
|
||||
* @param {Compilation} compilation the compilation
|
||||
* @returns {JsonpCompilationPluginHooks} hooks
|
||||
*/
|
||||
static getCompilationHooks(compilation) {
|
||||
if (!(compilation instanceof Compilation)) {
|
||||
throw new TypeError(
|
||||
"The 'compilation' argument must be an instance of Compilation"
|
||||
);
|
||||
}
|
||||
let hooks = compilationHooksMap.get(compilation);
|
||||
if (hooks === undefined) {
|
||||
hooks = {
|
||||
createStylesheet: new SyncWaterfallHook(["source", "chunk"])
|
||||
};
|
||||
compilationHooksMap.set(compilation, hooks);
|
||||
}
|
||||
return hooks;
|
||||
}
|
||||
|
||||
constructor(runtimeRequirements, runtimeOptions) {
|
||||
super("css loading", 10);
|
||||
|
||||
this._runtimeRequirements = runtimeRequirements;
|
||||
this.runtimeOptions = runtimeOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string} runtime code
|
||||
*/
|
||||
generate() {
|
||||
const { compilation, chunk, _runtimeRequirements } = this;
|
||||
const {
|
||||
chunkGraph,
|
||||
runtimeTemplate,
|
||||
outputOptions: {
|
||||
crossOriginLoading,
|
||||
uniqueName,
|
||||
chunkLoadTimeout: loadTimeout
|
||||
}
|
||||
} = compilation;
|
||||
const fn = RuntimeGlobals.ensureChunkHandlers;
|
||||
const conditionMap = chunkGraph.getChunkConditionMap(
|
||||
chunk,
|
||||
(chunk, chunkGraph) =>
|
||||
!!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css")
|
||||
);
|
||||
const hasCssMatcher = compileBooleanMatcher(conditionMap);
|
||||
|
||||
const withLoading =
|
||||
_runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) &&
|
||||
hasCssMatcher !== false;
|
||||
const withHmr = _runtimeRequirements.has(
|
||||
RuntimeGlobals.hmrDownloadUpdateHandlers
|
||||
);
|
||||
|
||||
if (!withLoading && !withHmr) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { createStylesheet } =
|
||||
CssLoadingRuntimeModule.getCompilationHooks(compilation);
|
||||
|
||||
const initialChunkIdsWithCss = new Set();
|
||||
const initialChunkIdsWithoutCss = new Set();
|
||||
for (const c of chunk.getAllInitialChunks()) {
|
||||
(chunkHasCss(c, chunkGraph)
|
||||
? initialChunkIdsWithCss
|
||||
: initialChunkIdsWithoutCss
|
||||
).add(c.id);
|
||||
}
|
||||
|
||||
const stateExpression = withHmr
|
||||
? `${RuntimeGlobals.hmrRuntimeStatePrefix}_css`
|
||||
: undefined;
|
||||
|
||||
const code = Template.asString([
|
||||
"link = document.createElement('link');",
|
||||
uniqueName
|
||||
? 'link.setAttribute("data-webpack", uniqueName + ":" + key);'
|
||||
: "",
|
||||
"link.setAttribute(loadingAttribute, 1);",
|
||||
'link.rel = "stylesheet";',
|
||||
withHmr ? 'if(hmr) link.media = "print and screen";' : "",
|
||||
"link.href = url;",
|
||||
crossOriginLoading
|
||||
? Template.asString([
|
||||
"if (link.src.indexOf(window.location.origin + '/') !== 0) {",
|
||||
Template.indent(
|
||||
`link.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
|
||||
),
|
||||
"}"
|
||||
])
|
||||
: ""
|
||||
]);
|
||||
|
||||
const cc = str => str.charCodeAt(0);
|
||||
|
||||
return Template.asString([
|
||||
"// object to store loaded and loading chunks",
|
||||
"// undefined = chunk not loaded, null = chunk preloaded/prefetched",
|
||||
"// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded",
|
||||
`var installedChunks = ${
|
||||
stateExpression ? `${stateExpression} = ${stateExpression} || ` : ""
|
||||
}{${Array.from(
|
||||
initialChunkIdsWithoutCss,
|
||||
id => `${JSON.stringify(id)}:0`
|
||||
).join(",")}};`,
|
||||
"",
|
||||
uniqueName
|
||||
? `var uniqueName = ${JSON.stringify(
|
||||
runtimeTemplate.outputOptions.uniqueName
|
||||
)};`
|
||||
: "// data-webpack is not used as build has no uniqueName",
|
||||
`var loadCssChunkData = ${runtimeTemplate.basicFunction("chunkId, link", [
|
||||
'var data, token = "", token2, exports = {}, exportsWithId = [], exportsWithDashes = [], i = 0, cc = 1;',
|
||||
"try { if(!link) link = loadStylesheet(chunkId); data = link.sheet.cssRules; data = data[data.length - 1].style; } catch(e) { data = getComputedStyle(document.head); }",
|
||||
`data = data.getPropertyValue(${
|
||||
uniqueName
|
||||
? runtimeTemplate.concatenation(
|
||||
"--webpack-",
|
||||
{ expr: "uniqueName" },
|
||||
"-",
|
||||
{ expr: "chunkId" }
|
||||
)
|
||||
: runtimeTemplate.concatenation("--webpack-", { expr: "chunkId" })
|
||||
});`,
|
||||
"if(!data) return;",
|
||||
"for(; cc; i++) {",
|
||||
Template.indent([
|
||||
"cc = data.charCodeAt(i);",
|
||||
`if(cc == ${cc("(")}) { token2 = token; token = ""; }`,
|
||||
`else if(cc == ${cc(
|
||||
")"
|
||||
)}) { exports[token2.replace(/^_/, "")] = token.replace(/^_/, ""); token = ""; }`,
|
||||
`else if(cc == ${cc("/")} || cc == ${cc(
|
||||
"%"
|
||||
)}) { token = token.replace(/^_/, ""); exports[token] = token; exportsWithId.push(token); if(cc == ${cc(
|
||||
"%"
|
||||
)}) exportsWithDashes.push(token); token = ""; }`,
|
||||
`else if(!cc || cc == ${cc(
|
||||
","
|
||||
)}) { token = token.replace(/^_/, ""); exportsWithId.forEach(${runtimeTemplate.expressionFunction(
|
||||
`exports[x] = ${
|
||||
uniqueName
|
||||
? runtimeTemplate.concatenation(
|
||||
{ expr: "uniqueName" },
|
||||
"-",
|
||||
{ expr: "token" },
|
||||
"-",
|
||||
{ expr: "exports[x]" }
|
||||
)
|
||||
: runtimeTemplate.concatenation({ expr: "token" }, "-", {
|
||||
expr: "exports[x]"
|
||||
})
|
||||
}`,
|
||||
"x"
|
||||
)}); exportsWithDashes.forEach(${runtimeTemplate.expressionFunction(
|
||||
`exports[x] = "--" + exports[x]`,
|
||||
"x"
|
||||
)}); ${RuntimeGlobals.makeNamespaceObject}(exports); ${
|
||||
RuntimeGlobals.moduleFactories
|
||||
}[token] = (${runtimeTemplate.basicFunction(
|
||||
"exports, module",
|
||||
`module.exports = exports;`
|
||||
)}).bind(null, exports); token = ""; exports = {}; exportsWithId.length = 0; }`,
|
||||
`else if(cc == ${cc("\\")}) { token += data[++i] }`,
|
||||
`else { token += data[i]; }`
|
||||
]),
|
||||
"}",
|
||||
"installedChunks[chunkId] = 0;"
|
||||
])}`,
|
||||
'var loadingAttribute = "data-webpack-loading";',
|
||||
`var loadStylesheet = ${runtimeTemplate.basicFunction(
|
||||
"chunkId, url, done" + (withHmr ? ", hmr" : ""),
|
||||
[
|
||||
'var link, needAttach, key = "chunk-" + chunkId;',
|
||||
withHmr ? "if(!hmr) {" : "",
|
||||
'var links = document.getElementsByTagName("link");',
|
||||
"for(var i = 0; i < links.length; i++) {",
|
||||
Template.indent([
|
||||
"var l = links[i];",
|
||||
`if(l.getAttribute("href") == url${
|
||||
uniqueName
|
||||
? ' || l.getAttribute("data-webpack") == uniqueName + ":" + key'
|
||||
: ""
|
||||
}) { link = l; break; }`
|
||||
]),
|
||||
"}",
|
||||
"if(!url) return link;",
|
||||
withHmr ? "}" : "",
|
||||
"if(!link) {",
|
||||
Template.indent([
|
||||
"needAttach = true;",
|
||||
createStylesheet.call(code, this.chunk)
|
||||
]),
|
||||
"}",
|
||||
`var onLinkComplete = ${runtimeTemplate.basicFunction(
|
||||
"prev, event",
|
||||
Template.asString([
|
||||
"link.onerror = link.onload = null;",
|
||||
"link.removeAttribute(loadingAttribute);",
|
||||
"clearTimeout(timeout);",
|
||||
'if(event && event.type != "load") link.parentNode.removeChild(link)',
|
||||
"done(event);",
|
||||
"if(prev) return prev(event);"
|
||||
])
|
||||
)};`,
|
||||
"if(link.getAttribute(loadingAttribute)) {",
|
||||
Template.indent([
|
||||
`var timeout = setTimeout(onLinkComplete.bind(null, undefined, { type: 'timeout', target: link }), ${loadTimeout});`,
|
||||
"link.onerror = onLinkComplete.bind(null, link.onerror);",
|
||||
"link.onload = onLinkComplete.bind(null, link.onload);"
|
||||
]),
|
||||
"} else onLinkComplete(undefined, { type: 'load', target: link });", // We assume any existing stylesheet is render blocking
|
||||
"needAttach && document.head.appendChild(link);",
|
||||
"return link;"
|
||||
]
|
||||
)};`,
|
||||
initialChunkIdsWithCss.size > 5
|
||||
? `${JSON.stringify(
|
||||
Array.from(initialChunkIdsWithCss)
|
||||
)}.forEach(loadCssChunkData);`
|
||||
: initialChunkIdsWithCss.size > 0
|
||||
? `${Array.from(
|
||||
initialChunkIdsWithCss,
|
||||
id => `loadCssChunkData(${JSON.stringify(id)});`
|
||||
).join("")}`
|
||||
: "// no initial css",
|
||||
"",
|
||||
withLoading
|
||||
? Template.asString([
|
||||
`${fn}.css = ${runtimeTemplate.basicFunction(
|
||||
"chunkId, promises",
|
||||
hasCssMatcher !== false
|
||||
? [
|
||||
"// css chunk loading",
|
||||
`var installedChunkData = ${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;`,
|
||||
'if(installedChunkData !== 0) { // 0 means "already installed".',
|
||||
Template.indent([
|
||||
"",
|
||||
'// a Promise means "currently loading".',
|
||||
"if(installedChunkData) {",
|
||||
Template.indent([
|
||||
"promises.push(installedChunkData[2]);"
|
||||
]),
|
||||
"} else {",
|
||||
Template.indent([
|
||||
hasCssMatcher === true
|
||||
? "if(true) { // all chunks have CSS"
|
||||
: `if(${hasCssMatcher("chunkId")}) {`,
|
||||
Template.indent([
|
||||
"// setup Promise in chunk cache",
|
||||
`var promise = new Promise(${runtimeTemplate.expressionFunction(
|
||||
`installedChunkData = installedChunks[chunkId] = [resolve, reject]`,
|
||||
"resolve, reject"
|
||||
)});`,
|
||||
"promises.push(installedChunkData[2] = promise);",
|
||||
"",
|
||||
"// start chunk loading",
|
||||
`var url = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.getChunkCssFilename}(chunkId);`,
|
||||
"// create error before stack unwound to get useful stacktrace later",
|
||||
"var error = new Error();",
|
||||
`var loadingEnded = ${runtimeTemplate.basicFunction(
|
||||
"event",
|
||||
[
|
||||
`if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId)) {`,
|
||||
Template.indent([
|
||||
"installedChunkData = installedChunks[chunkId];",
|
||||
"if(installedChunkData !== 0) installedChunks[chunkId] = undefined;",
|
||||
"if(installedChunkData) {",
|
||||
Template.indent([
|
||||
'if(event.type !== "load") {',
|
||||
Template.indent([
|
||||
"var errorType = event && event.type;",
|
||||
"var realSrc = event && event.target && event.target.src;",
|
||||
"error.message = 'Loading css chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';",
|
||||
"error.name = 'ChunkLoadError';",
|
||||
"error.type = errorType;",
|
||||
"error.request = realSrc;",
|
||||
"installedChunkData[1](error);"
|
||||
]),
|
||||
"} else {",
|
||||
Template.indent([
|
||||
"loadCssChunkData(chunkId, link);",
|
||||
"installedChunkData[0]();"
|
||||
]),
|
||||
"}"
|
||||
]),
|
||||
"}"
|
||||
]),
|
||||
"}"
|
||||
]
|
||||
)};`,
|
||||
"var link = loadStylesheet(chunkId, url, loadingEnded);"
|
||||
]),
|
||||
"} else installedChunks[chunkId] = 0;"
|
||||
]),
|
||||
"}"
|
||||
]),
|
||||
"}"
|
||||
]
|
||||
: "installedChunks[chunkId] = 0;"
|
||||
)};`
|
||||
])
|
||||
: "// no chunk loading",
|
||||
"",
|
||||
withHmr
|
||||
? Template.asString([
|
||||
"var oldTags = [];",
|
||||
"var newTags = [];",
|
||||
`var applyHandler = ${runtimeTemplate.basicFunction("options", [
|
||||
`return { dispose: ${runtimeTemplate.basicFunction("", [
|
||||
"while(oldTags.length) {",
|
||||
Template.indent([
|
||||
"var oldTag = oldTags.pop();",
|
||||
"if(oldTag.parentNode) oldTag.parentNode.removeChild(oldTag);"
|
||||
]),
|
||||
"}"
|
||||
])}, apply: ${runtimeTemplate.basicFunction("", [
|
||||
'while(newTags.length) { var info = newTags.pop(); info[1].media = "all"; loadCssChunkData(info[0], info[1]); }'
|
||||
])} };`
|
||||
])}`,
|
||||
`${
|
||||
RuntimeGlobals.hmrDownloadUpdateHandlers
|
||||
}.css = ${runtimeTemplate.basicFunction(
|
||||
"chunkIds, removedChunks, removedModules, promises, applyHandlers, updatedModulesList",
|
||||
[
|
||||
"applyHandlers.push(applyHandler);",
|
||||
`chunkIds.forEach(${runtimeTemplate.basicFunction("chunkId", [
|
||||
"var oldTag = loadStylesheet(chunkId);",
|
||||
"if(!oldTag) return;",
|
||||
`var filename = ${RuntimeGlobals.getChunkCssFilename}(chunkId);`,
|
||||
`var url = ${RuntimeGlobals.publicPath} + filename;`,
|
||||
`promises.push(new Promise(${runtimeTemplate.basicFunction(
|
||||
"resolve, reject",
|
||||
[
|
||||
`var link = loadStylesheet(chunkId, url, ${runtimeTemplate.basicFunction(
|
||||
"event",
|
||||
[
|
||||
'if(event.type !== "load") {',
|
||||
Template.indent([
|
||||
"var errorType = event && event.type;",
|
||||
"var realSrc = event && event.target && event.target.src;",
|
||||
"error.message = 'Loading css hot update chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';",
|
||||
"error.name = 'ChunkLoadError';",
|
||||
"error.type = errorType;",
|
||||
"error.request = realSrc;",
|
||||
"reject(error);"
|
||||
]),
|
||||
"} else resolve();"
|
||||
]
|
||||
)}, true);`,
|
||||
"oldTags.push(oldTag);",
|
||||
"newTags.push([chunkId, link]);"
|
||||
]
|
||||
)}));`
|
||||
])});`
|
||||
]
|
||||
)}`
|
||||
])
|
||||
: "// no hmr"
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CssLoadingRuntimeModule;
|
|
@ -0,0 +1,444 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { ConcatSource } = require("webpack-sources");
|
||||
const HotUpdateChunk = require("../HotUpdateChunk");
|
||||
const RuntimeGlobals = require("../RuntimeGlobals");
|
||||
const SelfModuleFactory = require("../SelfModuleFactory");
|
||||
const CssExportDependency = require("../dependencies/CssExportDependency");
|
||||
const CssImportDependency = require("../dependencies/CssImportDependency");
|
||||
const CssLocalIdentifierDependency = require("../dependencies/CssLocalIdentifierDependency");
|
||||
const CssSelfLocalIdentifierDependency = require("../dependencies/CssSelfLocalIdentifierDependency");
|
||||
const CssUrlDependency = require("../dependencies/CssUrlDependency");
|
||||
const StaticExportsDependency = require("../dependencies/StaticExportsDependency");
|
||||
const { compareModulesByIdentifier } = require("../util/comparators");
|
||||
const createSchemaValidation = require("../util/create-schema-validation");
|
||||
const createHash = require("../util/createHash");
|
||||
const memoize = require("../util/memoize");
|
||||
const CssGenerator = require("./CssGenerator");
|
||||
const CssParser = require("./CssParser");
|
||||
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
|
||||
const getCssLoadingRuntimeModule = memoize(() =>
|
||||
require("./CssLoadingRuntimeModule")
|
||||
);
|
||||
|
||||
const getSchema = name => {
|
||||
const { definitions } = require("../../schemas/WebpackOptions.json");
|
||||
return {
|
||||
definitions,
|
||||
oneOf: [{ $ref: `#/definitions/${name}` }]
|
||||
};
|
||||
};
|
||||
|
||||
const validateGeneratorOptions = createSchemaValidation(
|
||||
require("../../schemas/plugins/css/CssGeneratorOptions.check.js"),
|
||||
() => getSchema("CssGeneratorOptions"),
|
||||
{
|
||||
name: "Css Modules Plugin",
|
||||
baseDataPath: "parser"
|
||||
}
|
||||
);
|
||||
const validateParserOptions = createSchemaValidation(
|
||||
require("../../schemas/plugins/css/CssParserOptions.check.js"),
|
||||
() => getSchema("CssParserOptions"),
|
||||
{
|
||||
name: "Css Modules Plugin",
|
||||
baseDataPath: "parser"
|
||||
}
|
||||
);
|
||||
|
||||
const escapeCss = (str, omitOptionalUnderscore) => {
|
||||
const escaped = `${str}`.replace(
|
||||
// cspell:word uffff
|
||||
/[^a-zA-Z0-9_\u0081-\uffff-]/g,
|
||||
s => `\\${s}`
|
||||
);
|
||||
return !omitOptionalUnderscore && /^(?!--)[0-9_-]/.test(escaped)
|
||||
? `_${escaped}`
|
||||
: escaped;
|
||||
};
|
||||
|
||||
const plugin = "CssModulesPlugin";
|
||||
|
||||
class CssModulesPlugin {
|
||||
/**
|
||||
* Apply the plugin
|
||||
* @param {Compiler} compiler the compiler instance
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(compiler) {
|
||||
compiler.hooks.compilation.tap(
|
||||
plugin,
|
||||
(compilation, { normalModuleFactory }) => {
|
||||
const selfFactory = new SelfModuleFactory(compilation.moduleGraph);
|
||||
compilation.dependencyFactories.set(
|
||||
CssUrlDependency,
|
||||
normalModuleFactory
|
||||
);
|
||||
compilation.dependencyTemplates.set(
|
||||
CssUrlDependency,
|
||||
new CssUrlDependency.Template()
|
||||
);
|
||||
compilation.dependencyTemplates.set(
|
||||
CssLocalIdentifierDependency,
|
||||
new CssLocalIdentifierDependency.Template()
|
||||
);
|
||||
compilation.dependencyFactories.set(
|
||||
CssSelfLocalIdentifierDependency,
|
||||
selfFactory
|
||||
);
|
||||
compilation.dependencyTemplates.set(
|
||||
CssSelfLocalIdentifierDependency,
|
||||
new CssSelfLocalIdentifierDependency.Template()
|
||||
);
|
||||
compilation.dependencyTemplates.set(
|
||||
CssExportDependency,
|
||||
new CssExportDependency.Template()
|
||||
);
|
||||
compilation.dependencyFactories.set(
|
||||
CssImportDependency,
|
||||
normalModuleFactory
|
||||
);
|
||||
compilation.dependencyTemplates.set(
|
||||
CssImportDependency,
|
||||
new CssImportDependency.Template()
|
||||
);
|
||||
compilation.dependencyTemplates.set(
|
||||
StaticExportsDependency,
|
||||
new StaticExportsDependency.Template()
|
||||
);
|
||||
normalModuleFactory.hooks.createParser
|
||||
.for("css")
|
||||
.tap(plugin, parserOptions => {
|
||||
validateParserOptions(parserOptions);
|
||||
return new CssParser();
|
||||
});
|
||||
normalModuleFactory.hooks.createParser
|
||||
.for("css/global")
|
||||
.tap(plugin, parserOptions => {
|
||||
validateParserOptions(parserOptions);
|
||||
return new CssParser({
|
||||
allowPseudoBlocks: false,
|
||||
allowModeSwitch: false
|
||||
});
|
||||
});
|
||||
normalModuleFactory.hooks.createParser
|
||||
.for("css/module")
|
||||
.tap(plugin, parserOptions => {
|
||||
validateParserOptions(parserOptions);
|
||||
return new CssParser({
|
||||
defaultMode: "local"
|
||||
});
|
||||
});
|
||||
normalModuleFactory.hooks.createGenerator
|
||||
.for("css")
|
||||
.tap(plugin, generatorOptions => {
|
||||
validateGeneratorOptions(generatorOptions);
|
||||
return new CssGenerator();
|
||||
});
|
||||
normalModuleFactory.hooks.createGenerator
|
||||
.for("css/global")
|
||||
.tap(plugin, generatorOptions => {
|
||||
validateGeneratorOptions(generatorOptions);
|
||||
return new CssGenerator();
|
||||
});
|
||||
normalModuleFactory.hooks.createGenerator
|
||||
.for("css/module")
|
||||
.tap(plugin, generatorOptions => {
|
||||
validateGeneratorOptions(generatorOptions);
|
||||
return new CssGenerator();
|
||||
});
|
||||
const orderedCssModulesPerChunk = new WeakMap();
|
||||
compilation.hooks.afterCodeGeneration.tap("CssModulesPlugin", () => {
|
||||
const { chunkGraph } = compilation;
|
||||
for (const chunk of compilation.chunks) {
|
||||
if (CssModulesPlugin.chunkHasCss(chunk, chunkGraph)) {
|
||||
orderedCssModulesPerChunk.set(
|
||||
chunk,
|
||||
this.getOrderedChunkCssModules(chunk, chunkGraph, compilation)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
compilation.hooks.contentHash.tap("CssModulesPlugin", chunk => {
|
||||
const {
|
||||
chunkGraph,
|
||||
outputOptions: {
|
||||
hashSalt,
|
||||
hashDigest,
|
||||
hashDigestLength,
|
||||
hashFunction
|
||||
}
|
||||
} = compilation;
|
||||
const modules = orderedCssModulesPerChunk.get(chunk);
|
||||
if (modules === undefined) return;
|
||||
const hash = createHash(hashFunction);
|
||||
if (hashSalt) hash.update(hashSalt);
|
||||
for (const module of modules) {
|
||||
hash.update(chunkGraph.getModuleHash(module, chunk.runtime));
|
||||
}
|
||||
const digest = /** @type {string} */ (hash.digest(hashDigest));
|
||||
chunk.contentHash.css = digest.substr(0, hashDigestLength);
|
||||
});
|
||||
compilation.hooks.renderManifest.tap(plugin, (result, options) => {
|
||||
const { chunkGraph } = compilation;
|
||||
const { hash, chunk, codeGenerationResults } = options;
|
||||
|
||||
if (chunk instanceof HotUpdateChunk) return result;
|
||||
|
||||
const modules = orderedCssModulesPerChunk.get(chunk);
|
||||
if (modules !== undefined) {
|
||||
result.push({
|
||||
render: () =>
|
||||
this.renderChunk({
|
||||
chunk,
|
||||
chunkGraph,
|
||||
codeGenerationResults,
|
||||
uniqueName: compilation.outputOptions.uniqueName,
|
||||
modules
|
||||
}),
|
||||
filenameTemplate: CssModulesPlugin.getChunkFilenameTemplate(
|
||||
chunk,
|
||||
compilation.outputOptions
|
||||
),
|
||||
pathOptions: {
|
||||
hash,
|
||||
runtime: chunk.runtime,
|
||||
chunk,
|
||||
contentHashType: "css"
|
||||
},
|
||||
identifier: `css${chunk.id}`,
|
||||
hash: chunk.contentHash.css
|
||||
});
|
||||
}
|
||||
return result;
|
||||
});
|
||||
const enabledChunks = new WeakSet();
|
||||
const handler = (chunk, set) => {
|
||||
if (enabledChunks.has(chunk)) {
|
||||
return;
|
||||
}
|
||||
enabledChunks.add(chunk);
|
||||
|
||||
set.add(RuntimeGlobals.publicPath);
|
||||
set.add(RuntimeGlobals.getChunkCssFilename);
|
||||
set.add(RuntimeGlobals.hasOwnProperty);
|
||||
set.add(RuntimeGlobals.moduleFactoriesAddOnly);
|
||||
set.add(RuntimeGlobals.makeNamespaceObject);
|
||||
|
||||
const CssLoadingRuntimeModule = getCssLoadingRuntimeModule();
|
||||
compilation.addRuntimeModule(chunk, new CssLoadingRuntimeModule(set));
|
||||
};
|
||||
compilation.hooks.runtimeRequirementInTree
|
||||
.for(RuntimeGlobals.ensureChunkHandlers)
|
||||
.tap(plugin, handler);
|
||||
compilation.hooks.runtimeRequirementInTree
|
||||
.for(RuntimeGlobals.hmrDownloadUpdateHandlers)
|
||||
.tap(plugin, handler);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getModulesInOrder(chunk, modules, compilation) {
|
||||
if (!modules) return [];
|
||||
|
||||
const modulesList = [...modules];
|
||||
|
||||
// Get ordered list of modules per chunk group
|
||||
// Lists are in reverse order to allow to use Array.pop()
|
||||
const modulesByChunkGroup = Array.from(chunk.groupsIterable, chunkGroup => {
|
||||
const sortedModules = modulesList
|
||||
.map(module => {
|
||||
return {
|
||||
module,
|
||||
index: chunkGroup.getModulePostOrderIndex(module)
|
||||
};
|
||||
})
|
||||
.filter(item => item.index !== undefined)
|
||||
.sort((a, b) => b.index - a.index)
|
||||
.map(item => item.module);
|
||||
|
||||
return { list: sortedModules, set: new Set(sortedModules) };
|
||||
});
|
||||
|
||||
if (modulesByChunkGroup.length === 1)
|
||||
return modulesByChunkGroup[0].list.reverse();
|
||||
|
||||
const compareModuleLists = ({ list: a }, { list: b }) => {
|
||||
if (a.length === 0) {
|
||||
return b.length === 0 ? 0 : 1;
|
||||
} else {
|
||||
if (b.length === 0) return -1;
|
||||
return compareModulesByIdentifier(a[a.length - 1], b[b.length - 1]);
|
||||
}
|
||||
};
|
||||
|
||||
modulesByChunkGroup.sort(compareModuleLists);
|
||||
|
||||
const finalModules = [];
|
||||
|
||||
for (;;) {
|
||||
const failedModules = new Set();
|
||||
const list = modulesByChunkGroup[0].list;
|
||||
if (list.length === 0) {
|
||||
// done, everything empty
|
||||
break;
|
||||
}
|
||||
let selectedModule = list[list.length - 1];
|
||||
let hasFailed = undefined;
|
||||
outer: for (;;) {
|
||||
for (const { list, set } of modulesByChunkGroup) {
|
||||
if (list.length === 0) continue;
|
||||
const lastModule = list[list.length - 1];
|
||||
if (lastModule === selectedModule) continue;
|
||||
if (!set.has(selectedModule)) continue;
|
||||
failedModules.add(selectedModule);
|
||||
if (failedModules.has(lastModule)) {
|
||||
// There is a conflict, try other alternatives
|
||||
hasFailed = lastModule;
|
||||
continue;
|
||||
}
|
||||
selectedModule = lastModule;
|
||||
hasFailed = false;
|
||||
continue outer; // restart
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (hasFailed) {
|
||||
// There is a not resolve-able conflict with the selectedModule
|
||||
if (compilation) {
|
||||
// TODO print better warning
|
||||
compilation.warnings.push(
|
||||
new Error(
|
||||
`chunk ${
|
||||
chunk.name || chunk.id
|
||||
}\nConflicting order between ${hasFailed.readableIdentifier(
|
||||
compilation.requestShortener
|
||||
)} and ${selectedModule.readableIdentifier(
|
||||
compilation.requestShortener
|
||||
)}`
|
||||
)
|
||||
);
|
||||
}
|
||||
selectedModule = hasFailed;
|
||||
}
|
||||
// Insert the selected module into the final modules list
|
||||
finalModules.push(selectedModule);
|
||||
// Remove the selected module from all lists
|
||||
for (const { list, set } of modulesByChunkGroup) {
|
||||
const lastModule = list[list.length - 1];
|
||||
if (lastModule === selectedModule) list.pop();
|
||||
else if (hasFailed && set.has(selectedModule)) {
|
||||
const idx = list.indexOf(selectedModule);
|
||||
if (idx >= 0) list.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
modulesByChunkGroup.sort(compareModuleLists);
|
||||
}
|
||||
return finalModules;
|
||||
}
|
||||
|
||||
getOrderedChunkCssModules(chunk, chunkGraph, compilation) {
|
||||
return [
|
||||
...this.getModulesInOrder(
|
||||
chunk,
|
||||
chunkGraph.getOrderedChunkModulesIterableBySourceType(
|
||||
chunk,
|
||||
"css-import",
|
||||
compareModulesByIdentifier
|
||||
),
|
||||
compilation
|
||||
),
|
||||
...this.getModulesInOrder(
|
||||
chunk,
|
||||
chunkGraph.getOrderedChunkModulesIterableBySourceType(
|
||||
chunk,
|
||||
"css",
|
||||
compareModulesByIdentifier
|
||||
),
|
||||
compilation
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
renderChunk({
|
||||
uniqueName,
|
||||
chunk,
|
||||
chunkGraph,
|
||||
codeGenerationResults,
|
||||
modules
|
||||
}) {
|
||||
const source = new ConcatSource();
|
||||
const metaData = [];
|
||||
for (const module of modules) {
|
||||
try {
|
||||
const codeGenResult = codeGenerationResults.get(module, chunk.runtime);
|
||||
|
||||
const s =
|
||||
codeGenResult.sources.get("css") ||
|
||||
codeGenResult.sources.get("css-import");
|
||||
if (s) {
|
||||
source.add(s);
|
||||
source.add("\n");
|
||||
}
|
||||
const exports =
|
||||
codeGenResult.data && codeGenResult.data.get("css-exports");
|
||||
const moduleId = chunkGraph.getModuleId(module) + "";
|
||||
metaData.push(
|
||||
`${
|
||||
exports
|
||||
? Array.from(exports, ([n, v]) => {
|
||||
const shortcutValue = `${
|
||||
uniqueName ? uniqueName + "-" : ""
|
||||
}${moduleId}-${n}`;
|
||||
return v === shortcutValue
|
||||
? `${escapeCss(n)}/`
|
||||
: v === "--" + shortcutValue
|
||||
? `${escapeCss(n)}%`
|
||||
: `${escapeCss(n)}(${escapeCss(v)})`;
|
||||
}).join("")
|
||||
: ""
|
||||
}${escapeCss(moduleId)}`
|
||||
);
|
||||
} catch (e) {
|
||||
e.message += `\nduring rendering of css ${module.identifier()}`;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
source.add(
|
||||
`head{--webpack-${escapeCss(
|
||||
(uniqueName ? uniqueName + "-" : "") + chunk.id,
|
||||
true
|
||||
)}:${metaData.join(",")};}`
|
||||
);
|
||||
return source;
|
||||
}
|
||||
|
||||
static getChunkFilenameTemplate(chunk, outputOptions) {
|
||||
if (chunk.cssFilenameTemplate) {
|
||||
return chunk.cssFilenameTemplate;
|
||||
} else if (chunk.canBeInitial()) {
|
||||
return outputOptions.cssFilename;
|
||||
} else {
|
||||
return outputOptions.cssChunkFilename;
|
||||
}
|
||||
}
|
||||
|
||||
static chunkHasCss(chunk, chunkGraph) {
|
||||
return (
|
||||
!!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") ||
|
||||
!!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css-import")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CssModulesPlugin;
|
|
@ -0,0 +1,618 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const Parser = require("../Parser");
|
||||
const ConstDependency = require("../dependencies/ConstDependency");
|
||||
const CssExportDependency = require("../dependencies/CssExportDependency");
|
||||
const CssImportDependency = require("../dependencies/CssImportDependency");
|
||||
const CssLocalIdentifierDependency = require("../dependencies/CssLocalIdentifierDependency");
|
||||
const CssSelfLocalIdentifierDependency = require("../dependencies/CssSelfLocalIdentifierDependency");
|
||||
const CssUrlDependency = require("../dependencies/CssUrlDependency");
|
||||
const StaticExportsDependency = require("../dependencies/StaticExportsDependency");
|
||||
const walkCssTokens = require("./walkCssTokens");
|
||||
|
||||
/** @typedef {import("../Parser").ParserState} ParserState */
|
||||
/** @typedef {import("../Parser").PreparsedAst} PreparsedAst */
|
||||
|
||||
const CC_LEFT_CURLY = "{".charCodeAt(0);
|
||||
const CC_RIGHT_CURLY = "}".charCodeAt(0);
|
||||
const CC_COLON = ":".charCodeAt(0);
|
||||
const CC_SLASH = "/".charCodeAt(0);
|
||||
const CC_SEMICOLON = ";".charCodeAt(0);
|
||||
|
||||
const cssUnescape = str => {
|
||||
return str.replace(/\\([0-9a-fA-F]{1,6}[ \t\n\r\f]?|[\s\S])/g, match => {
|
||||
if (match.length > 2) {
|
||||
return String.fromCharCode(parseInt(match.slice(1).trim(), 16));
|
||||
} else {
|
||||
return match[1];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
class LocConverter {
|
||||
constructor(input) {
|
||||
this._input = input;
|
||||
this.line = 1;
|
||||
this.column = 0;
|
||||
this.pos = 0;
|
||||
}
|
||||
|
||||
get(pos) {
|
||||
if (this.pos !== pos) {
|
||||
if (this.pos < pos) {
|
||||
const str = this._input.slice(this.pos, pos);
|
||||
let i = str.lastIndexOf("\n");
|
||||
if (i === -1) {
|
||||
this.column += str.length;
|
||||
} else {
|
||||
this.column = str.length - i - 1;
|
||||
this.line++;
|
||||
while (i > 0 && (i = str.lastIndexOf("\n", i - 1)) !== -1)
|
||||
this.line++;
|
||||
}
|
||||
} else {
|
||||
let i = this._input.lastIndexOf("\n", this.pos);
|
||||
while (i >= pos) {
|
||||
this.line--;
|
||||
i = i > 0 ? this._input.lastIndexOf("\n", i - 1) : -1;
|
||||
}
|
||||
this.column = pos - i;
|
||||
}
|
||||
this.pos = pos;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
const CSS_MODE_TOP_LEVEL = 0;
|
||||
const CSS_MODE_IN_RULE = 1;
|
||||
const CSS_MODE_IN_LOCAL_RULE = 2;
|
||||
const CSS_MODE_AT_IMPORT_EXPECT_URL = 3;
|
||||
// TODO implement layer and supports for @import
|
||||
const CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS = 4;
|
||||
const CSS_MODE_AT_IMPORT_EXPECT_MEDIA = 5;
|
||||
const CSS_MODE_AT_OTHER = 6;
|
||||
|
||||
const explainMode = mode => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL:
|
||||
return "parsing top level css";
|
||||
case CSS_MODE_IN_RULE:
|
||||
return "parsing css rule content (global)";
|
||||
case CSS_MODE_IN_LOCAL_RULE:
|
||||
return "parsing css rule content (local)";
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_URL:
|
||||
return "parsing @import (expecting url)";
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS:
|
||||
return "parsing @import (expecting optionally supports or media query)";
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_MEDIA:
|
||||
return "parsing @import (expecting optionally media query)";
|
||||
case CSS_MODE_AT_OTHER:
|
||||
return "parsing at-rule";
|
||||
default:
|
||||
return mode;
|
||||
}
|
||||
};
|
||||
|
||||
class CssParser extends Parser {
|
||||
constructor({
|
||||
allowPseudoBlocks = true,
|
||||
allowModeSwitch = true,
|
||||
defaultMode = "global"
|
||||
} = {}) {
|
||||
super();
|
||||
this.allowPseudoBlocks = allowPseudoBlocks;
|
||||
this.allowModeSwitch = allowModeSwitch;
|
||||
this.defaultMode = defaultMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | Buffer | PreparsedAst} source the source to parse
|
||||
* @param {ParserState} state the parser state
|
||||
* @returns {ParserState} the parser state
|
||||
*/
|
||||
parse(source, state) {
|
||||
if (Buffer.isBuffer(source)) {
|
||||
source = source.toString("utf-8");
|
||||
} else if (typeof source === "object") {
|
||||
throw new Error("webpackAst is unexpected for the CssParser");
|
||||
}
|
||||
if (source[0] === "\ufeff") {
|
||||
source = source.slice(1);
|
||||
}
|
||||
|
||||
const module = state.module;
|
||||
|
||||
const declaredCssVariables = new Set();
|
||||
|
||||
const locConverter = new LocConverter(source);
|
||||
let mode = CSS_MODE_TOP_LEVEL;
|
||||
let modePos = 0;
|
||||
let modeNestingLevel = 0;
|
||||
let modeData = undefined;
|
||||
let singleClassSelector = undefined;
|
||||
let lastIdentifier = undefined;
|
||||
const modeStack = [];
|
||||
const isTopLevelLocal = () =>
|
||||
modeData === "local" ||
|
||||
(this.defaultMode === "local" && modeData === undefined);
|
||||
const eatWhiteLine = (input, pos) => {
|
||||
for (;;) {
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === 32 || cc === 9) {
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
if (cc === 10) pos++;
|
||||
break;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
const eatUntil = chars => {
|
||||
const charCodes = Array.from({ length: chars.length }, (_, i) =>
|
||||
chars.charCodeAt(i)
|
||||
);
|
||||
const arr = Array.from(
|
||||
{ length: charCodes.reduce((a, b) => Math.max(a, b), 0) + 1 },
|
||||
() => false
|
||||
);
|
||||
charCodes.forEach(cc => (arr[cc] = true));
|
||||
return (input, pos) => {
|
||||
for (;;) {
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc < arr.length && arr[cc]) {
|
||||
return pos;
|
||||
}
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
}
|
||||
};
|
||||
};
|
||||
const eatText = (input, pos, eater) => {
|
||||
let text = "";
|
||||
for (;;) {
|
||||
if (input.charCodeAt(pos) === CC_SLASH) {
|
||||
const newPos = walkCssTokens.eatComments(input, pos);
|
||||
if (pos !== newPos) {
|
||||
pos = newPos;
|
||||
if (pos === input.length) break;
|
||||
} else {
|
||||
text += "/";
|
||||
pos++;
|
||||
if (pos === input.length) break;
|
||||
}
|
||||
}
|
||||
const newPos = eater(input, pos);
|
||||
if (pos !== newPos) {
|
||||
text += input.slice(pos, newPos);
|
||||
pos = newPos;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (pos === input.length) break;
|
||||
}
|
||||
return [pos, text.trimRight()];
|
||||
};
|
||||
const eatExportName = eatUntil(":};/");
|
||||
const eatExportValue = eatUntil("};/");
|
||||
const parseExports = (input, pos) => {
|
||||
pos = walkCssTokens.eatWhitespaceAndComments(input, pos);
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc !== CC_LEFT_CURLY)
|
||||
throw new Error(
|
||||
`Unexpected ${input[pos]} at ${pos} during parsing of ':export' (expected '{')`
|
||||
);
|
||||
pos++;
|
||||
pos = walkCssTokens.eatWhitespaceAndComments(input, pos);
|
||||
for (;;) {
|
||||
if (input.charCodeAt(pos) === CC_RIGHT_CURLY) break;
|
||||
pos = walkCssTokens.eatWhitespaceAndComments(input, pos);
|
||||
if (pos === input.length) return pos;
|
||||
let start = pos;
|
||||
let name;
|
||||
[pos, name] = eatText(input, pos, eatExportName);
|
||||
if (pos === input.length) return pos;
|
||||
if (input.charCodeAt(pos) !== CC_COLON) {
|
||||
throw new Error(
|
||||
`Unexpected ${input[pos]} at ${pos} during parsing of export name in ':export' (expected ':')`
|
||||
);
|
||||
}
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
pos = walkCssTokens.eatWhitespaceAndComments(input, pos);
|
||||
if (pos === input.length) return pos;
|
||||
let value;
|
||||
[pos, value] = eatText(input, pos, eatExportValue);
|
||||
if (pos === input.length) return pos;
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === CC_SEMICOLON) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
pos = walkCssTokens.eatWhitespaceAndComments(input, pos);
|
||||
if (pos === input.length) return pos;
|
||||
} else if (cc !== CC_RIGHT_CURLY) {
|
||||
throw new Error(
|
||||
`Unexpected ${input[pos]} at ${pos} during parsing of export value in ':export' (expected ';' or '}')`
|
||||
);
|
||||
}
|
||||
const dep = new CssExportDependency(name, value);
|
||||
const { line: sl, column: sc } = locConverter.get(start);
|
||||
const { line: el, column: ec } = locConverter.get(pos);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
}
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
pos = eatWhiteLine(input, pos);
|
||||
return pos;
|
||||
};
|
||||
const eatPropertyName = eatUntil(":{};");
|
||||
const processLocalDeclaration = (input, pos) => {
|
||||
modeData = undefined;
|
||||
const start = pos;
|
||||
pos = walkCssTokens.eatWhitespaceAndComments(input, pos);
|
||||
const propertyNameStart = pos;
|
||||
const [propertyNameEnd, propertyName] = eatText(
|
||||
input,
|
||||
pos,
|
||||
eatPropertyName
|
||||
);
|
||||
if (input.charCodeAt(propertyNameEnd) !== CC_COLON) return start;
|
||||
pos = propertyNameEnd + 1;
|
||||
if (propertyName.startsWith("--")) {
|
||||
// CSS Variable
|
||||
const { line: sl, column: sc } = locConverter.get(propertyNameStart);
|
||||
const { line: el, column: ec } = locConverter.get(propertyNameEnd);
|
||||
const name = propertyName.slice(2);
|
||||
const dep = new CssLocalIdentifierDependency(
|
||||
name,
|
||||
[propertyNameStart, propertyNameEnd],
|
||||
"--"
|
||||
);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
declaredCssVariables.add(name);
|
||||
} else if (
|
||||
propertyName === "animation-name" ||
|
||||
propertyName === "animation"
|
||||
) {
|
||||
modeData = "animation";
|
||||
lastIdentifier = undefined;
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
const processDeclarationValueDone = (input, pos) => {
|
||||
if (modeData === "animation" && lastIdentifier) {
|
||||
const { line: sl, column: sc } = locConverter.get(lastIdentifier[0]);
|
||||
const { line: el, column: ec } = locConverter.get(lastIdentifier[1]);
|
||||
const name = input.slice(lastIdentifier[0], lastIdentifier[1]);
|
||||
const dep = new CssSelfLocalIdentifierDependency(name, lastIdentifier);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
}
|
||||
};
|
||||
const eatKeyframes = eatUntil("{};/");
|
||||
const eatNameInVar = eatUntil(",)};/");
|
||||
walkCssTokens(source, {
|
||||
isSelector: () => {
|
||||
return mode !== CSS_MODE_IN_RULE && mode !== CSS_MODE_IN_LOCAL_RULE;
|
||||
},
|
||||
url: (input, start, end, contentStart, contentEnd) => {
|
||||
const value = cssUnescape(input.slice(contentStart, contentEnd));
|
||||
switch (mode) {
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_URL: {
|
||||
modeData.url = value;
|
||||
mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS;
|
||||
break;
|
||||
}
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS:
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_MEDIA:
|
||||
throw new Error(
|
||||
`Unexpected ${input.slice(
|
||||
start,
|
||||
end
|
||||
)} at ${start} during ${explainMode(mode)}`
|
||||
);
|
||||
default: {
|
||||
const dep = new CssUrlDependency(value, [start, end], "url");
|
||||
const { line: sl, column: sc } = locConverter.get(start);
|
||||
const { line: el, column: ec } = locConverter.get(end);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
module.addCodeGenerationDependency(dep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
},
|
||||
string: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_URL: {
|
||||
modeData.url = cssUnescape(input.slice(start + 1, end - 1));
|
||||
mode = CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
},
|
||||
atKeyword: (input, start, end) => {
|
||||
const name = input.slice(start, end);
|
||||
if (name === "@namespace") {
|
||||
throw new Error("@namespace is not supported in bundled CSS");
|
||||
}
|
||||
if (name === "@import") {
|
||||
if (mode !== CSS_MODE_TOP_LEVEL) {
|
||||
throw new Error(
|
||||
`Unexpected @import at ${start} during ${explainMode(mode)}`
|
||||
);
|
||||
}
|
||||
mode = CSS_MODE_AT_IMPORT_EXPECT_URL;
|
||||
modePos = end;
|
||||
modeData = {
|
||||
start: start,
|
||||
url: undefined,
|
||||
supports: undefined
|
||||
};
|
||||
}
|
||||
if (name === "@keyframes") {
|
||||
let pos = end;
|
||||
pos = walkCssTokens.eatWhitespaceAndComments(input, pos);
|
||||
if (pos === input.length) return pos;
|
||||
const [newPos, name] = eatText(input, pos, eatKeyframes);
|
||||
const { line: sl, column: sc } = locConverter.get(pos);
|
||||
const { line: el, column: ec } = locConverter.get(newPos);
|
||||
const dep = new CssLocalIdentifierDependency(name, [pos, newPos]);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
pos = newPos;
|
||||
if (pos === input.length) return pos;
|
||||
if (input.charCodeAt(pos) !== CC_LEFT_CURLY) {
|
||||
throw new Error(
|
||||
`Unexpected ${input[pos]} at ${pos} during parsing of @keyframes (expected '{')`
|
||||
);
|
||||
}
|
||||
mode = CSS_MODE_IN_LOCAL_RULE;
|
||||
modeNestingLevel = 1;
|
||||
return pos + 1;
|
||||
}
|
||||
return end;
|
||||
},
|
||||
semicolon: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_URL:
|
||||
throw new Error(`Expected URL for @import at ${start}`);
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_MEDIA:
|
||||
case CSS_MODE_AT_IMPORT_EXPECT_SUPPORTS: {
|
||||
const { line: sl, column: sc } = locConverter.get(modeData.start);
|
||||
const { line: el, column: ec } = locConverter.get(end);
|
||||
end = eatWhiteLine(input, end);
|
||||
const media = input.slice(modePos, start).trim();
|
||||
const dep = new CssImportDependency(
|
||||
modeData.url,
|
||||
[modeData.start, end],
|
||||
modeData.supports,
|
||||
media
|
||||
);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
break;
|
||||
}
|
||||
case CSS_MODE_IN_LOCAL_RULE: {
|
||||
processDeclarationValueDone(input, start);
|
||||
return processLocalDeclaration(input, end);
|
||||
}
|
||||
case CSS_MODE_IN_RULE: {
|
||||
return end;
|
||||
}
|
||||
}
|
||||
mode = CSS_MODE_TOP_LEVEL;
|
||||
modeData = undefined;
|
||||
singleClassSelector = undefined;
|
||||
return end;
|
||||
},
|
||||
leftCurlyBracket: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL:
|
||||
mode = isTopLevelLocal()
|
||||
? CSS_MODE_IN_LOCAL_RULE
|
||||
: CSS_MODE_IN_RULE;
|
||||
modeNestingLevel = 1;
|
||||
if (mode === CSS_MODE_IN_LOCAL_RULE)
|
||||
return processLocalDeclaration(input, end);
|
||||
break;
|
||||
case CSS_MODE_IN_RULE:
|
||||
case CSS_MODE_IN_LOCAL_RULE:
|
||||
modeNestingLevel++;
|
||||
break;
|
||||
}
|
||||
return end;
|
||||
},
|
||||
rightCurlyBracket: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_IN_LOCAL_RULE:
|
||||
processDeclarationValueDone(input, start);
|
||||
/* falls through */
|
||||
case CSS_MODE_IN_RULE:
|
||||
if (--modeNestingLevel === 0) {
|
||||
mode = CSS_MODE_TOP_LEVEL;
|
||||
modeData = undefined;
|
||||
singleClassSelector = undefined;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return end;
|
||||
},
|
||||
id: (input, start, end) => {
|
||||
singleClassSelector = false;
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL:
|
||||
if (isTopLevelLocal()) {
|
||||
const name = input.slice(start + 1, end);
|
||||
const dep = new CssLocalIdentifierDependency(name, [
|
||||
start + 1,
|
||||
end
|
||||
]);
|
||||
const { line: sl, column: sc } = locConverter.get(start);
|
||||
const { line: el, column: ec } = locConverter.get(end);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return end;
|
||||
},
|
||||
identifier: (input, start, end) => {
|
||||
singleClassSelector = false;
|
||||
switch (mode) {
|
||||
case CSS_MODE_IN_LOCAL_RULE:
|
||||
if (modeData === "animation") {
|
||||
lastIdentifier = [start, end];
|
||||
}
|
||||
break;
|
||||
}
|
||||
return end;
|
||||
},
|
||||
class: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL: {
|
||||
if (isTopLevelLocal()) {
|
||||
const name = input.slice(start + 1, end);
|
||||
const dep = new CssLocalIdentifierDependency(name, [
|
||||
start + 1,
|
||||
end
|
||||
]);
|
||||
const { line: sl, column: sc } = locConverter.get(start);
|
||||
const { line: el, column: ec } = locConverter.get(end);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
if (singleClassSelector === undefined) singleClassSelector = name;
|
||||
} else {
|
||||
singleClassSelector = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
},
|
||||
leftParenthesis: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL: {
|
||||
modeStack.push(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
},
|
||||
rightParenthesis: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL: {
|
||||
const newModeData = modeStack.pop();
|
||||
if (newModeData !== false) {
|
||||
modeData = newModeData;
|
||||
const dep = new ConstDependency("", [start, end]);
|
||||
module.addPresentationalDependency(dep);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
},
|
||||
pseudoClass: (input, start, end) => {
|
||||
singleClassSelector = false;
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL: {
|
||||
const name = input.slice(start, end);
|
||||
if (this.allowModeSwitch && name === ":global") {
|
||||
modeData = "global";
|
||||
const dep = new ConstDependency("", [start, end]);
|
||||
module.addPresentationalDependency(dep);
|
||||
} else if (this.allowModeSwitch && name === ":local") {
|
||||
modeData = "local";
|
||||
const dep = new ConstDependency("", [start, end]);
|
||||
module.addPresentationalDependency(dep);
|
||||
} else if (this.allowPseudoBlocks && name === ":export") {
|
||||
const pos = parseExports(input, end);
|
||||
const dep = new ConstDependency("", [start, pos]);
|
||||
module.addPresentationalDependency(dep);
|
||||
return pos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
},
|
||||
pseudoFunction: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL: {
|
||||
const name = input.slice(start, end - 1);
|
||||
if (this.allowModeSwitch && name === ":global") {
|
||||
modeStack.push(modeData);
|
||||
modeData = "global";
|
||||
const dep = new ConstDependency("", [start, end]);
|
||||
module.addPresentationalDependency(dep);
|
||||
} else if (this.allowModeSwitch && name === ":local") {
|
||||
modeStack.push(modeData);
|
||||
modeData = "local";
|
||||
const dep = new ConstDependency("", [start, end]);
|
||||
module.addPresentationalDependency(dep);
|
||||
} else {
|
||||
modeStack.push(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
},
|
||||
function: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_IN_LOCAL_RULE: {
|
||||
const name = input.slice(start, end - 1);
|
||||
if (name === "var") {
|
||||
let pos = walkCssTokens.eatWhitespaceAndComments(input, end);
|
||||
if (pos === input.length) return pos;
|
||||
const [newPos, name] = eatText(input, pos, eatNameInVar);
|
||||
if (!name.startsWith("--")) return end;
|
||||
const { line: sl, column: sc } = locConverter.get(pos);
|
||||
const { line: el, column: ec } = locConverter.get(newPos);
|
||||
const dep = new CssSelfLocalIdentifierDependency(
|
||||
name.slice(2),
|
||||
[pos, newPos],
|
||||
"--",
|
||||
declaredCssVariables
|
||||
);
|
||||
dep.setLoc(sl, sc, el, ec);
|
||||
module.addDependency(dep);
|
||||
return newPos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
},
|
||||
comma: (input, start, end) => {
|
||||
switch (mode) {
|
||||
case CSS_MODE_TOP_LEVEL:
|
||||
modeData = undefined;
|
||||
modeStack.length = 0;
|
||||
break;
|
||||
case CSS_MODE_IN_LOCAL_RULE:
|
||||
processDeclarationValueDone(input, start);
|
||||
break;
|
||||
}
|
||||
return end;
|
||||
}
|
||||
});
|
||||
|
||||
module.buildInfo.strict = true;
|
||||
module.buildMeta.exportsType = "namespace";
|
||||
module.addDependency(new StaticExportsDependency([], true));
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CssParser;
|
|
@ -0,0 +1,659 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @typedef {Object} CssTokenCallbacks
|
||||
* @property {function(string, number): boolean} isSelector
|
||||
* @property {function(string, number, number, number, number): number=} url
|
||||
* @property {function(string, number, number): number=} string
|
||||
* @property {function(string, number, number): number=} leftParenthesis
|
||||
* @property {function(string, number, number): number=} rightParenthesis
|
||||
* @property {function(string, number, number): number=} pseudoFunction
|
||||
* @property {function(string, number, number): number=} function
|
||||
* @property {function(string, number, number): number=} pseudoClass
|
||||
* @property {function(string, number, number): number=} atKeyword
|
||||
* @property {function(string, number, number): number=} class
|
||||
* @property {function(string, number, number): number=} identifier
|
||||
* @property {function(string, number, number): number=} id
|
||||
* @property {function(string, number, number): number=} leftCurlyBracket
|
||||
* @property {function(string, number, number): number=} rightCurlyBracket
|
||||
* @property {function(string, number, number): number=} semicolon
|
||||
* @property {function(string, number, number): number=} comma
|
||||
*/
|
||||
|
||||
/** @typedef {function(string, number, CssTokenCallbacks): number} CharHandler */
|
||||
|
||||
// spec: https://drafts.csswg.org/css-syntax/
|
||||
|
||||
const CC_LINE_FEED = "\n".charCodeAt(0);
|
||||
const CC_CARRIAGE_RETURN = "\r".charCodeAt(0);
|
||||
const CC_FORM_FEED = "\f".charCodeAt(0);
|
||||
|
||||
const CC_TAB = "\t".charCodeAt(0);
|
||||
const CC_SPACE = " ".charCodeAt(0);
|
||||
|
||||
const CC_SLASH = "/".charCodeAt(0);
|
||||
const CC_BACK_SLASH = "\\".charCodeAt(0);
|
||||
const CC_ASTERISK = "*".charCodeAt(0);
|
||||
|
||||
const CC_LEFT_PARENTHESIS = "(".charCodeAt(0);
|
||||
const CC_RIGHT_PARENTHESIS = ")".charCodeAt(0);
|
||||
const CC_LEFT_CURLY = "{".charCodeAt(0);
|
||||
const CC_RIGHT_CURLY = "}".charCodeAt(0);
|
||||
|
||||
const CC_QUOTATION_MARK = '"'.charCodeAt(0);
|
||||
const CC_APOSTROPHE = "'".charCodeAt(0);
|
||||
|
||||
const CC_FULL_STOP = ".".charCodeAt(0);
|
||||
const CC_COLON = ":".charCodeAt(0);
|
||||
const CC_SEMICOLON = ";".charCodeAt(0);
|
||||
const CC_COMMA = ",".charCodeAt(0);
|
||||
const CC_PERCENTAGE = "%".charCodeAt(0);
|
||||
const CC_AT_SIGN = "@".charCodeAt(0);
|
||||
|
||||
const CC_LOW_LINE = "_".charCodeAt(0);
|
||||
const CC_LOWER_A = "a".charCodeAt(0);
|
||||
const CC_LOWER_U = "u".charCodeAt(0);
|
||||
const CC_LOWER_E = "e".charCodeAt(0);
|
||||
const CC_LOWER_Z = "z".charCodeAt(0);
|
||||
const CC_UPPER_A = "A".charCodeAt(0);
|
||||
const CC_UPPER_E = "E".charCodeAt(0);
|
||||
const CC_UPPER_Z = "Z".charCodeAt(0);
|
||||
const CC_0 = "0".charCodeAt(0);
|
||||
const CC_9 = "9".charCodeAt(0);
|
||||
|
||||
const CC_NUMBER_SIGN = "#".charCodeAt(0);
|
||||
const CC_PLUS_SIGN = "+".charCodeAt(0);
|
||||
const CC_HYPHEN_MINUS = "-".charCodeAt(0);
|
||||
|
||||
const CC_LESS_THAN_SIGN = "<".charCodeAt(0);
|
||||
const CC_GREATER_THAN_SIGN = ">".charCodeAt(0);
|
||||
|
||||
const _isNewLine = cc => {
|
||||
return (
|
||||
cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED
|
||||
);
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeSpace = (input, pos, callbacks) => {
|
||||
let cc;
|
||||
do {
|
||||
pos++;
|
||||
cc = input.charCodeAt(pos);
|
||||
} while (_isWhiteSpace(cc));
|
||||
return pos;
|
||||
};
|
||||
|
||||
const _isWhiteSpace = cc => {
|
||||
return (
|
||||
cc === CC_LINE_FEED ||
|
||||
cc === CC_CARRIAGE_RETURN ||
|
||||
cc === CC_FORM_FEED ||
|
||||
cc === CC_TAB ||
|
||||
cc === CC_SPACE
|
||||
);
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeSingleCharToken = (input, pos, callbacks) => {
|
||||
return pos + 1;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumePotentialComment = (input, pos, callbacks) => {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
let cc = input.charCodeAt(pos);
|
||||
if (cc !== CC_ASTERISK) return pos;
|
||||
for (;;) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
while (cc === CC_ASTERISK) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
if (cc === CC_SLASH) return pos + 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** @type {function(number): CharHandler} */
|
||||
const consumeString = end => (input, pos, callbacks) => {
|
||||
const start = pos;
|
||||
pos = _consumeString(input, pos, end);
|
||||
if (callbacks.string !== undefined) {
|
||||
pos = callbacks.string(input, start, pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
const _consumeString = (input, pos, end) => {
|
||||
pos++;
|
||||
for (;;) {
|
||||
if (pos === input.length) return pos;
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === end) return pos + 1;
|
||||
if (_isNewLine(cc)) {
|
||||
// bad string
|
||||
return pos;
|
||||
}
|
||||
if (cc === CC_BACK_SLASH) {
|
||||
// we don't need to fully parse the escaped code point
|
||||
// just skip over a potential new line
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
pos++;
|
||||
} else {
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const _isIdentifierStartCode = cc => {
|
||||
return (
|
||||
cc === CC_LOW_LINE ||
|
||||
(cc >= CC_LOWER_A && cc <= CC_LOWER_Z) ||
|
||||
(cc >= CC_UPPER_A && cc <= CC_UPPER_Z) ||
|
||||
cc > 0x80
|
||||
);
|
||||
};
|
||||
|
||||
const _isDigit = cc => {
|
||||
return cc >= CC_0 && cc <= CC_9;
|
||||
};
|
||||
|
||||
const _startsIdentifier = (input, pos) => {
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === CC_HYPHEN_MINUS) {
|
||||
if (pos === input.length) return false;
|
||||
const cc = input.charCodeAt(pos + 1);
|
||||
if (cc === CC_HYPHEN_MINUS) return true;
|
||||
if (cc === CC_BACK_SLASH) {
|
||||
const cc = input.charCodeAt(pos + 2);
|
||||
return !_isNewLine(cc);
|
||||
}
|
||||
return _isIdentifierStartCode(cc);
|
||||
}
|
||||
if (cc === CC_BACK_SLASH) {
|
||||
const cc = input.charCodeAt(pos + 1);
|
||||
return !_isNewLine(cc);
|
||||
}
|
||||
return _isIdentifierStartCode(cc);
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeNumberSign = (input, pos, callbacks) => {
|
||||
const start = pos;
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
if (callbacks.isSelector(input, pos) && _startsIdentifier(input, pos)) {
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
if (callbacks.id !== undefined) {
|
||||
return callbacks.id(input, start, pos);
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeMinus = (input, pos, callbacks) => {
|
||||
const start = pos;
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === CC_FULL_STOP || _isDigit(cc)) {
|
||||
return consumeNumericToken(input, pos, callbacks);
|
||||
} else if (cc === CC_HYPHEN_MINUS) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === CC_GREATER_THAN_SIGN) {
|
||||
return pos + 1;
|
||||
} else {
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
if (callbacks.identifier !== undefined) {
|
||||
return callbacks.identifier(input, start, pos);
|
||||
}
|
||||
}
|
||||
} else if (cc === CC_BACK_SLASH) {
|
||||
if (pos + 1 === input.length) return pos;
|
||||
const cc = input.charCodeAt(pos + 1);
|
||||
if (_isNewLine(cc)) return pos;
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
if (callbacks.identifier !== undefined) {
|
||||
return callbacks.identifier(input, start, pos);
|
||||
}
|
||||
} else if (_isIdentifierStartCode(cc)) {
|
||||
pos++;
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
if (callbacks.identifier !== undefined) {
|
||||
return callbacks.identifier(input, start, pos);
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeDot = (input, pos, callbacks) => {
|
||||
const start = pos;
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (_isDigit(cc)) return consumeNumericToken(input, pos - 2, callbacks);
|
||||
if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos))
|
||||
return pos;
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
if (callbacks.class !== undefined) return callbacks.class(input, start, pos);
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeNumericToken = (input, pos, callbacks) => {
|
||||
pos = _consumeNumber(input, pos);
|
||||
if (pos === input.length) return pos;
|
||||
if (_startsIdentifier(input, pos)) return _consumeIdentifier(input, pos);
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === CC_PERCENTAGE) return pos + 1;
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeOtherIdentifier = (input, pos, callbacks) => {
|
||||
const start = pos;
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
if (
|
||||
pos !== input.length &&
|
||||
!callbacks.isSelector(input, pos) &&
|
||||
input.charCodeAt(pos) === CC_LEFT_PARENTHESIS
|
||||
) {
|
||||
pos++;
|
||||
if (callbacks.function !== undefined) {
|
||||
return callbacks.function(input, start, pos);
|
||||
}
|
||||
} else {
|
||||
if (callbacks.identifier !== undefined) {
|
||||
return callbacks.identifier(input, start, pos);
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumePotentialUrl = (input, pos, callbacks) => {
|
||||
const start = pos;
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
if (pos === start + 3 && input.slice(start, pos + 1) === "url(") {
|
||||
pos++;
|
||||
let cc = input.charCodeAt(pos);
|
||||
while (_isWhiteSpace(cc)) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
}
|
||||
if (cc === CC_QUOTATION_MARK || cc === CC_APOSTROPHE) {
|
||||
pos++;
|
||||
const contentStart = pos;
|
||||
pos = _consumeString(input, pos, cc);
|
||||
const contentEnd = pos - 1;
|
||||
cc = input.charCodeAt(pos);
|
||||
while (_isWhiteSpace(cc)) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
}
|
||||
if (cc !== CC_RIGHT_PARENTHESIS) return pos;
|
||||
pos++;
|
||||
if (callbacks.url !== undefined)
|
||||
return callbacks.url(input, start, pos, contentStart, contentEnd);
|
||||
return pos;
|
||||
} else {
|
||||
const contentStart = pos;
|
||||
let contentEnd;
|
||||
for (;;) {
|
||||
if (cc === CC_BACK_SLASH) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
pos++;
|
||||
} else if (_isWhiteSpace(cc)) {
|
||||
contentEnd = pos;
|
||||
do {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
} while (_isWhiteSpace(cc));
|
||||
if (cc !== CC_RIGHT_PARENTHESIS) return pos;
|
||||
pos++;
|
||||
if (callbacks.url !== undefined) {
|
||||
return callbacks.url(input, start, pos, contentStart, contentEnd);
|
||||
}
|
||||
return pos;
|
||||
} else if (cc === CC_RIGHT_PARENTHESIS) {
|
||||
contentEnd = pos;
|
||||
pos++;
|
||||
if (callbacks.url !== undefined) {
|
||||
return callbacks.url(input, start, pos, contentStart, contentEnd);
|
||||
}
|
||||
return pos;
|
||||
} else if (cc === CC_LEFT_PARENTHESIS) {
|
||||
return pos;
|
||||
} else {
|
||||
pos++;
|
||||
}
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (callbacks.identifier !== undefined) {
|
||||
return callbacks.identifier(input, start, pos);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumePotentialPseudo = (input, pos, callbacks) => {
|
||||
const start = pos;
|
||||
pos++;
|
||||
if (!callbacks.isSelector(input, pos) || !_startsIdentifier(input, pos))
|
||||
return pos;
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
let cc = input.charCodeAt(pos);
|
||||
if (cc === CC_LEFT_PARENTHESIS) {
|
||||
pos++;
|
||||
if (callbacks.pseudoFunction !== undefined) {
|
||||
return callbacks.pseudoFunction(input, start, pos);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
if (callbacks.pseudoClass !== undefined) {
|
||||
return callbacks.pseudoClass(input, start, pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeLeftParenthesis = (input, pos, callbacks) => {
|
||||
pos++;
|
||||
if (callbacks.leftParenthesis !== undefined) {
|
||||
return callbacks.leftParenthesis(input, pos - 1, pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeRightParenthesis = (input, pos, callbacks) => {
|
||||
pos++;
|
||||
if (callbacks.rightParenthesis !== undefined) {
|
||||
return callbacks.rightParenthesis(input, pos - 1, pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeLeftCurlyBracket = (input, pos, callbacks) => {
|
||||
pos++;
|
||||
if (callbacks.leftCurlyBracket !== undefined) {
|
||||
return callbacks.leftCurlyBracket(input, pos - 1, pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeRightCurlyBracket = (input, pos, callbacks) => {
|
||||
pos++;
|
||||
if (callbacks.rightCurlyBracket !== undefined) {
|
||||
return callbacks.rightCurlyBracket(input, pos - 1, pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeSemicolon = (input, pos, callbacks) => {
|
||||
pos++;
|
||||
if (callbacks.semicolon !== undefined) {
|
||||
return callbacks.semicolon(input, pos - 1, pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeComma = (input, pos, callbacks) => {
|
||||
pos++;
|
||||
if (callbacks.comma !== undefined) {
|
||||
return callbacks.comma(input, pos - 1, pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
const _consumeIdentifier = (input, pos) => {
|
||||
for (;;) {
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === CC_BACK_SLASH) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
pos++;
|
||||
} else if (
|
||||
_isIdentifierStartCode(cc) ||
|
||||
_isDigit(cc) ||
|
||||
cc === CC_HYPHEN_MINUS
|
||||
) {
|
||||
pos++;
|
||||
} else {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const _consumeNumber = (input, pos) => {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
let cc = input.charCodeAt(pos);
|
||||
while (_isDigit(cc)) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
}
|
||||
if (cc === CC_FULL_STOP && pos + 1 !== input.length) {
|
||||
const next = input.charCodeAt(pos + 1);
|
||||
if (_isDigit(next)) {
|
||||
pos += 2;
|
||||
cc = input.charCodeAt(pos);
|
||||
while (_isDigit(cc)) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cc === CC_LOWER_E || cc === CC_UPPER_E) {
|
||||
if (pos + 1 !== input.length) {
|
||||
const next = input.charCodeAt(pos + 2);
|
||||
if (_isDigit(next)) {
|
||||
pos += 2;
|
||||
} else if (
|
||||
(next === CC_HYPHEN_MINUS || next === CC_PLUS_SIGN) &&
|
||||
pos + 2 !== input.length
|
||||
) {
|
||||
const next = input.charCodeAt(pos + 2);
|
||||
if (_isDigit(next)) {
|
||||
pos += 3;
|
||||
} else {
|
||||
return pos;
|
||||
}
|
||||
} else {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return pos;
|
||||
}
|
||||
cc = input.charCodeAt(pos);
|
||||
while (_isDigit(cc)) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeLessThan = (input, pos, callbacks) => {
|
||||
if (input.slice(pos + 1, pos + 4) === "!--") return pos + 4;
|
||||
return pos + 1;
|
||||
};
|
||||
|
||||
/** @type {CharHandler} */
|
||||
const consumeAt = (input, pos, callbacks) => {
|
||||
const start = pos;
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
if (_startsIdentifier(input, pos)) {
|
||||
pos = _consumeIdentifier(input, pos);
|
||||
if (callbacks.atKeyword !== undefined) {
|
||||
pos = callbacks.atKeyword(input, start, pos);
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
const CHAR_MAP = Array.from({ length: 0x80 }, (_, cc) => {
|
||||
// https://drafts.csswg.org/css-syntax/#consume-token
|
||||
switch (cc) {
|
||||
case CC_LINE_FEED:
|
||||
case CC_CARRIAGE_RETURN:
|
||||
case CC_FORM_FEED:
|
||||
case CC_TAB:
|
||||
case CC_SPACE:
|
||||
return consumeSpace;
|
||||
case CC_QUOTATION_MARK:
|
||||
case CC_APOSTROPHE:
|
||||
return consumeString(cc);
|
||||
case CC_NUMBER_SIGN:
|
||||
return consumeNumberSign;
|
||||
case CC_SLASH:
|
||||
return consumePotentialComment;
|
||||
// case CC_LEFT_SQUARE:
|
||||
// case CC_RIGHT_SQUARE:
|
||||
// case CC_COMMA:
|
||||
// case CC_COLON:
|
||||
// return consumeSingleCharToken;
|
||||
case CC_COMMA:
|
||||
return consumeComma;
|
||||
case CC_SEMICOLON:
|
||||
return consumeSemicolon;
|
||||
case CC_LEFT_PARENTHESIS:
|
||||
return consumeLeftParenthesis;
|
||||
case CC_RIGHT_PARENTHESIS:
|
||||
return consumeRightParenthesis;
|
||||
case CC_LEFT_CURLY:
|
||||
return consumeLeftCurlyBracket;
|
||||
case CC_RIGHT_CURLY:
|
||||
return consumeRightCurlyBracket;
|
||||
case CC_COLON:
|
||||
return consumePotentialPseudo;
|
||||
case CC_PLUS_SIGN:
|
||||
return consumeNumericToken;
|
||||
case CC_FULL_STOP:
|
||||
return consumeDot;
|
||||
case CC_HYPHEN_MINUS:
|
||||
return consumeMinus;
|
||||
case CC_LESS_THAN_SIGN:
|
||||
return consumeLessThan;
|
||||
case CC_AT_SIGN:
|
||||
return consumeAt;
|
||||
case CC_LOWER_U:
|
||||
return consumePotentialUrl;
|
||||
case CC_LOW_LINE:
|
||||
return consumeOtherIdentifier;
|
||||
default:
|
||||
if (_isDigit(cc)) return consumeNumericToken;
|
||||
if (
|
||||
(cc >= CC_LOWER_A && cc <= CC_LOWER_Z) ||
|
||||
(cc >= CC_UPPER_A && cc <= CC_UPPER_Z)
|
||||
) {
|
||||
return consumeOtherIdentifier;
|
||||
}
|
||||
return consumeSingleCharToken;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {string} input input css
|
||||
* @param {CssTokenCallbacks} callbacks callbacks
|
||||
* @returns {void}
|
||||
*/
|
||||
module.exports = (input, callbacks) => {
|
||||
let pos = 0;
|
||||
while (pos < input.length) {
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc < 0x80) {
|
||||
pos = CHAR_MAP[cc](input, pos, callbacks);
|
||||
} else {
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.eatComments = (input, pos) => {
|
||||
loop: for (;;) {
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === CC_SLASH) {
|
||||
if (pos === input.length) return pos;
|
||||
let cc = input.charCodeAt(pos + 1);
|
||||
if (cc !== CC_ASTERISK) return pos;
|
||||
pos++;
|
||||
for (;;) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
while (cc === CC_ASTERISK) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
if (cc === CC_SLASH) {
|
||||
pos++;
|
||||
continue loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.eatWhitespaceAndComments = (input, pos) => {
|
||||
loop: for (;;) {
|
||||
const cc = input.charCodeAt(pos);
|
||||
if (cc === CC_SLASH) {
|
||||
if (pos === input.length) return pos;
|
||||
let cc = input.charCodeAt(pos + 1);
|
||||
if (cc !== CC_ASTERISK) return pos;
|
||||
pos++;
|
||||
for (;;) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
while (cc === CC_ASTERISK) {
|
||||
pos++;
|
||||
if (pos === input.length) return pos;
|
||||
cc = input.charCodeAt(pos);
|
||||
if (cc === CC_SLASH) {
|
||||
pos++;
|
||||
continue loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (_isWhiteSpace(cc)) {
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Ivan Kopeykin @vankop
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
|
||||
class CssExportDependency extends NullDependency {
|
||||
/**
|
||||
* @param {string} name name
|
||||
* @param {string} value value
|
||||
*/
|
||||
constructor(name, value) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "css :export";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exported names
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @returns {ExportsSpec | undefined} export names
|
||||
*/
|
||||
getExports(moduleGraph) {
|
||||
const name = this.name;
|
||||
return {
|
||||
exports: [
|
||||
{
|
||||
name,
|
||||
canMangle: true
|
||||
}
|
||||
],
|
||||
dependencies: undefined
|
||||
};
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const { write } = context;
|
||||
write(this.name);
|
||||
write(this.value);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
const { read } = context;
|
||||
this.name = read();
|
||||
this.value = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
CssExportDependency.Template = class CssExportDependencyTemplate extends (
|
||||
NullDependency.Template
|
||||
) {
|
||||
/**
|
||||
* @param {Dependency} dependency the dependency for which the template should be applied
|
||||
* @param {ReplaceSource} source the current replace source which can be modified
|
||||
* @param {DependencyTemplateContext} templateContext the context object
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(dependency, source, { cssExports }) {
|
||||
const dep = /** @type {CssExportDependency} */ (dependency);
|
||||
cssExports.set(dep.name, dep.value);
|
||||
}
|
||||
};
|
||||
|
||||
makeSerializable(
|
||||
CssExportDependency,
|
||||
"webpack/lib/dependencies/CssExportDependency"
|
||||
);
|
||||
|
||||
module.exports = CssExportDependency;
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Ivan Kopeykin @vankop
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
class CssImportDependency extends ModuleDependency {
|
||||
/**
|
||||
* @param {string} request request
|
||||
* @param {[number, number]} range range of the argument
|
||||
* @param {string | undefined} supports list of supports conditions
|
||||
* @param {string | undefined} media list of media conditions
|
||||
*/
|
||||
constructor(request, range, supports, media) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
this.supports = supports;
|
||||
this.media = media;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "css @import";
|
||||
}
|
||||
|
||||
get category() {
|
||||
return "css-import";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} context context directory
|
||||
* @returns {Module} a module
|
||||
*/
|
||||
createIgnoredModule(context) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
CssImportDependency.Template = class CssImportDependencyTemplate extends (
|
||||
ModuleDependency.Template
|
||||
) {
|
||||
/**
|
||||
* @param {Dependency} dependency the dependency for which the template should be applied
|
||||
* @param {ReplaceSource} source the current replace source which can be modified
|
||||
* @param {DependencyTemplateContext} templateContext the context object
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(dependency, source, templateContext) {
|
||||
const dep = /** @type {CssImportDependency} */ (dependency);
|
||||
|
||||
source.replace(dep.range[0], dep.range[1] - 1, "");
|
||||
}
|
||||
};
|
||||
|
||||
makeSerializable(
|
||||
CssImportDependency,
|
||||
"webpack/lib/dependencies/CssImportDependency"
|
||||
);
|
||||
|
||||
module.exports = CssImportDependency;
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Ivan Kopeykin @vankop
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const NullDependency = require("./NullDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
|
||||
class CssLocalIdentifierDependency extends NullDependency {
|
||||
/**
|
||||
* @param {string} name name
|
||||
* @param {[number, number]} range range
|
||||
* @param {string=} prefix prefix
|
||||
*/
|
||||
constructor(name, range, prefix = "") {
|
||||
super();
|
||||
this.name = name;
|
||||
this.range = range;
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "css local identifier";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exported names
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @returns {ExportsSpec | undefined} export names
|
||||
*/
|
||||
getExports(moduleGraph) {
|
||||
const name = this.name;
|
||||
return {
|
||||
exports: [
|
||||
{
|
||||
name,
|
||||
canMangle: true
|
||||
}
|
||||
],
|
||||
dependencies: undefined
|
||||
};
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const { write } = context;
|
||||
write(this.name);
|
||||
write(this.range);
|
||||
write(this.prefix);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
const { read } = context;
|
||||
this.name = read();
|
||||
this.range = read();
|
||||
this.prefix = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
const escapeCssIdentifier = (str, omitUnderscore) => {
|
||||
const escaped = `${str}`.replace(
|
||||
// cspell:word uffff
|
||||
/[^a-zA-Z0-9_\u0081-\uffff-]/g,
|
||||
s => `\\${s}`
|
||||
);
|
||||
return !omitUnderscore && /^(?!--)[0-9-]/.test(escaped)
|
||||
? `_${escaped}`
|
||||
: escaped;
|
||||
};
|
||||
|
||||
CssLocalIdentifierDependency.Template = class CssLocalIdentifierDependencyTemplate extends (
|
||||
NullDependency.Template
|
||||
) {
|
||||
/**
|
||||
* @param {Dependency} dependency the dependency for which the template should be applied
|
||||
* @param {ReplaceSource} source the current replace source which can be modified
|
||||
* @param {DependencyTemplateContext} templateContext the context object
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(
|
||||
dependency,
|
||||
source,
|
||||
{ module, moduleGraph, chunkGraph, runtime, runtimeTemplate, cssExports }
|
||||
) {
|
||||
const dep = /** @type {CssLocalIdentifierDependency} */ (dependency);
|
||||
const used = moduleGraph
|
||||
.getExportInfo(module, dep.name)
|
||||
.getUsedName(dep.name, runtime);
|
||||
const moduleId = chunkGraph.getModuleId(module);
|
||||
const identifier =
|
||||
dep.prefix +
|
||||
(runtimeTemplate.outputOptions.uniqueName
|
||||
? runtimeTemplate.outputOptions.uniqueName + "-"
|
||||
: "") +
|
||||
(used ? moduleId + "-" + used : "-");
|
||||
source.replace(
|
||||
dep.range[0],
|
||||
dep.range[1] - 1,
|
||||
escapeCssIdentifier(identifier, dep.prefix)
|
||||
);
|
||||
if (used) cssExports.set(used, identifier);
|
||||
}
|
||||
};
|
||||
|
||||
makeSerializable(
|
||||
CssLocalIdentifierDependency,
|
||||
"webpack/lib/dependencies/CssLocalIdentifierDependency"
|
||||
);
|
||||
|
||||
module.exports = CssLocalIdentifierDependency;
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Ivan Kopeykin @vankop
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const Dependency = require("../Dependency");
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const CssLocalIdentifierDependency = require("./CssLocalIdentifierDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
|
||||
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
||||
/** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency {
|
||||
/**
|
||||
* @param {string} name name
|
||||
* @param {[number, number]} range range
|
||||
* @param {string=} prefix prefix
|
||||
* @param {Set<string>=} declaredSet set of declared names (will only be active when in declared set)
|
||||
*/
|
||||
constructor(name, range, prefix = "", declaredSet = undefined) {
|
||||
super(name, range, prefix);
|
||||
this.declaredSet = declaredSet;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "css self local identifier";
|
||||
}
|
||||
|
||||
get category() {
|
||||
return "self";
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string | null} an identifier to merge equal requests
|
||||
*/
|
||||
getResourceIdentifier() {
|
||||
return `self`;
|
||||
}
|
||||
/**
|
||||
* Returns the exported names
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @returns {ExportsSpec | undefined} export names
|
||||
*/
|
||||
getExports(moduleGraph) {
|
||||
if (this.declaredSet && !this.declaredSet.has(this.name)) return;
|
||||
return super.getExports(moduleGraph);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of exports referenced by this dependency
|
||||
* @param {ModuleGraph} moduleGraph module graph
|
||||
* @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
||||
* @returns {(string[] | ReferencedExport)[]} referenced exports
|
||||
*/
|
||||
getReferencedExports(moduleGraph, runtime) {
|
||||
if (this.declaredSet && !this.declaredSet.has(this.name))
|
||||
return Dependency.NO_EXPORTS_REFERENCED;
|
||||
return [[this.name]];
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const { write } = context;
|
||||
write(this.declaredSet);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
const { read } = context;
|
||||
this.declaredSet = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
CssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependencyTemplate extends (
|
||||
CssLocalIdentifierDependency.Template
|
||||
) {
|
||||
/**
|
||||
* @param {Dependency} dependency the dependency for which the template should be applied
|
||||
* @param {ReplaceSource} source the current replace source which can be modified
|
||||
* @param {DependencyTemplateContext} templateContext the context object
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(dependency, source, templateContext) {
|
||||
const dep = /** @type {CssSelfLocalIdentifierDependency} */ (dependency);
|
||||
if (dep.declaredSet && !dep.declaredSet.has(dep.name)) return;
|
||||
super.apply(dependency, source, templateContext);
|
||||
}
|
||||
};
|
||||
|
||||
makeSerializable(
|
||||
CssSelfLocalIdentifierDependency,
|
||||
"webpack/lib/dependencies/CssSelfLocalIdentifierDependency"
|
||||
);
|
||||
|
||||
module.exports = CssSelfLocalIdentifierDependency;
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Ivan Kopeykin @vankop
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const makeSerializable = require("../util/makeSerializable");
|
||||
const memoize = require("../util/memoize");
|
||||
const ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
||||
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
const getRawDataUrlModule = memoize(() => require("../asset/RawDataUrlModule"));
|
||||
|
||||
class CssUrlDependency extends ModuleDependency {
|
||||
/**
|
||||
* @param {string} request request
|
||||
* @param {[number, number]} range range of the argument
|
||||
* @param {string} cssFunctionKind kind of css function, e. g. url(), image()
|
||||
*/
|
||||
constructor(request, range, cssFunctionKind) {
|
||||
super(request);
|
||||
this.range = range;
|
||||
this.cssFunctionKind = cssFunctionKind;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return "css url()";
|
||||
}
|
||||
|
||||
get category() {
|
||||
return "url";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} context context directory
|
||||
* @returns {Module} a module
|
||||
*/
|
||||
createIgnoredModule(context) {
|
||||
const RawDataUrlModule = getRawDataUrlModule();
|
||||
return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`);
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
const { write } = context;
|
||||
write(this.cssFunctionKind);
|
||||
super.serialize(context);
|
||||
}
|
||||
|
||||
deserialize(context) {
|
||||
const { read } = context;
|
||||
this.cssFunctionKind = read();
|
||||
super.deserialize(context);
|
||||
}
|
||||
}
|
||||
|
||||
const cssEscapeString = str => {
|
||||
let countWhiteOrBracket = 0;
|
||||
let countQuotation = 0;
|
||||
let countApostrophe = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const cc = str.charCodeAt(i);
|
||||
switch (cc) {
|
||||
case 9: // tab
|
||||
case 10: // nl
|
||||
case 32: // space
|
||||
case 40: // (
|
||||
case 41: // )
|
||||
countWhiteOrBracket++;
|
||||
break;
|
||||
case 34:
|
||||
countQuotation++;
|
||||
break;
|
||||
case 39:
|
||||
countApostrophe++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (countWhiteOrBracket < 2) {
|
||||
return str.replace(/[\n\t ()'"\\]/g, m => `\\${m}`);
|
||||
} else if (countQuotation <= countApostrophe) {
|
||||
return `"${str.replace(/[\n"\\]/g, m => `\\${m}`)}"`;
|
||||
} else {
|
||||
return `'${str.replace(/[\n'\\]/g, m => `\\${m}`)}'`;
|
||||
}
|
||||
};
|
||||
|
||||
CssUrlDependency.Template = class CssUrlDependencyTemplate extends (
|
||||
ModuleDependency.Template
|
||||
) {
|
||||
/**
|
||||
* @param {Dependency} dependency the dependency for which the template should be applied
|
||||
* @param {ReplaceSource} source the current replace source which can be modified
|
||||
* @param {DependencyTemplateContext} templateContext the context object
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(
|
||||
dependency,
|
||||
source,
|
||||
{ runtime, moduleGraph, runtimeTemplate, codeGenerationResults }
|
||||
) {
|
||||
const dep = /** @type {CssUrlDependency} */ (dependency);
|
||||
|
||||
source.replace(
|
||||
dep.range[0],
|
||||
dep.range[1] - 1,
|
||||
`${dep.cssFunctionKind}(${cssEscapeString(
|
||||
runtimeTemplate.assetUrl({
|
||||
publicPath: "",
|
||||
runtime,
|
||||
module: moduleGraph.getModule(dep),
|
||||
codeGenerationResults
|
||||
})
|
||||
)})`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
makeSerializable(CssUrlDependency, "webpack/lib/dependencies/CssUrlDependency");
|
||||
|
||||
module.exports = CssUrlDependency;
|
|
@ -25,7 +25,7 @@ const ModuleDependency = require("./ModuleDependency");
|
|||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
const getRawModule = memoize(() => require("../RawModule"));
|
||||
const getRawDataUrlModule = memoize(() => require("../asset/RawDataUrlModule"));
|
||||
|
||||
class URLDependency extends ModuleDependency {
|
||||
/**
|
||||
|
@ -68,13 +68,8 @@ class URLDependency extends ModuleDependency {
|
|||
* @returns {Module} a module
|
||||
*/
|
||||
createIgnoredModule(context) {
|
||||
const RawModule = getRawModule();
|
||||
return new RawModule(
|
||||
'module.exports = "data:,";',
|
||||
`ignored-asset`,
|
||||
`(ignored asset)`,
|
||||
new Set([RuntimeGlobals.module])
|
||||
);
|
||||
const RawDataUrlModule = getRawDataUrlModule();
|
||||
return new RawDataUrlModule("data:,", `ignored-asset`, `(ignored asset)`);
|
||||
}
|
||||
|
||||
serialize(context) {
|
||||
|
|
|
@ -81,7 +81,7 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
);
|
||||
const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs);
|
||||
const hasJsMatcher = compileBooleanMatcher(conditionMap);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs);
|
||||
|
||||
const outputName = this.compilation.getPath(
|
||||
getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
|
||||
|
|
|
@ -68,7 +68,9 @@ module.exports = options => (compiler, callback) => {
|
|||
req.socket.setNoDelay(true);
|
||||
res.writeHead(200, {
|
||||
"content-type": "text/event-stream",
|
||||
"Access-Control-Allow-Origin": "*"
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Methods": "*",
|
||||
"Access-Control-Allow-Headers": "*"
|
||||
});
|
||||
res.write("\n");
|
||||
let moduleActivated = false;
|
||||
|
|
|
@ -199,6 +199,7 @@ class JavascriptGenerator extends Generator {
|
|||
runtime: generateContext.runtime,
|
||||
runtimeRequirements: generateContext.runtimeRequirements,
|
||||
concatenationScope: generateContext.concatenationScope,
|
||||
codeGenerationResults: generateContext.codeGenerationResults,
|
||||
initFragments
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ const RuntimeGlobals = require("../RuntimeGlobals");
|
|||
const Template = require("../Template");
|
||||
const { isSubset } = require("../util/SetHelpers");
|
||||
const { getAllChunks } = require("./ChunkHelpers");
|
||||
const { chunkHasJs } = require("./JavascriptModulesPlugin");
|
||||
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
|
@ -119,12 +118,13 @@ exports.updateHashForEntryStartup = (hash, chunkGraph, entries, chunk) => {
|
|||
/**
|
||||
* @param {Chunk} chunk the chunk
|
||||
* @param {ChunkGraph} chunkGraph the chunk graph
|
||||
* @param {function(Chunk, ChunkGraph): boolean} filterFn filter function
|
||||
* @returns {Set<number | string>} initially fulfilled chunk ids
|
||||
*/
|
||||
exports.getInitialChunkIds = (chunk, chunkGraph) => {
|
||||
exports.getInitialChunkIds = (chunk, chunkGraph, filterFn) => {
|
||||
const initialChunkIds = new Set(chunk.ids);
|
||||
for (const c of chunk.getAllInitialChunks()) {
|
||||
if (c === chunk || chunkHasJs(c, chunkGraph)) continue;
|
||||
if (c === chunk || filterFn(c, chunkGraph)) continue;
|
||||
for (const id of c.ids) initialChunkIds.add(id);
|
||||
}
|
||||
return initialChunkIds;
|
||||
|
|
|
@ -46,7 +46,7 @@ class ReadFileChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
);
|
||||
const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs);
|
||||
const hasJsMatcher = compileBooleanMatcher(conditionMap);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs);
|
||||
|
||||
const outputName = this.compilation.getPath(
|
||||
getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
|
||||
|
|
|
@ -46,7 +46,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
);
|
||||
const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs);
|
||||
const hasJsMatcher = compileBooleanMatcher(conditionMap);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs);
|
||||
|
||||
const outputName = this.compilation.getPath(
|
||||
getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
|
||||
|
|
|
@ -39,6 +39,7 @@ const {
|
|||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
|
||||
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
||||
/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */
|
||||
/** @typedef {import("../Compilation")} Compilation */
|
||||
/** @typedef {import("../Dependency")} Dependency */
|
||||
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
|
||||
|
@ -1077,7 +1078,8 @@ class ConcatenatedModule extends Module {
|
|||
runtimeTemplate,
|
||||
moduleGraph,
|
||||
chunkGraph,
|
||||
runtime: generationRuntime
|
||||
runtime: generationRuntime,
|
||||
codeGenerationResults
|
||||
}) {
|
||||
/** @type {Set<string>} */
|
||||
const runtimeRequirements = new Set();
|
||||
|
@ -1104,7 +1106,8 @@ class ConcatenatedModule extends Module {
|
|||
runtimeTemplate,
|
||||
moduleGraph,
|
||||
chunkGraph,
|
||||
runtime
|
||||
runtime,
|
||||
codeGenerationResults
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1634,6 +1637,7 @@ ${defineGetters}`
|
|||
* @param {ModuleGraph} moduleGraph moduleGraph
|
||||
* @param {ChunkGraph} chunkGraph chunkGraph
|
||||
* @param {RuntimeSpec} runtime runtime
|
||||
* @param {CodeGenerationResults} codeGenerationResults codeGenerationResults
|
||||
*/
|
||||
_analyseModule(
|
||||
modulesMap,
|
||||
|
@ -1642,7 +1646,8 @@ ${defineGetters}`
|
|||
runtimeTemplate,
|
||||
moduleGraph,
|
||||
chunkGraph,
|
||||
runtime
|
||||
runtime,
|
||||
codeGenerationResults
|
||||
) {
|
||||
if (info.type === "concatenated") {
|
||||
const m = info.module;
|
||||
|
@ -1657,7 +1662,8 @@ ${defineGetters}`
|
|||
moduleGraph,
|
||||
chunkGraph,
|
||||
runtime,
|
||||
concatenationScope
|
||||
concatenationScope,
|
||||
codeGenerationResults
|
||||
});
|
||||
const source = codeGenResult.sources.get("javascript");
|
||||
const data = codeGenResult.data;
|
||||
|
|
|
@ -10,8 +10,8 @@ const create = require("./wasm-hash");
|
|||
//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1
|
||||
const xxhash64 = new WebAssembly.Module(
|
||||
Buffer.from(
|
||||
// 1173 bytes
|
||||
"AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrUIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqwYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEACfyACIAE1AgBCh5Wvr5i23puef36FQheJQs/W077Sx6vZQn5C+fPd8Zn2masWfCECIAFBBGoLIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL",
|
||||
// 1170 bytes
|
||||
"AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL",
|
||||
"base64"
|
||||
)
|
||||
);
|
||||
|
|
|
@ -67,6 +67,16 @@ module.exports = {
|
|||
require("../dependencies/ContextElementDependency"),
|
||||
"dependencies/CriticalDependencyWarning": () =>
|
||||
require("../dependencies/CriticalDependencyWarning"),
|
||||
"dependencies/CssImportDependency": () =>
|
||||
require("../dependencies/CssImportDependency"),
|
||||
"dependencies/CssLocalIdentifierDependency": () =>
|
||||
require("../dependencies/CssLocalIdentifierDependency"),
|
||||
"dependencies/CssSelfLocalIdentifierDependency": () =>
|
||||
require("../dependencies/CssSelfLocalIdentifierDependency"),
|
||||
"dependencies/CssExportDependency": () =>
|
||||
require("../dependencies/CssExportDependency"),
|
||||
"dependencies/CssUrlDependency": () =>
|
||||
require("../dependencies/CssUrlDependency"),
|
||||
"dependencies/DelegatedSourceDependency": () =>
|
||||
require("../dependencies/DelegatedSourceDependency"),
|
||||
"dependencies/DllEntryDependency": () =>
|
||||
|
@ -175,6 +185,7 @@ module.exports = {
|
|||
ModuleParseError: () => require("../ModuleParseError"),
|
||||
ModuleWarning: () => require("../ModuleWarning"),
|
||||
NormalModule: () => require("../NormalModule"),
|
||||
RawDataUrlModule: () => require("../asset/RawDataUrlModule"),
|
||||
RawModule: () => require("../RawModule"),
|
||||
"sharing/ConsumeSharedModule": () =>
|
||||
require("../sharing/ConsumeSharedModule"),
|
||||
|
|
|
@ -96,7 +96,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
)}]`;
|
||||
const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs);
|
||||
const hasJsMatcher = compileBooleanMatcher(conditionMap);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs);
|
||||
|
||||
const stateExpression = withHmr
|
||||
? `${RuntimeGlobals.hmrRuntimeStatePrefix}_jsonp`
|
||||
|
@ -419,7 +419,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
`if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`,
|
||||
Template.indent("installedChunks[chunkId][0]();"),
|
||||
"}",
|
||||
"installedChunks[chunkIds[i]] = 0;"
|
||||
"installedChunks[chunkId] = 0;"
|
||||
]),
|
||||
"}",
|
||||
withOnChunkLoad
|
||||
|
|
|
@ -53,7 +53,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|||
const hasJsMatcher = compileBooleanMatcher(
|
||||
chunkGraph.getChunkConditionMap(chunk, chunkHasJs)
|
||||
);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph);
|
||||
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs);
|
||||
|
||||
const outputName = this.compilation.getPath(
|
||||
getChunkFilenameTemplate(chunk, this.compilation.outputOptions),
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"eslint-scope": "5.1.1",
|
||||
"events": "^3.2.0",
|
||||
"glob-to-regexp": "^0.4.1",
|
||||
"graceful-fs": "^4.2.4",
|
||||
"graceful-fs": "^4.2.9",
|
||||
"json-parse-better-errors": "^1.0.2",
|
||||
"loader-runner": "^4.2.0",
|
||||
"mime-types": "^2.1.27",
|
||||
|
@ -246,4 +246,4 @@
|
|||
"json"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -335,6 +335,34 @@
|
|||
"description": "This option enables cross-origin loading of chunks.",
|
||||
"enum": [false, "anonymous", "use-credentials"]
|
||||
},
|
||||
"CssChunkFilename": {
|
||||
"description": "Specifies the filename template of non-initial output css 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.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/FilenameTemplate"
|
||||
}
|
||||
]
|
||||
},
|
||||
"CssFilename": {
|
||||
"description": "Specifies the filename template of output css 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.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/FilenameTemplate"
|
||||
}
|
||||
]
|
||||
},
|
||||
"CssGeneratorOptions": {
|
||||
"description": "Generator options for css modules.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {}
|
||||
},
|
||||
"CssParserOptions": {
|
||||
"description": "Parser options for css modules.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {}
|
||||
},
|
||||
"Dependencies": {
|
||||
"description": "References to other configurations to depend on.",
|
||||
"type": "array",
|
||||
|
@ -720,6 +748,10 @@
|
|||
"description": "Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"css": {
|
||||
"description": "Enable css support.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"futureDefaults": {
|
||||
"description": "Apply defaults of next major version.",
|
||||
"type": "boolean"
|
||||
|
@ -770,6 +802,10 @@
|
|||
"description": "Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"css": {
|
||||
"description": "Enable css support.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"futureDefaults": {
|
||||
"description": "Apply defaults of next major version.",
|
||||
"type": "boolean"
|
||||
|
@ -818,6 +854,10 @@
|
|||
"description": "Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"css": {
|
||||
"description": "Enable css support.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"futureDefaults": {
|
||||
"description": "Apply defaults of next major version.",
|
||||
"type": "boolean"
|
||||
|
@ -2950,6 +2990,12 @@
|
|||
"crossOriginLoading": {
|
||||
"$ref": "#/definitions/CrossOriginLoading"
|
||||
},
|
||||
"cssChunkFilename": {
|
||||
"$ref": "#/definitions/CssChunkFilename"
|
||||
},
|
||||
"cssFilename": {
|
||||
"$ref": "#/definitions/CssFilename"
|
||||
},
|
||||
"devtoolFallbackModuleFilenameTemplate": {
|
||||
"$ref": "#/definitions/DevtoolFallbackModuleFilenameTemplate"
|
||||
},
|
||||
|
@ -3143,6 +3189,12 @@
|
|||
"crossOriginLoading": {
|
||||
"$ref": "#/definitions/CrossOriginLoading"
|
||||
},
|
||||
"cssChunkFilename": {
|
||||
"$ref": "#/definitions/CssChunkFilename"
|
||||
},
|
||||
"cssFilename": {
|
||||
"$ref": "#/definitions/CssFilename"
|
||||
},
|
||||
"devtoolFallbackModuleFilenameTemplate": {
|
||||
"$ref": "#/definitions/DevtoolFallbackModuleFilenameTemplate"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
declare const check: (options: any) => boolean;
|
||||
export = check;
|
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
"use strict";function r(t,{instancePath:e="",parentData:a,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;for(const e in t)return r.errors=[{params:{additionalProperty:e}}],!1;return r.errors=null,!0}module.exports=r,module.exports.default=r;
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"$ref": "../../WebpackOptions.json#/definitions/CssParserOptions"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
declare const check: (options: any) => boolean;
|
||||
export = check;
|
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
"use strict";function r(t,{instancePath:e="",parentData:a,parentDataProperty:o,rootData:n=t}={}){if(!t||"object"!=typeof t||Array.isArray(t))return r.errors=[{params:{type:"object"}}],!1;for(const e in t)return r.errors=[{params:{additionalProperty:e}}],!1;return r.errors=null,!0}module.exports=r,module.exports.default=r;
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"$ref": "../../WebpackOptions.json#/definitions/CssGeneratorOptions"
|
||||
}
|
|
@ -309,13 +309,15 @@ const describeCases = config => {
|
|||
const bundlePath = testConfig.findBundle(i, optionsArr[i]);
|
||||
if (bundlePath) {
|
||||
filesCount++;
|
||||
const document = new FakeDocument();
|
||||
const document = new FakeDocument(outputDirectory);
|
||||
const globalContext = {
|
||||
console: console,
|
||||
expect: expect,
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
document,
|
||||
getComputedStyle:
|
||||
document.getComputedStyle.bind(document),
|
||||
location: {
|
||||
href: "https://test.cases/path/index.html",
|
||||
origin: "https://test.cases",
|
||||
|
|
|
@ -95,6 +95,7 @@ describe("Defaults", () => {
|
|||
"backCompat": true,
|
||||
"buildHttp": undefined,
|
||||
"cacheUnaffected": false,
|
||||
"css": false,
|
||||
"futureDefaults": false,
|
||||
"layers": false,
|
||||
"lazyCompilation": undefined,
|
||||
|
@ -306,6 +307,8 @@ describe("Defaults", () => {
|
|||
"clean": undefined,
|
||||
"compareBeforeEmit": true,
|
||||
"crossOriginLoading": false,
|
||||
"cssChunkFilename": "[name].css",
|
||||
"cssFilename": "[name].css",
|
||||
"devtoolFallbackModuleFilenameTemplate": undefined,
|
||||
"devtoolModuleFilenameTemplate": undefined,
|
||||
"devtoolNamespace": "webpack",
|
||||
|
@ -987,6 +990,11 @@ describe("Defaults", () => {
|
|||
- "chunkFilename": "[name].js",
|
||||
+ "chunkFilename": "[id].bundle.js",
|
||||
@@ ... @@
|
||||
- "cssChunkFilename": "[name].css",
|
||||
- "cssFilename": "[name].css",
|
||||
+ "cssChunkFilename": "[id].bundle.css",
|
||||
+ "cssFilename": "bundle.css",
|
||||
@@ ... @@
|
||||
- "filename": "[name].js",
|
||||
+ "filename": "bundle.js",
|
||||
`)
|
||||
|
@ -1000,6 +1008,11 @@ describe("Defaults", () => {
|
|||
- "chunkFilename": "[name].js",
|
||||
+ "chunkFilename": "[id].js",
|
||||
@@ ... @@
|
||||
- "cssChunkFilename": "[name].css",
|
||||
- "cssFilename": "[name].css",
|
||||
+ "cssChunkFilename": "[id].css",
|
||||
+ "cssFilename": "[id].css",
|
||||
@@ ... @@
|
||||
- "filename": "[name].js",
|
||||
+ "filename": [Function filename],
|
||||
`)
|
||||
|
@ -1903,16 +1916,19 @@ describe("Defaults", () => {
|
|||
+ "backCompat": false,
|
||||
@@ ... @@
|
||||
- "cacheUnaffected": false,
|
||||
- "css": false,
|
||||
- "futureDefaults": false,
|
||||
+ "cacheUnaffected": true,
|
||||
+ "css": true,
|
||||
+ "futureDefaults": true,
|
||||
@@ ... @@
|
||||
- "topLevelAwait": false,
|
||||
+ "topLevelAwait": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ Object {
|
||||
+ "rules": Array [
|
||||
@@ ... @@
|
||||
+ Object {
|
||||
+ "descriptionData": Object {
|
||||
+ "type": "module",
|
||||
+ },
|
||||
|
@ -1939,6 +1955,39 @@ describe("Defaults", () => {
|
|||
+ "type": "webassembly/async",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "oneOf": Array [
|
||||
+ Object {
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ "test": /\\.module\\.css$/i,
|
||||
+ "type": "css/module",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ "preferRelative": true,
|
||||
+ },
|
||||
+ "type": "css",
|
||||
+ },
|
||||
+ ],
|
||||
+ "test": /\\.css$/i,
|
||||
+ },
|
||||
+ Object {
|
||||
+ "mimetype": "text/css+module",
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ "type": "css/module",
|
||||
@@ ... @@
|
||||
+ "mimetype": "text/css",
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ "preferRelative": true,
|
||||
+ },
|
||||
+ "type": "css",
|
||||
+ },
|
||||
+ Object {
|
||||
@@ ... @@
|
||||
+ "exportsPresence": "error",
|
||||
@@ ... @@
|
||||
|
@ -1949,6 +1998,8 @@ describe("Defaults", () => {
|
|||
+ "__filename": "warn-mock",
|
||||
+ "global": "warn",
|
||||
@@ ... @@
|
||||
+ "css",
|
||||
@@ ... @@
|
||||
- "hashDigestLength": 20,
|
||||
- "hashFunction": "md4",
|
||||
+ "hashDigestLength": 16,
|
||||
|
|
|
@ -175,10 +175,10 @@ describe("Stats", () => {
|
|||
"assets": Array [
|
||||
Object {
|
||||
"name": "entryB.js",
|
||||
"size": 2964,
|
||||
"size": 2961,
|
||||
},
|
||||
],
|
||||
"assetsSize": 2964,
|
||||
"assetsSize": 2961,
|
||||
"auxiliaryAssets": undefined,
|
||||
"auxiliaryAssetsSize": 0,
|
||||
"childAssets": undefined,
|
||||
|
@ -223,10 +223,10 @@ describe("Stats", () => {
|
|||
"info": Object {
|
||||
"javascriptModule": false,
|
||||
"minimized": true,
|
||||
"size": 2964,
|
||||
"size": 2961,
|
||||
},
|
||||
"name": "entryB.js",
|
||||
"size": 2964,
|
||||
"size": 2961,
|
||||
"type": "asset",
|
||||
},
|
||||
Object {
|
||||
|
|
|
@ -497,7 +497,7 @@ describe("Validation", () => {
|
|||
expect(msg).toMatchInlineSnapshot(`
|
||||
"Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
|
||||
- configuration.output has an unknown property 'ecmaVersion'. These properties are valid:
|
||||
object { assetModuleFilename?, asyncChunks?, auxiliaryComment?, charset?, chunkFilename?, chunkFormat?, chunkLoadTimeout?, chunkLoading?, chunkLoadingGlobal?, clean?, compareBeforeEmit?, crossOriginLoading?, devtoolFallbackModuleFilenameTemplate?, devtoolModuleFilenameTemplate?, devtoolNamespace?, enabledChunkLoadingTypes?, enabledLibraryTypes?, enabledWasmLoadingTypes?, environment?, filename?, globalObject?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateGlobal?, hotUpdateMainFilename?, iife?, importFunctionName?, importMetaName?, library?, libraryExport?, libraryTarget?, module?, path?, pathinfo?, publicPath?, scriptType?, sourceMapFilename?, sourcePrefix?, strictModuleErrorHandling?, strictModuleExceptionHandling?, trustedTypes?, umdNamedDefine?, uniqueName?, wasmLoading?, webassemblyModuleFilename?, workerChunkLoading?, workerWasmLoading? }
|
||||
object { assetModuleFilename?, asyncChunks?, auxiliaryComment?, charset?, chunkFilename?, chunkFormat?, chunkLoadTimeout?, chunkLoading?, chunkLoadingGlobal?, clean?, compareBeforeEmit?, crossOriginLoading?, cssChunkFilename?, cssFilename?, devtoolFallbackModuleFilenameTemplate?, devtoolModuleFilenameTemplate?, devtoolNamespace?, enabledChunkLoadingTypes?, enabledLibraryTypes?, enabledWasmLoadingTypes?, environment?, filename?, globalObject?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateGlobal?, hotUpdateMainFilename?, iife?, importFunctionName?, importMetaName?, library?, libraryExport?, libraryTarget?, module?, path?, pathinfo?, publicPath?, scriptType?, sourceMapFilename?, sourcePrefix?, strictModuleErrorHandling?, strictModuleExceptionHandling?, trustedTypes?, umdNamedDefine?, uniqueName?, wasmLoading?, webassemblyModuleFilename?, workerChunkLoading?, workerWasmLoading? }
|
||||
-> Options affecting the output of the compilation. \`output\` options tell webpack how to write the compiled files to disk.
|
||||
Did you mean output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)?"
|
||||
`)
|
||||
|
|
|
@ -594,6 +594,19 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"experiments-css": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Enable css support.",
|
||||
"multiple": false,
|
||||
"path": "experiments.css",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "Enable css support.",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"experiments-future-defaults": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
@ -5175,6 +5188,32 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"output-css-chunk-filename": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "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.",
|
||||
"multiple": false,
|
||||
"path": "output.cssChunkFilename",
|
||||
"type": "string",
|
||||
},
|
||||
],
|
||||
"description": "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.",
|
||||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"output-css-filename": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "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.",
|
||||
"multiple": false,
|
||||
"path": "output.cssFilename",
|
||||
"type": "string",
|
||||
},
|
||||
],
|
||||
"description": "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.",
|
||||
"multiple": false,
|
||||
"simpleType": "string",
|
||||
},
|
||||
"output-devtool-fallback-module-filename-template": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ConfigCacheTestCases css urls exported tests should be able to handle styles in spacing.css 1`] = `
|
||||
Object {
|
||||
"a": " url(img.09a1a1112c577c279435.png)",
|
||||
"b": " url(img.09a1a1112c577c279435.png)",
|
||||
"c": " url(img.09a1a1112c577c279435.png)",
|
||||
"d": " url(img.09a1a1112c577c279435.png#hash)",
|
||||
"e": " url(img.09a1a1112c577c279435.png)",
|
||||
"f": " green url(img.09a1a1112c577c279435.png) xyz",
|
||||
"g": " green url(img.09a1a1112c577c279435.png) xyz",
|
||||
"getPropertyValue": [Function],
|
||||
"h": " green url(img.09a1a1112c577c279435.png) xyz",
|
||||
"i": " green url(img.09a1a1112c577c279435.png) url(img.09a1a1112c577c279435.png) xyz",
|
||||
"j": " green url(img\\\\ img.09a1a1112c577c279435.png) xyz",
|
||||
"k": " green url(img\\\\ img.09a1a1112c577c279435.png) xyz",
|
||||
"l": " green url(img.09a1a1112c577c279435.png) xyz",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`ConfigCacheTestCases custom-modules json-custom exported tests should transform toml to json 1`] = `
|
||||
Object {
|
||||
"owner": Object {
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ConfigTestCases css urls exported tests should be able to handle styles in spacing.css 1`] = `
|
||||
Object {
|
||||
"a": " url(img.09a1a1112c577c279435.png)",
|
||||
"b": " url(img.09a1a1112c577c279435.png)",
|
||||
"c": " url(img.09a1a1112c577c279435.png)",
|
||||
"d": " url(img.09a1a1112c577c279435.png#hash)",
|
||||
"e": " url(img.09a1a1112c577c279435.png)",
|
||||
"f": " green url(img.09a1a1112c577c279435.png) xyz",
|
||||
"g": " green url(img.09a1a1112c577c279435.png) xyz",
|
||||
"getPropertyValue": [Function],
|
||||
"h": " green url(img.09a1a1112c577c279435.png) xyz",
|
||||
"i": " green url(img.09a1a1112c577c279435.png) url(img.09a1a1112c577c279435.png) xyz",
|
||||
"j": " green url(img\\\\ img.09a1a1112c577c279435.png) xyz",
|
||||
"k": " green url(img\\\\ img.09a1a1112c577c279435.png) xyz",
|
||||
"l": " green url(img.09a1a1112c577c279435.png) xyz",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`ConfigTestCases custom-modules json-custom exported tests should transform toml to json 1`] = `
|
||||
Object {
|
||||
"owner": Object {
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
exports[`StatsTestCases should print correct stats for aggressive-splitting-entry 1`] = `
|
||||
"fitting:
|
||||
PublicPath: auto
|
||||
asset fitting-0bc75dc7c25c03335e16.js 16.1 KiB [emitted] [immutable]
|
||||
asset fitting-b29b201896658775937e.js 16.1 KiB [emitted] [immutable]
|
||||
asset fitting-50595d23e8f97d7ccd2a.js 1.9 KiB [emitted] [immutable]
|
||||
asset fitting-5bc77880fdc9e2bf09ee.js 1.9 KiB [emitted] [immutable]
|
||||
asset fitting-72afdc913f6cf884b457.js 1.08 KiB [emitted] [immutable]
|
||||
Entrypoint main 19.9 KiB = fitting-50595d23e8f97d7ccd2a.js 1.9 KiB fitting-5bc77880fdc9e2bf09ee.js 1.9 KiB fitting-0bc75dc7c25c03335e16.js 16.1 KiB
|
||||
chunk (runtime: main) fitting-0bc75dc7c25c03335e16.js 1.87 KiB (javascript) 8.66 KiB (runtime) [entry] [rendered]
|
||||
Entrypoint main 19.9 KiB = fitting-50595d23e8f97d7ccd2a.js 1.9 KiB fitting-5bc77880fdc9e2bf09ee.js 1.9 KiB fitting-b29b201896658775937e.js 16.1 KiB
|
||||
chunk (runtime: main) fitting-b29b201896658775937e.js 1.87 KiB (javascript) 8.65 KiB (runtime) [entry] [rendered]
|
||||
> ./index main
|
||||
runtime modules 8.66 KiB 11 modules
|
||||
runtime modules 8.65 KiB 11 modules
|
||||
cacheable modules 1.87 KiB
|
||||
./e.js 899 bytes [dependent] [built] [code generated]
|
||||
./f.js 900 bytes [dependent] [built] [code generated]
|
||||
|
@ -30,12 +30,12 @@ exports[`StatsTestCases should print correct stats for aggressive-splitting-entr
|
|||
|
||||
content-change:
|
||||
PublicPath: auto
|
||||
asset content-change-f715770db123da1acd5e.js 16.1 KiB [emitted] [immutable]
|
||||
asset content-change-0f45784341116b92349f.js 16.1 KiB [emitted] [immutable]
|
||||
asset content-change-50595d23e8f97d7ccd2a.js 1.9 KiB [emitted] [immutable]
|
||||
asset content-change-5bc77880fdc9e2bf09ee.js 1.9 KiB [emitted] [immutable]
|
||||
asset content-change-72afdc913f6cf884b457.js 1.08 KiB [emitted] [immutable]
|
||||
Entrypoint main 19.9 KiB = content-change-50595d23e8f97d7ccd2a.js 1.9 KiB content-change-5bc77880fdc9e2bf09ee.js 1.9 KiB content-change-f715770db123da1acd5e.js 16.1 KiB
|
||||
chunk (runtime: main) content-change-f715770db123da1acd5e.js 1.87 KiB (javascript) 8.66 KiB (runtime) [entry] [rendered]
|
||||
Entrypoint main 19.9 KiB = content-change-50595d23e8f97d7ccd2a.js 1.9 KiB content-change-5bc77880fdc9e2bf09ee.js 1.9 KiB content-change-0f45784341116b92349f.js 16.1 KiB
|
||||
chunk (runtime: main) content-change-0f45784341116b92349f.js 1.87 KiB (javascript) 8.66 KiB (runtime) [entry] [rendered]
|
||||
> ./index main
|
||||
runtime modules 8.66 KiB 11 modules
|
||||
cacheable modules 1.87 KiB
|
||||
|
@ -58,7 +58,7 @@ content-change:
|
|||
|
||||
exports[`StatsTestCases should print correct stats for aggressive-splitting-on-demand 1`] = `
|
||||
"PublicPath: auto
|
||||
asset 0fee456e1dc719aa6022.js 11.6 KiB [emitted] [immutable] (name: main)
|
||||
asset 765acd6985b8297d8cb6.js 11.6 KiB [emitted] [immutable] (name: main)
|
||||
asset 3fc6535262efa7e4fa3b.js 1.91 KiB [emitted] [immutable]
|
||||
asset 56815935c535fbc0e462.js 1.91 KiB [emitted] [immutable]
|
||||
asset 2b8c8882bd4326b27013.js 1.9 KiB [emitted] [immutable]
|
||||
|
@ -70,14 +70,14 @@ asset f79c60cc3faba968a476.js 1.9 KiB [emitted] [immutable]
|
|||
asset 7294786e49319a98f5af.js 1010 bytes [emitted] [immutable]
|
||||
asset c5861419d7f3f6ea6c19.js 1010 bytes [emitted] [immutable]
|
||||
asset f897ac9956540163d002.js 1010 bytes [emitted] [immutable]
|
||||
Entrypoint main 11.6 KiB = 0fee456e1dc719aa6022.js
|
||||
Entrypoint main 11.6 KiB = 765acd6985b8297d8cb6.js
|
||||
chunk (runtime: main) 5bc77880fdc9e2bf09ee.js 1.76 KiB [rendered] [recorded] aggressive splitted
|
||||
> ./c ./d ./e ./index.js 3:0-30
|
||||
./c.js 899 bytes [built] [code generated]
|
||||
./d.js 899 bytes [built] [code generated]
|
||||
chunk (runtime: main) 0fee456e1dc719aa6022.js (main) 248 bytes (javascript) 6.32 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: main) 765acd6985b8297d8cb6.js (main) 248 bytes (javascript) 6.31 KiB (runtime) [entry] [rendered]
|
||||
> ./index main
|
||||
runtime modules 6.32 KiB 7 modules
|
||||
runtime modules 6.31 KiB 7 modules
|
||||
./index.js 248 bytes [built] [code generated]
|
||||
chunk (runtime: main) 3fc6535262efa7e4fa3b.js 1.76 KiB [rendered]
|
||||
> ./f ./g ./h ./i ./j ./k ./index.js 4:0-51
|
||||
|
@ -184,9 +184,9 @@ exports[`StatsTestCases should print correct stats for async-commons-chunk-auto
|
|||
dependent modules 60 bytes [dependent] 3 modules
|
||||
runtime modules 396 bytes 2 modules
|
||||
./c.js + 1 modules 136 bytes [built] [code generated]
|
||||
chunk (runtime: a) disabled/a.js (a) 245 bytes (javascript) 6.6 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: a) disabled/a.js (a) 245 bytes (javascript) 6.59 KiB (runtime) [entry] [rendered]
|
||||
> ./a a
|
||||
runtime modules 6.6 KiB 9 modules
|
||||
runtime modules 6.59 KiB 9 modules
|
||||
dependent modules 60 bytes [dependent] 3 modules
|
||||
./a.js + 1 modules 185 bytes [built] [code generated]
|
||||
chunk (runtime: main) disabled/async-a.js (async-a) 245 bytes [rendered]
|
||||
|
@ -254,11 +254,11 @@ default:
|
|||
vendors:
|
||||
Entrypoint main 11.1 KiB = vendors/main.js
|
||||
Entrypoint a 14.5 KiB = vendors/vendors.js 1.05 KiB vendors/a.js 13.4 KiB
|
||||
Entrypoint b 8.19 KiB = vendors/vendors.js 1.05 KiB vendors/b.js 7.14 KiB
|
||||
Entrypoint c 8.19 KiB = vendors/vendors.js 1.05 KiB vendors/c.js 7.14 KiB
|
||||
chunk (runtime: b) vendors/b.js (b) 156 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
Entrypoint b 8.18 KiB = vendors/vendors.js 1.05 KiB vendors/b.js 7.13 KiB
|
||||
Entrypoint c 8.18 KiB = vendors/vendors.js 1.05 KiB vendors/c.js 7.13 KiB
|
||||
chunk (runtime: b) vendors/b.js (b) 156 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
> ./b b
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
dependent modules 40 bytes [dependent] 2 modules
|
||||
./b.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, main) vendors/async-g.js (async-g) 65 bytes [rendered]
|
||||
|
@ -284,14 +284,14 @@ vendors:
|
|||
> ./c ./index.js 3:0-47
|
||||
dependent modules 80 bytes [dependent] 4 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: c) vendors/c.js (c) 156 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: c) vendors/c.js (c) 156 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
> ./c c
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
dependent modules 40 bytes [dependent] 2 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a) vendors/a.js (a) 205 bytes (javascript) 7.54 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: a) vendors/a.js (a) 205 bytes (javascript) 7.53 KiB (runtime) [entry] [rendered]
|
||||
> ./a a
|
||||
runtime modules 7.54 KiB 10 modules
|
||||
runtime modules 7.53 KiB 10 modules
|
||||
dependent modules 20 bytes [dependent] 1 module
|
||||
./a.js + 1 modules 185 bytes [built] [code generated]
|
||||
chunk (runtime: main) vendors/async-a.js (async-a) 245 bytes [rendered]
|
||||
|
@ -313,16 +313,16 @@ multiple-vendors:
|
|||
> ./b b
|
||||
> ./c c
|
||||
./node_modules/x.js 20 bytes [built] [code generated]
|
||||
chunk (runtime: b) multiple-vendors/b.js (b) 116 bytes (javascript) 2.77 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: b) multiple-vendors/b.js (b) 116 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
> ./b b
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./b.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, main) multiple-vendors/async-g.js (async-g) 45 bytes [rendered]
|
||||
> ./g ./a.js 6:0-47
|
||||
./g.js 45 bytes [built] [code generated]
|
||||
chunk (runtime: main) multiple-vendors/main.js (main) 147 bytes (javascript) 6.69 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: main) multiple-vendors/main.js (main) 147 bytes (javascript) 6.68 KiB (runtime) [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 6.69 KiB 9 modules
|
||||
runtime modules 6.68 KiB 9 modules
|
||||
./index.js 147 bytes [built] [code generated]
|
||||
chunk (runtime: main) multiple-vendors/async-b.js (async-b) 116 bytes [rendered]
|
||||
> ./b ./index.js 2:0-47
|
||||
|
@ -334,9 +334,9 @@ multiple-vendors:
|
|||
> ./a ./index.js 1:0-47
|
||||
> ./a a
|
||||
./e.js 20 bytes [built] [code generated]
|
||||
chunk (runtime: c) multiple-vendors/c.js (c) 116 bytes (javascript) 2.77 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: c) multiple-vendors/c.js (c) 116 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
> ./c c
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, b, c, main) multiple-vendors/568.js 20 bytes [initial] [rendered] split chunk (cache group: default)
|
||||
> ./b ./index.js 2:0-47
|
||||
|
@ -377,9 +377,9 @@ all:
|
|||
Entrypoint a 15 KiB = all/282.js 414 bytes all/954.js 414 bytes all/767.js 414 bytes all/390.js 414 bytes all/a.js 13.4 KiB
|
||||
Entrypoint b 8.14 KiB = all/282.js 414 bytes all/954.js 414 bytes all/767.js 414 bytes all/568.js 414 bytes all/b.js 6.52 KiB
|
||||
Entrypoint c 8.14 KiB = all/282.js 414 bytes all/769.js 414 bytes all/767.js 414 bytes all/568.js 414 bytes all/c.js 6.52 KiB
|
||||
chunk (runtime: b) all/b.js (b) 116 bytes (javascript) 2.77 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: b) all/b.js (b) 116 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
> ./b b
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./b.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, main) all/async-g.js (async-g) 45 bytes [rendered]
|
||||
> ./g ./a.js 6:0-47
|
||||
|
@ -406,9 +406,9 @@ all:
|
|||
> ./a ./index.js 1:0-47
|
||||
> ./a a
|
||||
./e.js 20 bytes [built] [code generated]
|
||||
chunk (runtime: c) all/c.js (c) 116 bytes (javascript) 2.77 KiB (runtime) [entry] [rendered]
|
||||
chunk (runtime: c) all/c.js (c) 116 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
> ./c c
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, b, c, main) all/568.js 20 bytes [initial] [rendered] split chunk (cache group: default)
|
||||
> ./b ./index.js 2:0-47
|
||||
|
@ -497,9 +497,9 @@ asset bundle.js 10.2 KiB [emitted] (name: main)
|
|||
asset 460.bundle.js 323 bytes [emitted]
|
||||
asset 524.bundle.js 206 bytes [emitted]
|
||||
asset 996.bundle.js 138 bytes [emitted]
|
||||
chunk (runtime: main) bundle.js (main) 73 bytes (javascript) 6.01 KiB (runtime) >{460}< >{996}< [entry] [rendered]
|
||||
chunk (runtime: main) bundle.js (main) 73 bytes (javascript) 6 KiB (runtime) >{460}< >{996}< [entry] [rendered]
|
||||
> ./index main
|
||||
runtime modules 6.01 KiB 7 modules
|
||||
runtime modules 6 KiB 7 modules
|
||||
cacheable modules 73 bytes
|
||||
./a.js 22 bytes [dependent] [built] [code generated]
|
||||
cjs self exports reference ./a.js 1:0-14
|
||||
|
@ -626,10 +626,10 @@ webpack x.x.x compiled successfully in X ms"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for commons-chunk-min-size-0 1`] = `
|
||||
"asset entry-1.js 5.71 KiB [emitted] (name: entry-1)
|
||||
"asset entry-1.js 5.7 KiB [emitted] (name: entry-1)
|
||||
asset 429.js 274 bytes [emitted] (id hint: vendor-1)
|
||||
Entrypoint entry-1 5.97 KiB = 429.js 274 bytes entry-1.js 5.71 KiB
|
||||
runtime modules 2.46 KiB 3 modules
|
||||
Entrypoint entry-1 5.97 KiB = 429.js 274 bytes entry-1.js 5.7 KiB
|
||||
runtime modules 2.45 KiB 3 modules
|
||||
modules by path ./modules/*.js 132 bytes
|
||||
./modules/a.js 22 bytes [built] [code generated]
|
||||
./modules/b.js 22 bytes [built] [code generated]
|
||||
|
@ -642,10 +642,10 @@ webpack x.x.x compiled successfully in X ms"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for commons-chunk-min-size-Infinity 1`] = `
|
||||
"asset entry-1.js 5.71 KiB [emitted] (name: entry-1)
|
||||
"asset entry-1.js 5.7 KiB [emitted] (name: entry-1)
|
||||
asset vendor-1.js 274 bytes [emitted] (name: vendor-1) (id hint: vendor-1)
|
||||
Entrypoint entry-1 5.97 KiB = vendor-1.js 274 bytes entry-1.js 5.71 KiB
|
||||
runtime modules 2.46 KiB 3 modules
|
||||
Entrypoint entry-1 5.97 KiB = vendor-1.js 274 bytes entry-1.js 5.7 KiB
|
||||
runtime modules 2.45 KiB 3 modules
|
||||
modules by path ./modules/*.js 132 bytes
|
||||
./modules/a.js 22 bytes [built] [code generated]
|
||||
./modules/b.js 22 bytes [built] [code generated]
|
||||
|
@ -658,20 +658,20 @@ webpack x.x.x compiled successfully in X ms"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for commons-plugin-issue-4980 1`] = `
|
||||
"asset app.93348d48a3a36b9dfe36-1.js 6.24 KiB [emitted] [immutable] (name: app)
|
||||
"asset app.a304ced30e50efdd246d-1.js 6.24 KiB [emitted] [immutable] (name: app)
|
||||
asset vendor.e8705eba33f92df1cf62-1.js 619 bytes [emitted] [immutable] (name: vendor) (id hint: vendor)
|
||||
Entrypoint app 6.84 KiB = vendor.e8705eba33f92df1cf62-1.js 619 bytes app.93348d48a3a36b9dfe36-1.js 6.24 KiB
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
Entrypoint app 6.84 KiB = vendor.e8705eba33f92df1cf62-1.js 619 bytes app.a304ced30e50efdd246d-1.js 6.24 KiB
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
orphan modules 118 bytes [orphan] 2 modules
|
||||
cacheable modules 272 bytes
|
||||
./entry-1.js + 2 modules 185 bytes [built] [code generated]
|
||||
./constants.js 87 bytes [built] [code generated]
|
||||
webpack x.x.x compiled successfully in X ms
|
||||
|
||||
asset app.7df4a486d4bfe64fb90e-2.js 6.26 KiB [emitted] [immutable] (name: app)
|
||||
asset app.8f403eca7a1e59a7ce89-2.js 6.25 KiB [emitted] [immutable] (name: app)
|
||||
asset vendor.e8705eba33f92df1cf62-2.js 619 bytes [emitted] [immutable] (name: vendor) (id hint: vendor)
|
||||
Entrypoint app 6.86 KiB = vendor.e8705eba33f92df1cf62-2.js 619 bytes app.7df4a486d4bfe64fb90e-2.js 6.26 KiB
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
Entrypoint app 6.86 KiB = vendor.e8705eba33f92df1cf62-2.js 619 bytes app.8f403eca7a1e59a7ce89-2.js 6.25 KiB
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
orphan modules 125 bytes [orphan] 2 modules
|
||||
cacheable modules 279 bytes
|
||||
./entry-2.js + 2 modules 192 bytes [built] [code generated]
|
||||
|
@ -700,58 +700,58 @@ exports[`StatsTestCases should print correct stats for concat-and-sideeffects 1`
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for context-independence 1`] = `
|
||||
"asset main-4aabfaa86ecfef36d9be.js 10.4 KiB [emitted] [immutable] (name: main)
|
||||
sourceMap main-4aabfaa86ecfef36d9be.js.map 9.27 KiB [emitted] [dev] (auxiliary name: main)
|
||||
"asset main-9eb37fb0850a854f8074.js 10.4 KiB [emitted] [immutable] (name: main)
|
||||
sourceMap main-9eb37fb0850a854f8074.js.map 9.26 KiB [emitted] [dev] (auxiliary name: main)
|
||||
asset 695-4dd37417c69a0af66bac.js 455 bytes [emitted] [immutable]
|
||||
sourceMap 695-4dd37417c69a0af66bac.js.map 342 bytes [emitted] [dev]
|
||||
runtime modules 6.3 KiB 8 modules
|
||||
runtime modules 6.29 KiB 8 modules
|
||||
orphan modules 19 bytes [orphan] 1 module
|
||||
cacheable modules 106 bytes
|
||||
./a/index.js (in Xdir/context-independence/a) 40 bytes [built] [code generated]
|
||||
./a/chunk.js + 1 modules (in Xdir/context-independence/a) 66 bytes [built] [code generated]
|
||||
webpack x.x.x compiled successfully in X ms
|
||||
|
||||
asset main-4aabfaa86ecfef36d9be.js 10.4 KiB [emitted] [immutable] (name: main)
|
||||
sourceMap main-4aabfaa86ecfef36d9be.js.map 9.27 KiB [emitted] [dev] (auxiliary name: main)
|
||||
asset main-9eb37fb0850a854f8074.js 10.4 KiB [emitted] [immutable] (name: main)
|
||||
sourceMap main-9eb37fb0850a854f8074.js.map 9.26 KiB [emitted] [dev] (auxiliary name: main)
|
||||
asset 695-4dd37417c69a0af66bac.js 455 bytes [emitted] [immutable]
|
||||
sourceMap 695-4dd37417c69a0af66bac.js.map 342 bytes [emitted] [dev]
|
||||
runtime modules 6.3 KiB 8 modules
|
||||
runtime modules 6.29 KiB 8 modules
|
||||
orphan modules 19 bytes [orphan] 1 module
|
||||
cacheable modules 106 bytes
|
||||
./b/index.js (in Xdir/context-independence/b) 40 bytes [built] [code generated]
|
||||
./b/chunk.js + 1 modules (in Xdir/context-independence/b) 66 bytes [built] [code generated]
|
||||
webpack x.x.x compiled successfully in X ms
|
||||
|
||||
asset main-0dae7fdb1672844ee2a7.js 11.6 KiB [emitted] [immutable] (name: main)
|
||||
asset main-180aaac92930f4aab865.js 11.6 KiB [emitted] [immutable] (name: main)
|
||||
asset 695-828eb5c7418e1b8270bb.js 1.5 KiB [emitted] [immutable]
|
||||
runtime modules 6.3 KiB 8 modules
|
||||
runtime modules 6.29 KiB 8 modules
|
||||
orphan modules 19 bytes [orphan] 1 module
|
||||
cacheable modules 106 bytes
|
||||
./a/index.js (in Xdir/context-independence/a) 40 bytes [built] [code generated]
|
||||
./a/chunk.js + 1 modules (in Xdir/context-independence/a) 66 bytes [built] [code generated]
|
||||
webpack x.x.x compiled successfully in X ms
|
||||
|
||||
asset main-0dae7fdb1672844ee2a7.js 11.6 KiB [emitted] [immutable] (name: main)
|
||||
asset main-180aaac92930f4aab865.js 11.6 KiB [emitted] [immutable] (name: main)
|
||||
asset 695-828eb5c7418e1b8270bb.js 1.5 KiB [emitted] [immutable]
|
||||
runtime modules 6.3 KiB 8 modules
|
||||
runtime modules 6.29 KiB 8 modules
|
||||
orphan modules 19 bytes [orphan] 1 module
|
||||
cacheable modules 106 bytes
|
||||
./b/index.js (in Xdir/context-independence/b) 40 bytes [built] [code generated]
|
||||
./b/chunk.js + 1 modules (in Xdir/context-independence/b) 66 bytes [built] [code generated]
|
||||
webpack x.x.x compiled successfully in X ms
|
||||
|
||||
asset main-ae1f2717fd5d1cb5ac68.js 11.3 KiB [emitted] [immutable] (name: main)
|
||||
asset main-633b38bd6be14d7e5f1e.js 11.3 KiB [emitted] [immutable] (name: main)
|
||||
asset 695-ace208366ce0ce2556ef.js 1.01 KiB [emitted] [immutable]
|
||||
runtime modules 6.3 KiB 8 modules
|
||||
runtime modules 6.29 KiB 8 modules
|
||||
orphan modules 19 bytes [orphan] 1 module
|
||||
cacheable modules 106 bytes
|
||||
./a/index.js (in Xdir/context-independence/a) 40 bytes [built] [code generated]
|
||||
./a/chunk.js + 1 modules (in Xdir/context-independence/a) 66 bytes [built] [code generated]
|
||||
webpack x.x.x compiled successfully in X ms
|
||||
|
||||
asset main-ae1f2717fd5d1cb5ac68.js 11.3 KiB [emitted] [immutable] (name: main)
|
||||
asset main-633b38bd6be14d7e5f1e.js 11.3 KiB [emitted] [immutable] (name: main)
|
||||
asset 695-ace208366ce0ce2556ef.js 1.01 KiB [emitted] [immutable]
|
||||
runtime modules 6.3 KiB 8 modules
|
||||
runtime modules 6.29 KiB 8 modules
|
||||
orphan modules 19 bytes [orphan] 1 module
|
||||
cacheable modules 106 bytes
|
||||
./b/index.js (in Xdir/context-independence/b) 40 bytes [built] [code generated]
|
||||
|
@ -972,16 +972,16 @@ exports[`StatsTestCases should print correct stats for graph-correctness-entries
|
|||
"chunk (runtime: e1, e2) b.js (b) 49 bytes <{786}> >{459}< [rendered]
|
||||
./module-b.js 49 bytes [built] [code generated]
|
||||
import() ./module-b ./module-a.js 1:0-47
|
||||
chunk (runtime: e1) e1.js (e1) 49 bytes (javascript) 7.72 KiB (runtime) >{786}< [entry] [rendered]
|
||||
runtime modules 7.72 KiB 10 modules
|
||||
chunk (runtime: e1) e1.js (e1) 49 bytes (javascript) 7.71 KiB (runtime) >{786}< [entry] [rendered]
|
||||
runtime modules 7.71 KiB 10 modules
|
||||
./e1.js 49 bytes [built] [code generated]
|
||||
entry ./e1 e1
|
||||
chunk (runtime: e1, e2) c.js (c) 49 bytes <{128}> <{621}> >{786}< [rendered]
|
||||
./module-c.js 49 bytes [built] [code generated]
|
||||
import() ./module-c ./e2.js 1:0-47
|
||||
import() ./module-c ./module-b.js 1:0-47
|
||||
chunk (runtime: e2) e2.js (e2) 49 bytes (javascript) 7.72 KiB (runtime) >{459}< [entry] [rendered]
|
||||
runtime modules 7.72 KiB 10 modules
|
||||
chunk (runtime: e2) e2.js (e2) 49 bytes (javascript) 7.71 KiB (runtime) >{459}< [entry] [rendered]
|
||||
runtime modules 7.71 KiB 10 modules
|
||||
./e2.js 49 bytes [built] [code generated]
|
||||
entry ./e2 e2
|
||||
chunk (runtime: e1, e2) a.js (a) 49 bytes <{257}> <{459}> >{128}< [rendered]
|
||||
|
@ -995,8 +995,8 @@ exports[`StatsTestCases should print correct stats for graph-correctness-modules
|
|||
"chunk (runtime: e1, e2) b.js (b) 179 bytes <{786}> >{459}< [rendered]
|
||||
./module-b.js 179 bytes [built] [code generated]
|
||||
import() ./module-b ./module-a.js 1:0-47
|
||||
chunk (runtime: e1) e1.js (e1) 119 bytes (javascript) 7.99 KiB (runtime) >{786}< >{892}< [entry] [rendered]
|
||||
runtime modules 7.99 KiB 11 modules
|
||||
chunk (runtime: e1) e1.js (e1) 119 bytes (javascript) 7.98 KiB (runtime) >{786}< >{892}< [entry] [rendered]
|
||||
runtime modules 7.98 KiB 11 modules
|
||||
cacheable modules 119 bytes
|
||||
./e1.js 70 bytes [built] [code generated]
|
||||
entry ./e1 e1
|
||||
|
@ -1008,8 +1008,8 @@ chunk (runtime: e1, e2) c.js (c) 49 bytes <{128}> <{621}> >{786}< [rendered]
|
|||
./module-c.js 49 bytes [built] [code generated]
|
||||
import() ./module-c ./e2.js 2:0-47
|
||||
import() ./module-c ./module-b.js 1:0-47
|
||||
chunk (runtime: e2) e2.js (e2) 119 bytes (javascript) 7.99 KiB (runtime) >{459}< >{892}< [entry] [rendered]
|
||||
runtime modules 7.99 KiB 11 modules
|
||||
chunk (runtime: e2) e2.js (e2) 119 bytes (javascript) 7.98 KiB (runtime) >{459}< >{892}< [entry] [rendered]
|
||||
runtime modules 7.98 KiB 11 modules
|
||||
cacheable modules 119 bytes
|
||||
./e2.js 70 bytes [built] [code generated]
|
||||
entry ./e2 e2
|
||||
|
@ -1078,7 +1078,7 @@ webpack x.x.x compiled with 2 warnings in X ms"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for immutable 1`] = `
|
||||
"asset 54f4c317fe5160a061c8.js 13.4 KiB [emitted] [immutable] (name: main)
|
||||
"asset 0e05fd23a5dbc3703724.js 13.4 KiB [emitted] [immutable] (name: main)
|
||||
asset 22c24a3b26d46118dc06.js 809 bytes [emitted] [immutable]"
|
||||
`;
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ webpack x.x.x compiled successfully in X ms"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for import-with-invalid-options-comments 1`] = `
|
||||
"runtime modules 8.61 KiB 12 modules
|
||||
"runtime modules 8.6 KiB 12 modules
|
||||
cacheable modules 559 bytes
|
||||
./index.js 50 bytes [built] [code generated]
|
||||
./chunk.js 401 bytes [built] [code generated] [3 warnings]
|
||||
|
@ -1135,19 +1135,19 @@ webpack x.x.x compiled with 3 warnings"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for issue-7577 1`] = `
|
||||
"asset a-runtime~main-b4ac9ffbda8affb59dc2.js 4.92 KiB [emitted] [immutable] (name: runtime~main)
|
||||
"asset a-runtime~main-92872ba8425c7f1a75a6.js 4.92 KiB [emitted] [immutable] (name: runtime~main)
|
||||
asset a-main-5b238661c342d3c63636.js 405 bytes [emitted] [immutable] (name: main)
|
||||
asset a-all-a_js-52fb35892f514e05c220.js 140 bytes [emitted] [immutable] (id hint: all)
|
||||
Entrypoint main 5.46 KiB = a-runtime~main-b4ac9ffbda8affb59dc2.js 4.92 KiB a-all-a_js-52fb35892f514e05c220.js 140 bytes a-main-5b238661c342d3c63636.js 405 bytes
|
||||
runtime modules 2.47 KiB 3 modules
|
||||
Entrypoint main 5.45 KiB = a-runtime~main-92872ba8425c7f1a75a6.js 4.92 KiB a-all-a_js-52fb35892f514e05c220.js 140 bytes a-main-5b238661c342d3c63636.js 405 bytes
|
||||
runtime modules 2.46 KiB 3 modules
|
||||
./a.js 18 bytes [built] [code generated]
|
||||
webpack x.x.x compiled successfully in X ms
|
||||
|
||||
asset b-runtime~main-59100c6ccf028a3d60ba.js 5.86 KiB [emitted] [immutable] (name: runtime~main)
|
||||
asset b-runtime~main-b6957ac1c3a86ce8164e.js 5.86 KiB [emitted] [immutable] (name: runtime~main)
|
||||
asset b-all-b_js-1ccae3120aa8d62e9877.js 475 bytes [emitted] [immutable] (id hint: all)
|
||||
asset b-main-503688157f1b1be3d9ac.js 438 bytes [emitted] [immutable] (name: main)
|
||||
asset b-vendors-node_modules_vendor_js-7320f018dbab7e34ead5.js 185 bytes [emitted] [immutable] (id hint: vendors)
|
||||
Entrypoint main 6.93 KiB = b-runtime~main-59100c6ccf028a3d60ba.js 5.86 KiB b-vendors-node_modules_vendor_js-7320f018dbab7e34ead5.js 185 bytes b-all-b_js-1ccae3120aa8d62e9877.js 475 bytes b-main-503688157f1b1be3d9ac.js 438 bytes
|
||||
Entrypoint main 6.93 KiB = b-runtime~main-b6957ac1c3a86ce8164e.js 5.86 KiB b-vendors-node_modules_vendor_js-7320f018dbab7e34ead5.js 185 bytes b-all-b_js-1ccae3120aa8d62e9877.js 475 bytes b-main-503688157f1b1be3d9ac.js 438 bytes
|
||||
runtime modules 3.03 KiB 5 modules
|
||||
cacheable modules 40 bytes
|
||||
./b.js 17 bytes [built] [code generated]
|
||||
|
@ -1157,10 +1157,10 @@ webpack x.x.x compiled successfully in X ms
|
|||
assets by chunk 895 bytes (id hint: all)
|
||||
asset c-all-b_js-d2d64fdaadbf1936503b.js 502 bytes [emitted] [immutable] (id hint: all)
|
||||
asset c-all-c_js-0552c7cbb8c1a12b6b9c.js 393 bytes [emitted] [immutable] (id hint: all)
|
||||
asset c-runtime~main-61b507ed6234b5bfc102.js 13.6 KiB [emitted] [immutable] (name: runtime~main)
|
||||
asset c-runtime~main-9feecb76e2fda0c5fc0d.js 13.5 KiB [emitted] [immutable] (name: runtime~main)
|
||||
asset c-main-463838c803f48fe97bb6.js 680 bytes [emitted] [immutable] (name: main)
|
||||
asset c-vendors-node_modules_vendor_js-7320f018dbab7e34ead5.js 185 bytes [emitted] [immutable] (id hint: vendors)
|
||||
Entrypoint main 14.6 KiB = c-runtime~main-61b507ed6234b5bfc102.js 13.6 KiB c-all-c_js-0552c7cbb8c1a12b6b9c.js 393 bytes c-main-463838c803f48fe97bb6.js 680 bytes
|
||||
Entrypoint main 14.6 KiB = c-runtime~main-9feecb76e2fda0c5fc0d.js 13.5 KiB c-all-c_js-0552c7cbb8c1a12b6b9c.js 393 bytes c-main-463838c803f48fe97bb6.js 680 bytes
|
||||
runtime modules 8.67 KiB 13 modules
|
||||
cacheable modules 101 bytes
|
||||
./c.js 61 bytes [built] [code generated]
|
||||
|
@ -1420,14 +1420,14 @@ asset e3.js 12 KiB [emitted] (name: e3)
|
|||
asset async1.js 964 bytes [emitted] (name: async1)
|
||||
asset async2.js 964 bytes [emitted] (name: async2)
|
||||
asset async3.js 964 bytes [emitted] (name: async3)
|
||||
chunk (runtime: e3) e3.js (e3) 242 bytes (javascript) 6.62 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.62 KiB 9 modules
|
||||
chunk (runtime: e3) e3.js (e3) 242 bytes (javascript) 6.61 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.61 KiB 9 modules
|
||||
cacheable modules 242 bytes
|
||||
./b.js 20 bytes [dependent] [built] [code generated]
|
||||
./e3.js + 2 modules 202 bytes [built] [code generated]
|
||||
./h.js 20 bytes [dependent] [built] [code generated]
|
||||
chunk (runtime: e1) e1.js (e1) 242 bytes (javascript) 6.62 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.62 KiB 9 modules
|
||||
chunk (runtime: e1) e1.js (e1) 242 bytes (javascript) 6.61 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.61 KiB 9 modules
|
||||
cacheable modules 242 bytes
|
||||
./b.js 20 bytes [dependent] [built] [code generated]
|
||||
./d.js 20 bytes [dependent] [built] [code generated]
|
||||
|
@ -1438,8 +1438,8 @@ chunk (runtime: e1, e2, e3) async1.js (async1) 135 bytes [rendered]
|
|||
chunk (runtime: e1, e2, e3) async3.js (async3) 135 bytes [rendered]
|
||||
./async3.js 115 bytes [built] [code generated]
|
||||
./h.js 20 bytes [dependent] [built] [code generated]
|
||||
chunk (runtime: e2) e2.js (e2) 242 bytes (javascript) 6.62 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.62 KiB 9 modules
|
||||
chunk (runtime: e2) e2.js (e2) 242 bytes (javascript) 6.61 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.61 KiB 9 modules
|
||||
cacheable modules 242 bytes
|
||||
./b.js 20 bytes [dependent] [built] [code generated]
|
||||
./e2.js + 2 modules 202 bytes [built] [code generated]
|
||||
|
@ -1623,7 +1623,7 @@ exports[`StatsTestCases should print correct stats for named-chunks-plugin-async
|
|||
"asset entry.js 12.4 KiB [emitted] (name: entry)
|
||||
asset modules_a_js.js 313 bytes [emitted]
|
||||
asset modules_b_js.js 149 bytes [emitted]
|
||||
runtime modules 7.69 KiB 10 modules
|
||||
runtime modules 7.68 KiB 10 modules
|
||||
cacheable modules 106 bytes
|
||||
./entry.js 47 bytes [built] [code generated]
|
||||
./modules/a.js 37 bytes [built] [code generated]
|
||||
|
@ -2084,7 +2084,7 @@ LOG from webpack.FileSystemInfo
|
|||
Directory info in cache: 0 timestamps 0 hashes 0 timestamp hash combinations
|
||||
Managed items info in cache: 0 items
|
||||
|
||||
1970-04-20 12:42:42: webpack x.x.x compiled successfully in X ms (c7a4e3bf1797f14ec5d7)"
|
||||
1970-04-20 12:42:42: webpack x.x.x compiled successfully in X ms (e660cd491247c45742cc)"
|
||||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for preset-errors-only 1`] = `""`;
|
||||
|
@ -2460,13 +2460,13 @@ LOG from webpack.FileSystemInfo
|
|||
Directory info in cache: 0 timestamps 0 hashes 0 timestamp hash combinations
|
||||
Managed items info in cache: 0 items
|
||||
|
||||
1970-04-20 12:42:42: webpack x.x.x compiled successfully in X ms (c7a4e3bf1797f14ec5d7)"
|
||||
1970-04-20 12:42:42: webpack x.x.x compiled successfully in X ms (e660cd491247c45742cc)"
|
||||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for real-content-hash 1`] = `
|
||||
"a-normal:
|
||||
assets by path *.js 3.23 KiB
|
||||
asset 72965507c7b4c0b4fc29-729655.js 2.75 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
asset 8b31b7e863da4eb900ec-8b31b7.js 2.75 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
asset a6d438a0676f93383d79-a6d438.js 262 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
asset cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
asset 666f2b8847021ccc7608-666f2b.js 21 bytes [emitted] [immutable] [minimized] (name: a, b)
|
||||
|
@ -2474,10 +2474,10 @@ exports[`StatsTestCases should print correct stats for real-content-hash 1`] = `
|
|||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index)
|
||||
Entrypoint index 2.96 KiB (5.89 KiB) = 72965507c7b4c0b4fc29-729655.js 2.75 KiB cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes 1 auxiliary asset
|
||||
Entrypoint index 2.96 KiB (5.89 KiB) = 8b31b7e863da4eb900ec-8b31b7.js 2.75 KiB cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes 1 auxiliary asset
|
||||
Entrypoint a 21 bytes = 666f2b8847021ccc7608-666f2b.js
|
||||
Entrypoint b 21 bytes = 666f2b8847021ccc7608-666f2b.js
|
||||
runtime modules 7.29 KiB 9 modules
|
||||
runtime modules 7.28 KiB 9 modules
|
||||
orphan modules 23 bytes [orphan] 1 module
|
||||
cacheable modules 514 bytes (javascript) 26.3 KiB (asset)
|
||||
javascript modules 388 bytes
|
||||
|
@ -2493,7 +2493,7 @@ exports[`StatsTestCases should print correct stats for real-content-hash 1`] = `
|
|||
|
||||
b-normal:
|
||||
assets by path *.js 3.23 KiB
|
||||
asset 415ca114e6dbdbc5f84c-415ca1.js 2.75 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
asset 702aa6917fd66fd4d364-702aa6.js 2.75 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
asset a6d438a0676f93383d79-a6d438.js 262 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
asset cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
asset 666f2b8847021ccc7608-666f2b.js 21 bytes [emitted] [immutable] [minimized] (name: a, b)
|
||||
|
@ -2501,10 +2501,10 @@ b-normal:
|
|||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index)
|
||||
Entrypoint index 2.96 KiB (5.89 KiB) = 415ca114e6dbdbc5f84c-415ca1.js 2.75 KiB cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes 1 auxiliary asset
|
||||
Entrypoint index 2.96 KiB (5.89 KiB) = 702aa6917fd66fd4d364-702aa6.js 2.75 KiB cbb9c74e42f00ada40f7-cbb9c7.js 212 bytes 1 auxiliary asset
|
||||
Entrypoint a 21 bytes = 666f2b8847021ccc7608-666f2b.js
|
||||
Entrypoint b 21 bytes = 666f2b8847021ccc7608-666f2b.js
|
||||
runtime modules 7.29 KiB 9 modules
|
||||
runtime modules 7.28 KiB 9 modules
|
||||
orphan modules 19 bytes [orphan] 1 module
|
||||
cacheable modules 469 bytes (javascript) 26.3 KiB (asset)
|
||||
javascript modules 343 bytes
|
||||
|
@ -2520,8 +2520,8 @@ b-normal:
|
|||
|
||||
a-source-map:
|
||||
assets by path *.js 3.45 KiB
|
||||
asset d618b31bb631bdbaee8e-d618b3.js 2.81 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
sourceMap d618b31bb631bdbaee8e-d618b3.js.map 14.5 KiB [emitted] [dev] (auxiliary name: runtime)
|
||||
asset 779b93c06fb6f6229be7-779b93.js 2.8 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
sourceMap 779b93c06fb6f6229be7-779b93.js.map 14.5 KiB [emitted] [dev] (auxiliary name: runtime)
|
||||
asset da6ceedb86c86e79a49a-da6cee.js 318 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
sourceMap da6ceedb86c86e79a49a-da6cee.js.map 401 bytes [emitted] [dev] (auxiliary name: lazy)
|
||||
asset 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
|
@ -2532,10 +2532,10 @@ a-source-map:
|
|||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index)
|
||||
Entrypoint index 3.07 KiB (20.7 KiB) = d618b31bb631bdbaee8e-d618b3.js 2.81 KiB 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes 3 auxiliary assets
|
||||
Entrypoint index 3.06 KiB (20.7 KiB) = 779b93c06fb6f6229be7-779b93.js 2.8 KiB 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes 3 auxiliary assets
|
||||
Entrypoint a 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset
|
||||
Entrypoint b 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset
|
||||
runtime modules 7.29 KiB 9 modules
|
||||
runtime modules 7.28 KiB 9 modules
|
||||
orphan modules 23 bytes [orphan] 1 module
|
||||
cacheable modules 514 bytes (javascript) 26.3 KiB (asset)
|
||||
javascript modules 388 bytes
|
||||
|
@ -2551,8 +2551,8 @@ a-source-map:
|
|||
|
||||
b-source-map:
|
||||
assets by path *.js 3.45 KiB
|
||||
asset 338f50bd5a2d2dac263f-338f50.js 2.81 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
sourceMap 338f50bd5a2d2dac263f-338f50.js.map 14.5 KiB [emitted] [dev] (auxiliary name: runtime)
|
||||
asset 796d1329e3aa20b86016-796d13.js 2.8 KiB [emitted] [immutable] [minimized] (name: runtime)
|
||||
sourceMap 796d1329e3aa20b86016-796d13.js.map 14.5 KiB [emitted] [dev] (auxiliary name: runtime)
|
||||
asset da6ceedb86c86e79a49a-da6cee.js 318 bytes [emitted] [immutable] [minimized] (name: lazy)
|
||||
sourceMap da6ceedb86c86e79a49a-da6cee.js.map 397 bytes [emitted] [dev] (auxiliary name: lazy)
|
||||
asset 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes [emitted] [immutable] [minimized] (name: index)
|
||||
|
@ -2563,10 +2563,10 @@ b-source-map:
|
|||
asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: file.png] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg?query 5.89 KiB [cached] [immutable] [from: file.jpg?query] (auxiliary name: lazy)
|
||||
asset 7382fad5b015914e0811.jpg 5.89 KiB [emitted] [immutable] [from: file.jpg] (auxiliary name: index)
|
||||
Entrypoint index 3.07 KiB (20.7 KiB) = 338f50bd5a2d2dac263f-338f50.js 2.81 KiB 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes 3 auxiliary assets
|
||||
Entrypoint index 3.06 KiB (20.7 KiB) = 796d1329e3aa20b86016-796d13.js 2.8 KiB 9e0ae6ff74fb2c3c821b-9e0ae6.js 268 bytes 3 auxiliary assets
|
||||
Entrypoint a 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset
|
||||
Entrypoint b 77 bytes (254 bytes) = 222c2acc68675174e6b2-222c2a.js 1 auxiliary asset
|
||||
runtime modules 7.29 KiB 9 modules
|
||||
runtime modules 7.28 KiB 9 modules
|
||||
orphan modules 19 bytes [orphan] 1 module
|
||||
cacheable modules 469 bytes (javascript) 26.3 KiB (asset)
|
||||
javascript modules 343 bytes
|
||||
|
@ -2584,7 +2584,7 @@ b-source-map:
|
|||
exports[`StatsTestCases should print correct stats for related-assets 1`] = `
|
||||
"default:
|
||||
assets by path *.js 15.2 KiB
|
||||
asset default-main.js 14.5 KiB [emitted] (name: main) 3 related assets
|
||||
asset default-main.js 14.4 KiB [emitted] (name: main) 3 related assets
|
||||
asset default-chunk_js.js 803 bytes [emitted] 3 related assets
|
||||
assets by path *.css 142 bytes
|
||||
asset default-chunk_js.css 73 bytes [emitted] 3 related assets
|
||||
|
@ -2742,7 +2742,7 @@ exports[`StatsTestCases should print correct stats for runtime-chunk-integration
|
|||
asset without-505.js 1.2 KiB [emitted]
|
||||
asset without-main1.js 815 bytes [emitted] (name: main1)
|
||||
Entrypoint main1 12.8 KiB = without-runtime.js 12 KiB without-main1.js 815 bytes
|
||||
runtime modules 7.52 KiB 10 modules
|
||||
runtime modules 7.51 KiB 10 modules
|
||||
cacheable modules 126 bytes
|
||||
./main1.js 66 bytes [built] [code generated]
|
||||
./b.js 20 bytes [built] [code generated]
|
||||
|
@ -2778,8 +2778,8 @@ dynamic custom name:
|
|||
asset func-main3.js 434 bytes [emitted] (name: main3)
|
||||
Entrypoint main1 12.8 KiB = func-b.js 12 KiB func-main1.js 815 bytes
|
||||
Entrypoint main2 12.5 KiB = func-b.js 12 KiB func-main2.js 434 bytes
|
||||
Entrypoint main3 5.34 KiB = func-a.js 4.91 KiB func-main3.js 434 bytes
|
||||
runtime modules 9.97 KiB 13 modules
|
||||
Entrypoint main3 5.33 KiB = func-a.js 4.91 KiB func-main3.js 434 bytes
|
||||
runtime modules 9.96 KiB 13 modules
|
||||
cacheable modules 166 bytes
|
||||
./main1.js 66 bytes [built] [code generated]
|
||||
./main2.js 20 bytes [built] [code generated]
|
||||
|
@ -2797,8 +2797,8 @@ webpack x.x.x compiled successfully"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for runtime-chunk-single 1`] = `
|
||||
"Entrypoint e1 6.51 KiB = runtime.js 5.47 KiB e1.js 1.04 KiB
|
||||
Entrypoint e2 6.51 KiB = runtime.js 5.47 KiB e2.js 1.04 KiB
|
||||
"Entrypoint e1 6.5 KiB = runtime.js 5.47 KiB e1.js 1.04 KiB
|
||||
Entrypoint e2 6.5 KiB = runtime.js 5.47 KiB e2.js 1.04 KiB
|
||||
webpack x.x.x compiled successfully"
|
||||
`;
|
||||
|
||||
|
@ -2978,8 +2978,8 @@ global:
|
|||
asset global-dy_js.js 1.16 KiB [emitted]
|
||||
asset global-dz_js.js 1.16 KiB [emitted]
|
||||
asset global-c.js 93 bytes [emitted] (name: c)
|
||||
chunk (runtime: a) global-a.js (a) 605 bytes (javascript) 6.58 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.58 KiB 9 modules
|
||||
chunk (runtime: a) global-a.js (a) 605 bytes (javascript) 6.57 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.57 KiB 9 modules
|
||||
cacheable modules 605 bytes
|
||||
./a.js 261 bytes [built] [code generated]
|
||||
[no exports used]
|
||||
|
@ -2991,8 +2991,8 @@ global:
|
|||
[only some exports used: x, y]
|
||||
./reexport.js 37 bytes [dependent] [built] [code generated]
|
||||
[only some exports used: x, y]
|
||||
chunk (runtime: b) global-b.js (b) 605 bytes (javascript) 6.58 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.58 KiB 9 modules
|
||||
chunk (runtime: b) global-b.js (b) 605 bytes (javascript) 6.57 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 6.57 KiB 9 modules
|
||||
cacheable modules 605 bytes
|
||||
./b.js 261 bytes [built] [code generated]
|
||||
[no exports used]
|
||||
|
@ -3023,7 +3023,7 @@ global:
|
|||
./dz.js 46 bytes [built] [code generated]
|
||||
./module.js?chunk 122 bytes [dependent] [built] [code generated]
|
||||
[only some exports used: identity, w, x, y, z]
|
||||
runtime modules 13.2 KiB 18 modules
|
||||
runtime modules 13.1 KiB 18 modules
|
||||
cacheable modules 1.15 KiB
|
||||
./a.js 261 bytes [built] [code generated]
|
||||
[no exports used]
|
||||
|
@ -3107,7 +3107,7 @@ webpack x.x.x compiled successfully in X ms"
|
|||
exports[`StatsTestCases should print correct stats for side-effects-issue-7428 1`] = `
|
||||
"asset main.js 12.3 KiB [emitted] (name: main)
|
||||
asset 1.js 643 bytes [emitted]
|
||||
runtime modules 6.57 KiB 9 modules
|
||||
runtime modules 6.56 KiB 9 modules
|
||||
cacheable modules 823 bytes
|
||||
modules by path ./components/src/ 501 bytes
|
||||
orphan modules 315 bytes [orphan]
|
||||
|
@ -3290,7 +3290,7 @@ webpack x.x.x compiled successfully in X ms"
|
|||
|
||||
exports[`StatsTestCases should print correct stats for split-chunks 1`] = `
|
||||
"default:
|
||||
Entrypoint main 11.5 KiB = default/main.js
|
||||
Entrypoint main 11.4 KiB = default/main.js
|
||||
Entrypoint a 12.5 KiB = default/a.js
|
||||
Entrypoint b 3.94 KiB = default/b.js
|
||||
Entrypoint c 3.94 KiB = default/c.js
|
||||
|
@ -3354,16 +3354,16 @@ all-chunks:
|
|||
Entrypoint a 15 KiB = all-chunks/282.js 414 bytes all-chunks/954.js 414 bytes all-chunks/767.js 414 bytes all-chunks/390.js 414 bytes all-chunks/a.js 13.4 KiB
|
||||
Entrypoint b 8.14 KiB = all-chunks/282.js 414 bytes all-chunks/954.js 414 bytes all-chunks/767.js 414 bytes all-chunks/568.js 414 bytes all-chunks/b.js 6.52 KiB
|
||||
Entrypoint c 8.14 KiB = all-chunks/282.js 414 bytes all-chunks/769.js 414 bytes all-chunks/767.js 414 bytes all-chunks/568.js 414 bytes all-chunks/c.js 6.52 KiB
|
||||
chunk (runtime: b) all-chunks/b.js (b) 116 bytes (javascript) 2.77 KiB (runtime) ={282}= ={568}= ={767}= ={954}= [entry] [rendered]
|
||||
chunk (runtime: b) all-chunks/b.js (b) 116 bytes (javascript) 2.76 KiB (runtime) ={282}= ={568}= ={767}= ={954}= [entry] [rendered]
|
||||
> ./b b
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./b.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, main) all-chunks/async-g.js (async-g) 45 bytes <{282}> <{390}> <{767}> <{786}> <{794}> <{954}> ={568}= [rendered]
|
||||
> ./g ./a.js 6:0-47
|
||||
./g.js 45 bytes [built] [code generated]
|
||||
chunk (runtime: main) all-chunks/main.js (main) 147 bytes (javascript) 6.67 KiB (runtime) >{282}< >{334}< >{383}< >{390}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered]
|
||||
chunk (runtime: main) all-chunks/main.js (main) 147 bytes (javascript) 6.66 KiB (runtime) >{282}< >{334}< >{383}< >{390}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 6.67 KiB 9 modules
|
||||
runtime modules 6.66 KiB 9 modules
|
||||
./index.js 147 bytes [built] [code generated]
|
||||
chunk (runtime: a, b, c, main) all-chunks/282.js (id hint: vendors) 20 bytes <{179}> ={128}= ={334}= ={383}= ={390}= ={459}= ={568}= ={767}= ={769}= ={786}= ={794}= ={954}= >{137}< >{568}< [initial] [rendered] split chunk (cache group: defaultVendors)
|
||||
> ./a ./index.js 1:0-47
|
||||
|
@ -3383,9 +3383,9 @@ all-chunks:
|
|||
> ./a ./index.js 1:0-47
|
||||
> ./a a
|
||||
./e.js 20 bytes [built] [code generated]
|
||||
chunk (runtime: c) all-chunks/c.js (c) 116 bytes (javascript) 2.77 KiB (runtime) ={282}= ={568}= ={767}= ={769}= [entry] [rendered]
|
||||
chunk (runtime: c) all-chunks/c.js (c) 116 bytes (javascript) 2.76 KiB (runtime) ={282}= ={568}= ={767}= ={769}= [entry] [rendered]
|
||||
> ./c c
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, b, c, main) all-chunks/568.js 20 bytes <{179}> <{282}> <{390}> <{767}> <{786}> <{794}> <{954}> ={128}= ={137}= ={282}= ={334}= ={383}= ={459}= ={767}= ={769}= ={954}= [initial] [rendered] split chunk (cache group: default)
|
||||
> ./b ./index.js 2:0-47
|
||||
|
@ -3426,21 +3426,21 @@ manual:
|
|||
Entrypoint a 14.7 KiB = manual/vendors.js 1.05 KiB manual/a.js 13.7 KiB
|
||||
Entrypoint b 8.45 KiB = manual/vendors.js 1.05 KiB manual/b.js 7.4 KiB
|
||||
Entrypoint c 8.45 KiB = manual/vendors.js 1.05 KiB manual/c.js 7.4 KiB
|
||||
chunk (runtime: b) manual/b.js (b) 156 bytes (javascript) 2.77 KiB (runtime) ={216}= [entry] [rendered]
|
||||
chunk (runtime: b) manual/b.js (b) 156 bytes (javascript) 2.76 KiB (runtime) ={216}= [entry] [rendered]
|
||||
> ./b b
|
||||
> x b
|
||||
> y b
|
||||
> z b
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
dependent modules 40 bytes [dependent] 2 modules
|
||||
./b.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, main) manual/async-g.js (async-g) 65 bytes <{216}> <{786}> <{794}> [rendered]
|
||||
> ./g ./a.js 6:0-47
|
||||
dependent modules 20 bytes [dependent] 1 module
|
||||
./g.js 45 bytes [built] [code generated]
|
||||
chunk (runtime: main) manual/main.js (main) 147 bytes (javascript) 6.67 KiB (runtime) >{216}< >{334}< >{383}< >{794}< [entry] [rendered]
|
||||
chunk (runtime: main) manual/main.js (main) 147 bytes (javascript) 6.66 KiB (runtime) >{216}< >{334}< >{383}< >{794}< [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 6.67 KiB 9 modules
|
||||
runtime modules 6.66 KiB 9 modules
|
||||
./index.js 147 bytes [built] [code generated]
|
||||
chunk (runtime: a, b, c, main) manual/vendors.js (vendors) (id hint: vendors) 60 bytes <{179}> ={128}= ={334}= ={383}= ={459}= ={786}= ={794}= >{137}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors)
|
||||
> ./a ./index.js 1:0-47
|
||||
|
@ -3469,20 +3469,20 @@ manual:
|
|||
> ./c ./index.js 3:0-47
|
||||
dependent modules 40 bytes [dependent] 2 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: c) manual/c.js (c) 156 bytes (javascript) 2.77 KiB (runtime) ={216}= [entry] [rendered]
|
||||
chunk (runtime: c) manual/c.js (c) 156 bytes (javascript) 2.76 KiB (runtime) ={216}= [entry] [rendered]
|
||||
> ./c c
|
||||
> x c
|
||||
> y c
|
||||
> z c
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
dependent modules 40 bytes [dependent] 2 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a) manual/a.js (a) 205 bytes (javascript) 7.55 KiB (runtime) ={216}= >{137}< [entry] [rendered]
|
||||
chunk (runtime: a) manual/a.js (a) 205 bytes (javascript) 7.54 KiB (runtime) ={216}= >{137}< [entry] [rendered]
|
||||
> ./a a
|
||||
> x a
|
||||
> y a
|
||||
> z a
|
||||
runtime modules 7.55 KiB 10 modules
|
||||
runtime modules 7.54 KiB 10 modules
|
||||
dependent modules 20 bytes [dependent] 1 module
|
||||
./a.js + 1 modules 185 bytes [built] [code generated]
|
||||
chunk (runtime: main) manual/async-a.js (async-a) 205 bytes <{179}> ={216}= >{137}< [rendered]
|
||||
|
@ -3528,17 +3528,17 @@ name-too-long:
|
|||
> ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
> ./c cccccccccccccccccccccccccccccc
|
||||
./f.js 20 bytes [built] [code generated]
|
||||
chunk (runtime: cccccccccccccccccccccccccccccc) name-too-long/cccccccccccccccccccccccccccccc.js (cccccccccccccccccccccccccccccc) 116 bytes (javascript) 2.77 KiB (runtime) ={282}= ={568}= ={767}= ={769}= [entry] [rendered]
|
||||
chunk (runtime: cccccccccccccccccccccccccccccc) name-too-long/cccccccccccccccccccccccccccccc.js (cccccccccccccccccccccccccccccc) 116 bytes (javascript) 2.76 KiB (runtime) ={282}= ={568}= ={767}= ={769}= [entry] [rendered]
|
||||
> ./c cccccccccccccccccccccccccccccc
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) name-too-long/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) 165 bytes (javascript) 7.58 KiB (runtime) ={282}= ={390}= ={767}= ={954}= >{137}< >{568}< [entry] [rendered]
|
||||
> ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
runtime modules 7.58 KiB 10 modules
|
||||
./a.js 165 bytes [built] [code generated]
|
||||
chunk (runtime: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) name-too-long/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 116 bytes (javascript) 2.77 KiB (runtime) ={282}= ={568}= ={767}= ={954}= [entry] [rendered]
|
||||
chunk (runtime: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) name-too-long/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 116 bytes (javascript) 2.76 KiB (runtime) ={282}= ={568}= ={767}= ={954}= [entry] [rendered]
|
||||
> ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./b.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccccccc, main) name-too-long/767.js 20 bytes <{179}> ={282}= ={334}= ={383}= ={390}= ={568}= ={658}= ={751}= ={766}= ={769}= ={794}= ={954}= >{137}< >{568}< [initial] [rendered] split chunk (cache group: default)
|
||||
> ./a ./index.js 1:0-47
|
||||
|
@ -3568,16 +3568,16 @@ custom-chunks-filter:
|
|||
Entrypoint a 12.6 KiB = custom-chunks-filter/a.js
|
||||
Entrypoint b 8.14 KiB = custom-chunks-filter/282.js 414 bytes custom-chunks-filter/954.js 414 bytes custom-chunks-filter/568.js 414 bytes custom-chunks-filter/767.js 414 bytes custom-chunks-filter/b.js 6.52 KiB
|
||||
Entrypoint c 8.14 KiB = custom-chunks-filter/282.js 414 bytes custom-chunks-filter/769.js 414 bytes custom-chunks-filter/568.js 414 bytes custom-chunks-filter/767.js 414 bytes custom-chunks-filter/c.js 6.52 KiB
|
||||
chunk (runtime: b) custom-chunks-filter/b.js (b) 116 bytes (javascript) 2.77 KiB (runtime) ={282}= ={568}= ={767}= ={954}= [entry] [rendered]
|
||||
chunk (runtime: b) custom-chunks-filter/b.js (b) 116 bytes (javascript) 2.76 KiB (runtime) ={282}= ={568}= ={767}= ={954}= [entry] [rendered]
|
||||
> ./b b
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./b.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, main) custom-chunks-filter/async-g.js (async-g) 45 bytes <{282}> <{767}> <{786}> <{794}> <{954}> ={568}= [rendered]
|
||||
> ./g ./a.js 6:0-47
|
||||
./g.js 45 bytes [built] [code generated]
|
||||
chunk (runtime: main) custom-chunks-filter/main.js (main) 147 bytes (javascript) 6.68 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered]
|
||||
chunk (runtime: main) custom-chunks-filter/main.js (main) 147 bytes (javascript) 6.67 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 6.68 KiB 9 modules
|
||||
runtime modules 6.67 KiB 9 modules
|
||||
./index.js 147 bytes [built] [code generated]
|
||||
chunk (runtime: b, c, main) custom-chunks-filter/282.js (id hint: vendors) 20 bytes <{179}> ={128}= ={334}= ={383}= ={459}= ={568}= ={767}= ={769}= ={794}= ={954}= >{137}< >{568}< [initial] [rendered] split chunk (cache group: defaultVendors)
|
||||
> ./a ./index.js 1:0-47
|
||||
|
@ -3592,9 +3592,9 @@ custom-chunks-filter:
|
|||
chunk (runtime: main) custom-chunks-filter/async-c.js (async-c) 116 bytes <{179}> ={282}= ={568}= ={767}= ={769}= [rendered]
|
||||
> ./c ./index.js 3:0-47
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: c) custom-chunks-filter/c.js (c) 116 bytes (javascript) 2.77 KiB (runtime) ={282}= ={568}= ={767}= ={769}= [entry] [rendered]
|
||||
chunk (runtime: c) custom-chunks-filter/c.js (c) 116 bytes (javascript) 2.76 KiB (runtime) ={282}= ={568}= ={767}= ={769}= [entry] [rendered]
|
||||
> ./c c
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, b, c, main) custom-chunks-filter/568.js 20 bytes <{179}> <{282}> <{767}> <{786}> <{794}> <{954}> ={128}= ={137}= ={282}= ={334}= ={383}= ={459}= ={767}= ={769}= ={954}= [initial] [rendered] split chunk (cache group: default)
|
||||
> ./b ./index.js 2:0-47
|
||||
|
@ -3632,14 +3632,14 @@ custom-chunks-filter:
|
|||
custom-chunks-filter-in-cache-groups:
|
||||
Entrypoint main 11.3 KiB = custom-chunks-filter-in-cache-groups/main.js
|
||||
Entrypoint a 14.6 KiB = custom-chunks-filter-in-cache-groups/176.js 864 bytes custom-chunks-filter-in-cache-groups/a.js 13.7 KiB
|
||||
Entrypoint b 8.46 KiB = custom-chunks-filter-in-cache-groups/vendors.js 1.05 KiB custom-chunks-filter-in-cache-groups/b.js 7.4 KiB
|
||||
Entrypoint c 8.46 KiB = custom-chunks-filter-in-cache-groups/vendors.js 1.05 KiB custom-chunks-filter-in-cache-groups/c.js 7.4 KiB
|
||||
chunk (runtime: b) custom-chunks-filter-in-cache-groups/b.js (b) 156 bytes (javascript) 2.77 KiB (runtime) ={216}= [entry] [rendered]
|
||||
Entrypoint b 8.45 KiB = custom-chunks-filter-in-cache-groups/vendors.js 1.05 KiB custom-chunks-filter-in-cache-groups/b.js 7.4 KiB
|
||||
Entrypoint c 8.45 KiB = custom-chunks-filter-in-cache-groups/vendors.js 1.05 KiB custom-chunks-filter-in-cache-groups/c.js 7.4 KiB
|
||||
chunk (runtime: b) custom-chunks-filter-in-cache-groups/b.js (b) 156 bytes (javascript) 2.76 KiB (runtime) ={216}= [entry] [rendered]
|
||||
> ./b b
|
||||
> x b
|
||||
> y b
|
||||
> z b
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
dependent modules 40 bytes [dependent] 2 modules
|
||||
./b.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a, main) custom-chunks-filter-in-cache-groups/async-g.js (async-g) 65 bytes <{176}> <{216}> <{786}> <{794}> [rendered]
|
||||
|
@ -3681,20 +3681,20 @@ custom-chunks-filter-in-cache-groups:
|
|||
> ./c ./index.js 3:0-47
|
||||
dependent modules 40 bytes [dependent] 2 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: c) custom-chunks-filter-in-cache-groups/c.js (c) 156 bytes (javascript) 2.77 KiB (runtime) ={216}= [entry] [rendered]
|
||||
chunk (runtime: c) custom-chunks-filter-in-cache-groups/c.js (c) 156 bytes (javascript) 2.76 KiB (runtime) ={216}= [entry] [rendered]
|
||||
> ./c c
|
||||
> x c
|
||||
> y c
|
||||
> z c
|
||||
runtime modules 2.77 KiB 4 modules
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
dependent modules 40 bytes [dependent] 2 modules
|
||||
./c.js 116 bytes [built] [code generated]
|
||||
chunk (runtime: a) custom-chunks-filter-in-cache-groups/a.js (a) 205 bytes (javascript) 7.58 KiB (runtime) ={176}= >{137}< [entry] [rendered]
|
||||
chunk (runtime: a) custom-chunks-filter-in-cache-groups/a.js (a) 205 bytes (javascript) 7.57 KiB (runtime) ={176}= >{137}< [entry] [rendered]
|
||||
> ./a a
|
||||
> x a
|
||||
> y a
|
||||
> z a
|
||||
runtime modules 7.58 KiB 10 modules
|
||||
runtime modules 7.57 KiB 10 modules
|
||||
dependent modules 20 bytes [dependent] 1 module
|
||||
./a.js + 1 modules 185 bytes [built] [code generated]
|
||||
chunk (runtime: main) custom-chunks-filter-in-cache-groups/async-a.js (async-a) 205 bytes <{179}> ={216}= >{137}< [rendered]
|
||||
|
@ -3745,9 +3745,9 @@ production (webpack x.x.x) compiled successfully"
|
|||
|
||||
exports[`StatsTestCases should print correct stats for split-chunks-chunk-name 1`] = `
|
||||
"Entrypoint main 11.2 KiB = default/main.js
|
||||
chunk (runtime: main) default/main.js (main) 192 bytes (javascript) 6.64 KiB (runtime) >{334}< >{709}< >{794}< [entry] [rendered]
|
||||
chunk (runtime: main) default/main.js (main) 192 bytes (javascript) 6.63 KiB (runtime) >{334}< >{709}< >{794}< [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 6.64 KiB 9 modules
|
||||
runtime modules 6.63 KiB 9 modules
|
||||
./index.js 192 bytes [built] [code generated]
|
||||
chunk (runtime: main) default/async-b.js (async-b) (id hint: vendors) 122 bytes <{179}> [rendered] reused as split chunk (cache group: defaultVendors)
|
||||
> b ./index.js 2:0-45
|
||||
|
@ -3763,7 +3763,7 @@ webpack x.x.x compiled successfully"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for split-chunks-combinations 1`] = `
|
||||
"Entrypoint main 11.7 KiB = main.js
|
||||
"Entrypoint main 11.6 KiB = main.js
|
||||
chunk (runtime: main) async-d.js (async-d) 132 bytes <{179}> [rendered]
|
||||
> ./d ./index.js 4:0-47
|
||||
dependent modules 87 bytes [dependent] 1 module
|
||||
|
@ -3851,7 +3851,7 @@ default (webpack x.x.x) compiled successfully"
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for split-chunks-issue-7401 1`] = `
|
||||
"Entrypoint a 6.43 KiB = 282.js 414 bytes a.js 6.02 KiB
|
||||
"Entrypoint a 6.42 KiB = 282.js 414 bytes a.js 6.02 KiB
|
||||
Entrypoint b 10.9 KiB = b.js
|
||||
Chunk Group c 797 bytes = 282.js 414 bytes c.js 383 bytes
|
||||
chunk (runtime: b) b.js (b) 43 bytes (javascript) 6.59 KiB (runtime) >{282}< >{459}< [entry] [rendered]
|
||||
|
@ -3865,9 +3865,9 @@ chunk (runtime: a, b) 282.js (id hint: vendors) 20 bytes <{128}> ={459}= ={786}=
|
|||
chunk (runtime: b) c.js (c) 35 bytes <{128}> ={282}= [rendered]
|
||||
> ./c ./b.js 1:0-41
|
||||
./c.js 35 bytes [built] [code generated]
|
||||
chunk (runtime: a) a.js (a) 35 bytes (javascript) 2.76 KiB (runtime) ={282}= [entry] [rendered]
|
||||
chunk (runtime: a) a.js (a) 35 bytes (javascript) 2.75 KiB (runtime) ={282}= [entry] [rendered]
|
||||
> ./a a
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./a.js 35 bytes [built] [code generated]
|
||||
default (webpack x.x.x) compiled successfully"
|
||||
`;
|
||||
|
@ -3967,9 +3967,9 @@ exports[`StatsTestCases should print correct stats for split-chunks-max-size 1`]
|
|||
> ./ main
|
||||
./big.js?1 267 bytes [built] [code generated]
|
||||
./big.js?2 267 bytes [built] [code generated]
|
||||
chunk (runtime: main) prod-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.02 KiB (runtime) ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={869}= [entry] [rendered]
|
||||
chunk (runtime: main) prod-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.01 KiB (runtime) ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={869}= [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 3.02 KiB 5 modules
|
||||
runtime modules 3.01 KiB 5 modules
|
||||
./very-big.js?1 1.57 KiB [built] [code generated]
|
||||
chunk (runtime: main) prod-869.js (id hint: vendors) 399 bytes ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={663}= [initial] [rendered] split chunk (cache group: defaultVendors)
|
||||
> ./ main
|
||||
|
@ -4075,9 +4075,9 @@ switched:
|
|||
> ./ main
|
||||
modules by path ./subfolder/*.js 1.1 KiB 11 modules
|
||||
modules by path ./*.js 594 bytes 9 modules
|
||||
chunk (runtime: main) switched-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.02 KiB (runtime) ={1}= ={59}= ={318}= ={410}= ={520}= ={581}= ={869}= ={997}= [entry] [rendered]
|
||||
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.02 KiB 5 modules
|
||||
runtime modules 3.01 KiB 5 modules
|
||||
./very-big.js?1 1.57 KiB [built] [code generated]
|
||||
chunk (runtime: main) switched-869.js (id hint: vendors) 399 bytes ={1}= ={59}= ={318}= ={410}= ={520}= ={581}= ={663}= ={997}= [initial] [rendered] split chunk (cache group: defaultVendors)
|
||||
> ./ main
|
||||
|
@ -4174,9 +4174,9 @@ zero-min:
|
|||
> ./ main
|
||||
./big.js?1 267 bytes [built] [code generated]
|
||||
./big.js?2 267 bytes [built] [code generated]
|
||||
chunk (runtime: main) zero-min-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.02 KiB (runtime) ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={869}= [entry] [rendered]
|
||||
chunk (runtime: main) zero-min-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.01 KiB (runtime) ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={869}= [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 3.02 KiB 5 modules
|
||||
runtime modules 3.01 KiB 5 modules
|
||||
./very-big.js?1 1.57 KiB [built] [code generated]
|
||||
chunk (runtime: main) zero-min-869.js (id hint: vendors) 399 bytes ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={663}= [initial] [rendered] split chunk (cache group: defaultVendors)
|
||||
> ./ main
|
||||
|
@ -4187,9 +4187,9 @@ zero-min:
|
|||
|
||||
max-async-size:
|
||||
Entrypoint main 15.9 KiB = max-async-size-main.js
|
||||
chunk (runtime: main) max-async-size-main.js (main) 2.46 KiB (javascript) 6.95 KiB (runtime) >{342}< >{385}< >{820}< >{920}< [entry] [rendered]
|
||||
chunk (runtime: main) max-async-size-main.js (main) 2.46 KiB (javascript) 6.94 KiB (runtime) >{342}< >{385}< >{820}< >{920}< [entry] [rendered]
|
||||
> ./async main
|
||||
runtime modules 6.95 KiB 10 modules
|
||||
runtime modules 6.94 KiB 10 modules
|
||||
dependent modules 2.09 KiB [dependent] 6 modules
|
||||
./async/index.js 386 bytes [built] [code generated]
|
||||
chunk (runtime: main) max-async-size-async-b-77a8c116.js (async-b-77a8c116) 1.57 KiB <{179}> ={385}= ={820}= ={920}= [rendered]
|
||||
|
@ -4218,9 +4218,9 @@ enforce-min-size:
|
|||
chunk (runtime: main) enforce-min-size-10.js (id hint: all) 1.19 KiB ={179}= ={221}= ={262}= ={410}= ={434}= ={463}= ={519}= ={575}= ={614}= ={692}= ={822}= ={825}= ={869}= [initial] [rendered] split chunk (cache group: all)
|
||||
> ./ main
|
||||
./index.js 1.19 KiB [built] [code generated]
|
||||
chunk (runtime: main) enforce-min-size-main.js (main) 3.02 KiB ={10}= ={221}= ={262}= ={410}= ={434}= ={463}= ={519}= ={575}= ={614}= ={692}= ={822}= ={825}= ={869}= [entry] [rendered]
|
||||
chunk (runtime: main) enforce-min-size-main.js (main) 3.01 KiB ={10}= ={221}= ={262}= ={410}= ={434}= ={463}= ={519}= ={575}= ={614}= ={692}= ={822}= ={825}= ={869}= [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 3.02 KiB 5 modules
|
||||
runtime modules 3.01 KiB 5 modules
|
||||
chunk (runtime: main) enforce-min-size-221.js (id hint: all) 1.57 KiB ={10}= ={179}= ={262}= ={410}= ={434}= ={463}= ={519}= ={575}= ={614}= ={692}= ={822}= ={825}= ={869}= [initial] [rendered] split chunk (cache group: all)
|
||||
> ./ main
|
||||
./very-big.js?3 1.57 KiB [built] [code generated]
|
||||
|
@ -4306,9 +4306,9 @@ exports[`StatsTestCases should print correct stats for split-chunks-min-size-red
|
|||
chunk (runtime: main) default/async-d.js (async-d) 50 bytes <{179}> ={821}= [rendered]
|
||||
> ./d ./index.js 4:0-47
|
||||
./d.js 50 bytes [built] [code generated]
|
||||
chunk (runtime: main) default/main.js (main) 245 bytes (javascript) 6.68 KiB (runtime) >{31}< >{334}< >{383}< >{449}< >{794}< >{821}< [entry] [rendered]
|
||||
chunk (runtime: main) default/main.js (main) 245 bytes (javascript) 6.67 KiB (runtime) >{31}< >{334}< >{383}< >{449}< >{794}< >{821}< [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 6.68 KiB 9 modules
|
||||
runtime modules 6.67 KiB 9 modules
|
||||
./index.js 245 bytes [built] [code generated]
|
||||
chunk (runtime: main) default/async-b.js (async-b) 176 bytes <{179}> [rendered]
|
||||
> ./b ./index.js 2:0-47
|
||||
|
@ -4339,9 +4339,9 @@ chunk (runtime: main) default/118.js 150 bytes <{179}> ={334}= ={383}= [rendered
|
|||
> ./c ./index.js 3:0-47
|
||||
./d.js 63 bytes [built] [code generated]
|
||||
./f.js 87 bytes [built] [code generated]
|
||||
chunk (runtime: main) default/main.js (main) 147 bytes (javascript) 6.65 KiB (runtime) >{118}< >{334}< >{383}< >{794}< [entry] [rendered]
|
||||
chunk (runtime: main) default/main.js (main) 147 bytes (javascript) 6.64 KiB (runtime) >{118}< >{334}< >{383}< >{794}< [entry] [rendered]
|
||||
> ./ main
|
||||
runtime modules 6.65 KiB 9 modules
|
||||
runtime modules 6.64 KiB 9 modules
|
||||
./index.js 147 bytes [built] [code generated]
|
||||
chunk (runtime: main) default/async-b.js (async-b) 158 bytes <{179}> ={118}= [rendered]
|
||||
> ./b ./index.js 2:0-47
|
||||
|
@ -4364,15 +4364,15 @@ exports[`StatsTestCases should print correct stats for split-chunks-runtime-spec
|
|||
asset used-exports-332.js 424 bytes [emitted]
|
||||
asset used-exports-a.js 257 bytes [emitted] (name: a)
|
||||
Entrypoint a 257 bytes = used-exports-a.js
|
||||
Entrypoint b 6.45 KiB = used-exports-332.js 424 bytes used-exports-b.js 6.03 KiB
|
||||
Entrypoint b 6.44 KiB = used-exports-332.js 424 bytes used-exports-b.js 6.03 KiB
|
||||
Entrypoint c 6.45 KiB = used-exports-332.js 424 bytes used-exports-c.js 6.04 KiB
|
||||
chunk (runtime: b) used-exports-b.js (b) 54 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
chunk (runtime: b) used-exports-b.js (b) 54 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./b.js 54 bytes [built] [code generated]
|
||||
chunk (runtime: b, c) used-exports-332.js 72 bytes [initial] [rendered] split chunk (cache group: default)
|
||||
./objects.js 72 bytes [built] [code generated]
|
||||
chunk (runtime: c) used-exports-c.js (c) 59 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
chunk (runtime: c) used-exports-c.js (c) 59 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./c.js 59 bytes [built] [code generated]
|
||||
chunk (runtime: a) used-exports-a.js (a) 126 bytes [entry] [rendered]
|
||||
./a.js + 1 modules 126 bytes [built] [code generated]
|
||||
|
@ -4385,17 +4385,17 @@ no-used-exports:
|
|||
asset no-used-exports-332.js 447 bytes [emitted]
|
||||
Entrypoint a 6.47 KiB = no-used-exports-332.js 447 bytes no-used-exports-a.js 6.03 KiB
|
||||
Entrypoint b 6.47 KiB = no-used-exports-332.js 447 bytes no-used-exports-b.js 6.03 KiB
|
||||
Entrypoint c 6.48 KiB = no-used-exports-332.js 447 bytes no-used-exports-c.js 6.04 KiB
|
||||
chunk (runtime: b) no-used-exports-b.js (b) 54 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
Entrypoint c 6.47 KiB = no-used-exports-332.js 447 bytes no-used-exports-c.js 6.04 KiB
|
||||
chunk (runtime: b) no-used-exports-b.js (b) 54 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./b.js 54 bytes [built] [code generated]
|
||||
chunk (runtime: a, b, c) no-used-exports-332.js 72 bytes [initial] [rendered] split chunk (cache group: default)
|
||||
./objects.js 72 bytes [built] [code generated]
|
||||
chunk (runtime: c) no-used-exports-c.js (c) 59 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
chunk (runtime: c) no-used-exports-c.js (c) 59 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./c.js 59 bytes [built] [code generated]
|
||||
chunk (runtime: a) no-used-exports-a.js (a) 54 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
chunk (runtime: a) no-used-exports-a.js (a) 54 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./a.js 54 bytes [built] [code generated]
|
||||
no-used-exports (webpack x.x.x) compiled successfully in X ms
|
||||
|
||||
|
@ -4406,17 +4406,17 @@ global:
|
|||
asset global-332.js 447 bytes [emitted]
|
||||
Entrypoint a 6.47 KiB = global-332.js 447 bytes global-a.js 6.03 KiB
|
||||
Entrypoint b 6.47 KiB = global-332.js 447 bytes global-b.js 6.03 KiB
|
||||
Entrypoint c 6.48 KiB = global-332.js 447 bytes global-c.js 6.04 KiB
|
||||
chunk (runtime: b) global-b.js (b) 54 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
Entrypoint c 6.47 KiB = global-332.js 447 bytes global-c.js 6.04 KiB
|
||||
chunk (runtime: b) global-b.js (b) 54 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./b.js 54 bytes [built] [code generated]
|
||||
chunk (runtime: a, b, c) global-332.js 72 bytes [initial] [rendered] split chunk (cache group: default)
|
||||
./objects.js 72 bytes [built] [code generated]
|
||||
chunk (runtime: c) global-c.js (c) 59 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
chunk (runtime: c) global-c.js (c) 59 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./c.js 59 bytes [built] [code generated]
|
||||
chunk (runtime: a) global-a.js (a) 54 bytes (javascript) 2.76 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.76 KiB 4 modules
|
||||
chunk (runtime: a) global-a.js (a) 54 bytes (javascript) 2.75 KiB (runtime) [entry] [rendered]
|
||||
runtime modules 2.75 KiB 4 modules
|
||||
./a.js 54 bytes [built] [code generated]
|
||||
global (webpack x.x.x) compiled successfully in X ms"
|
||||
`;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import * as style from "./style.css";
|
||||
|
||||
it("should compile and load style on demand", done => {
|
||||
expect(style).toEqual(nsObj({}));
|
||||
import("./style2.css").then(x => {
|
||||
expect(x).toEqual(nsObj({}));
|
||||
const style = getComputedStyle(document.body);
|
||||
expect(style.getPropertyValue("background")).toBe(" red");
|
||||
expect(style.getPropertyValue("margin")).toBe(" 10px");
|
||||
expect(style.getPropertyValue("color")).toBe(" green");
|
||||
expect(style.getPropertyValue("padding")).toBe(" 20px 10px");
|
||||
done();
|
||||
}, done);
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
margin: 10px;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
@import "style-imported.css";
|
||||
body {
|
||||
background: red;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
padding: 20px 10px;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
@import "./style2-imported.css";
|
||||
body {
|
||||
color: green;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
moduleScope(scope) {
|
||||
const link = scope.window.document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
link.href = "bundle0.css";
|
||||
scope.window.document.head.appendChild(link);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "web",
|
||||
mode: "development",
|
||||
experiments: {
|
||||
css: true
|
||||
}
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
color: a;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
color: b;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
color: c;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
color: d;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
color: e;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
it("should lead to conflicting order warning", done => {
|
||||
__non_webpack_require__("./lazy4_js.bundle0.js");
|
||||
Promise.all([
|
||||
import("./lazy1.css"),
|
||||
import("./lazy2.css"),
|
||||
import("./lazy3.css"),
|
||||
import("./lazy4.js")
|
||||
]).then(() => {
|
||||
try {
|
||||
const matches = fs
|
||||
.readFileSync(path.join(__dirname, "css.bundle0.css"), "utf-8")
|
||||
.match(/color: ([a-z0-9])/g)
|
||||
.map(match => match[7]);
|
||||
expect(matches).toEqual("bcdea123".split(""));
|
||||
done();
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
}, done);
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
@import "b.css";
|
||||
@import "c.css";
|
||||
@import "a.css";
|
||||
|
||||
body {
|
||||
color: 1;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
@import "c.css";
|
||||
@import "b.css";
|
||||
@import "a.css";
|
||||
|
||||
body {
|
||||
color: 2;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
@import "d.css";
|
||||
@import "a.css";
|
||||
|
||||
body {
|
||||
color: 3;
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
import "./e.css";
|
||||
import "./a.css";
|
|
@ -0,0 +1 @@
|
|||
module.exports = [[/Conflicting order between \.\/b\.css and \.\/c\.css/]];
|
|
@ -0,0 +1,25 @@
|
|||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "web",
|
||||
mode: "development",
|
||||
experiments: {
|
||||
css: true
|
||||
},
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
css: {
|
||||
type: "css",
|
||||
enforce: true,
|
||||
name: "css"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
externalsPresets: {
|
||||
node: true
|
||||
},
|
||||
node: {
|
||||
__dirname: false
|
||||
}
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
const prod = process.env.NODE_ENV === "production";
|
||||
|
||||
it("should allow to create css modules", done => {
|
||||
prod
|
||||
? __non_webpack_require__("./249.bundle1.js")
|
||||
: __non_webpack_require__("./use-style_js.bundle0.js");
|
||||
import("./use-style.js").then(({ default: x }) => {
|
||||
try {
|
||||
expect(x).toEqual({
|
||||
global: undefined,
|
||||
class: prod ? "my-app-491-S" : "./style.module.css-class",
|
||||
local: prod
|
||||
? "my-app-491-Zw my-app-491-yl my-app-491-J_ my-app-491-gc"
|
||||
: "./style.module.css-local1 ./style.module.css-local2 ./style.module.css-local3 ./style.module.css-local4",
|
||||
local2: prod
|
||||
? "my-app-491-Xg my-app-491-AY"
|
||||
: "./style.module.css-local5 ./style.module.css-local6",
|
||||
nested: prod
|
||||
? "my-app-491-RX undefined my-app-491-X2"
|
||||
: "./style.module.css-nested1 undefined ./style.module.css-nested3",
|
||||
ident: prod ? "my-app-491-yR" : "./style.module.css-ident",
|
||||
keyframes: prod ? "my-app-491-y3" : "./style.module.css-localkeyframes",
|
||||
animation: prod ? "my-app-491-oQ" : "./style.module.css-animation",
|
||||
vars: prod
|
||||
? "--my-app-491-y4 my-app-491-gR undefined my-app-491-xk"
|
||||
: "--./style.module.css-local-color ./style.module.css-vars undefined ./style.module.css-globalVars"
|
||||
});
|
||||
} catch (e) {
|
||||
return done(e);
|
||||
}
|
||||
done();
|
||||
}, done);
|
||||
});
|
|
@ -0,0 +1,71 @@
|
|||
.class {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.local1,
|
||||
.local2 :global .global,
|
||||
.local3 {
|
||||
color: green;
|
||||
}
|
||||
|
||||
:global .global :local .local4 {
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.local5:global(.global).local6 {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
:global(:global(:local(.nested1)).nested2).nested3 {
|
||||
color: pink;
|
||||
}
|
||||
|
||||
#ident {
|
||||
color: purple;
|
||||
}
|
||||
|
||||
@keyframes localkeyframes {
|
||||
0% {
|
||||
left: var(--pos1x);
|
||||
top: var(--pos1y);
|
||||
color: var(--theme-color1);
|
||||
}
|
||||
100% {
|
||||
left: var(--pos2x);
|
||||
top: var(--pos2y);
|
||||
color: var(--theme-color2);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes localkeyframes2 {
|
||||
0% {
|
||||
left: 0;
|
||||
}
|
||||
100% {
|
||||
left: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.animation {
|
||||
animation-name: localkeyframes;
|
||||
animation: 3s ease-in 1s 2 reverse both paused localkeyframes, localkeyframes2;
|
||||
--pos1x: 0px;
|
||||
--pos1y: 0px;
|
||||
--pos2x: 10px;
|
||||
--pos2y: 20px;
|
||||
}
|
||||
|
||||
/* .composed {
|
||||
composes: local1;
|
||||
composes: local2;
|
||||
} */
|
||||
|
||||
.vars {
|
||||
color: var(--local-color);
|
||||
--local-color: red;
|
||||
}
|
||||
|
||||
.globalVars :global {
|
||||
color: var(--global-color);
|
||||
--global-color: red;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import * as style from "./style.module.css";
|
||||
import { local1, local2, local3, local4, ident } from "./style.module.css";
|
||||
|
||||
export default {
|
||||
global: style.global,
|
||||
class: style.class,
|
||||
local: `${local1} ${local2} ${local3} ${local4}`,
|
||||
local2: `${style.local5} ${style.local6}`,
|
||||
nested: `${style.nested1} ${style.nested2} ${style.nested3}`,
|
||||
ident,
|
||||
keyframes: style.localkeyframes,
|
||||
animation: style.animation,
|
||||
vars: `${style["local-color"]} ${style.vars} ${style["global-color"]} ${style.globalVars}`
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = [
|
||||
[/export 'global' \(imported as 'style'\) was not found/],
|
||||
[/export 'nested2' \(imported as 'style'\) was not found/],
|
||||
[/export 'global-color' \(imported as 'style'\) was not found/],
|
||||
[/export 'global' \(imported as 'style'\) was not found/],
|
||||
[/export 'nested2' \(imported as 'style'\) was not found/],
|
||||
[/export 'global-color' \(imported as 'style'\) was not found/]
|
||||
];
|
|
@ -0,0 +1,20 @@
|
|||
/** @type {import("../../../../").Configuration[]} */
|
||||
module.exports = [
|
||||
{
|
||||
target: "web",
|
||||
mode: "development",
|
||||
experiments: {
|
||||
css: true
|
||||
}
|
||||
},
|
||||
{
|
||||
target: "web",
|
||||
mode: "production",
|
||||
output: {
|
||||
uniqueName: "my-app"
|
||||
},
|
||||
experiments: {
|
||||
css: true
|
||||
}
|
||||
}
|
||||
];
|
|
@ -0,0 +1,3 @@
|
|||
import * as style from "./style.module.css?imported";
|
||||
|
||||
export default Object(style);
|
|
@ -0,0 +1,57 @@
|
|||
it("should allow to dynamic import a css module", done => {
|
||||
import("./style.module.css").then(x => {
|
||||
try {
|
||||
expect(x).toEqual(
|
||||
nsObj({
|
||||
a: "a",
|
||||
abc: "a b c",
|
||||
comments: "abc def",
|
||||
"white space": "abc\n\tdef",
|
||||
default: "default"
|
||||
})
|
||||
);
|
||||
} catch (e) {
|
||||
return done(e);
|
||||
}
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
|
||||
it("should allow to reexport a css module", done => {
|
||||
__non_webpack_require__("./reexported_js.bundle0.js");
|
||||
import("./reexported").then(x => {
|
||||
try {
|
||||
expect(x).toEqual(
|
||||
nsObj({
|
||||
a: "a",
|
||||
abc: "a b c",
|
||||
comments: "abc def",
|
||||
"white space": "abc\n\tdef"
|
||||
})
|
||||
);
|
||||
} catch (e) {
|
||||
return done(e);
|
||||
}
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
|
||||
it("should allow to import a css module", done => {
|
||||
__non_webpack_require__("./imported_js.bundle0.js");
|
||||
import("./imported").then(({ default: x }) => {
|
||||
try {
|
||||
expect(x).toEqual(
|
||||
nsObj({
|
||||
a: "a",
|
||||
abc: "a b c",
|
||||
comments: "abc def",
|
||||
"white space": "abc\n\tdef",
|
||||
default: "default"
|
||||
})
|
||||
);
|
||||
} catch (e) {
|
||||
return done(e);
|
||||
}
|
||||
done();
|
||||
}, done);
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
export * from "./style.module.css?reexported";
|
|
@ -0,0 +1,25 @@
|
|||
:export {
|
||||
a: a;
|
||||
}
|
||||
|
||||
:export {
|
||||
abc: a b c;
|
||||
comments: abc/****/ /* hello world *//****/ def
|
||||
}
|
||||
|
||||
:export
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
white space
|
||||
|
||||
:
|
||||
|
||||
abc
|
||||
def
|
||||
|
||||
}
|
||||
|
||||
:export{default:default}
|
|
@ -0,0 +1,8 @@
|
|||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
target: "web",
|
||||
mode: "development",
|
||||
experiments: {
|
||||
css: true
|
||||
}
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue