@swissquote/crafty-preset-lightningcss 1.28.1 → 1.29.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/webpack-packages/bundled.js +350 -275
- package/dist/webpack-packages/webpack-packages.js.map +1 -1
- package/package.json +10 -10
- package/src/index.js +29 -3
- package/src/webpack-utils.js +44 -28
|
@@ -29,7 +29,7 @@ var _semver = __nccwpck_require__(1279);
|
|
|
29
29
|
var _options = _interopRequireDefault(__nccwpck_require__(2149));
|
|
30
30
|
var _plugins = __nccwpck_require__(7753);
|
|
31
31
|
var _utils = __nccwpck_require__(3579);
|
|
32
|
-
function _interopRequireDefault(
|
|
32
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
33
33
|
/*
|
|
34
34
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
35
35
|
Author Tobias Koppers @sokra
|
|
@@ -228,7 +228,7 @@ Object.defineProperty(exports, "urlParser", ({
|
|
|
228
228
|
var _postcssImportParser = _interopRequireDefault(__nccwpck_require__(386));
|
|
229
229
|
var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(571));
|
|
230
230
|
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(8046));
|
|
231
|
-
function _interopRequireDefault(
|
|
231
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
232
232
|
|
|
233
233
|
/***/ }),
|
|
234
234
|
|
|
@@ -364,7 +364,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
364
364
|
exports["default"] = void 0;
|
|
365
365
|
var _postcssValueParser = _interopRequireDefault(__nccwpck_require__(1787));
|
|
366
366
|
var _utils = __nccwpck_require__(3579);
|
|
367
|
-
function _interopRequireDefault(
|
|
367
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
368
368
|
function isIgnoredAfterName(atRule) {
|
|
369
369
|
if (atRule.raws && atRule.raws.afterName && atRule.raws.afterName.trim().length > 0) {
|
|
370
370
|
const lastCommentIndex = atRule.raws.afterName.lastIndexOf("/*");
|
|
@@ -664,7 +664,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
664
664
|
exports["default"] = void 0;
|
|
665
665
|
var _postcssValueParser = _interopRequireDefault(__nccwpck_require__(1787));
|
|
666
666
|
var _utils = __nccwpck_require__(3579);
|
|
667
|
-
function _interopRequireDefault(
|
|
667
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
668
668
|
const isUrlFunc = /url/i;
|
|
669
669
|
const isImageSetFunc = /^(?:-webkit-)?image-set$/i;
|
|
670
670
|
const needParseDeclaration = /(?:url|(?:-webkit-)?image-set)\(/i;
|
|
@@ -1057,7 +1057,7 @@ var _postcssModulesValues = _interopRequireDefault(__nccwpck_require__(731));
|
|
|
1057
1057
|
var _postcssModulesLocalByDefault = _interopRequireDefault(__nccwpck_require__(9714));
|
|
1058
1058
|
var _postcssModulesExtractImports = _interopRequireDefault(__nccwpck_require__(8931));
|
|
1059
1059
|
var _postcssModulesScope = _interopRequireDefault(__nccwpck_require__(7973));
|
|
1060
|
-
function _interopRequireDefault(
|
|
1060
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1061
1061
|
/*
|
|
1062
1062
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
1063
1063
|
Author Tobias Koppers @sokra
|
|
@@ -1304,8 +1304,10 @@ function defaultGetLocalIdent(loaderContext, localIdentName, localName, options)
|
|
|
1304
1304
|
}
|
|
1305
1305
|
let localIdentHash = "";
|
|
1306
1306
|
for (let tier = 0; localIdentHash.length < hashDigestLength; tier++) {
|
|
1307
|
+
const hash = (loaderContext.utils.createHash ||
|
|
1308
|
+
// TODO remove in the next major release
|
|
1307
1309
|
// eslint-disable-next-line no-underscore-dangle
|
|
1308
|
-
|
|
1310
|
+
loaderContext._compiler.webpack.util.createHash)(hashFunction);
|
|
1309
1311
|
if (hashSalt) {
|
|
1310
1312
|
hash.update(hashSalt);
|
|
1311
1313
|
}
|
|
@@ -1449,11 +1451,6 @@ function getModulesOptions(rawOptions, esModule, exportType, loaderContext) {
|
|
|
1449
1451
|
auto
|
|
1450
1452
|
} = rawModulesOptions);
|
|
1451
1453
|
}
|
|
1452
|
-
|
|
1453
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
1454
|
-
const {
|
|
1455
|
-
outputOptions
|
|
1456
|
-
} = loaderContext._compilation;
|
|
1457
1454
|
const needNamedExport = exportType === "css-style-sheet" || exportType === "string";
|
|
1458
1455
|
const namedExport = typeof rawModulesOptions.namedExport !== "undefined" ? rawModulesOptions.namedExport : needNamedExport || esModule;
|
|
1459
1456
|
const exportLocalsConvention = typeof rawModulesOptions.exportLocalsConvention !== "undefined" ? rawModulesOptions.exportLocalsConvention : namedExport ? "as-is" : "camel-case-only";
|
|
@@ -1463,10 +1460,23 @@ function getModulesOptions(rawOptions, esModule, exportType, loaderContext) {
|
|
|
1463
1460
|
exportGlobals: false,
|
|
1464
1461
|
localIdentName: "[hash:base64]",
|
|
1465
1462
|
localIdentContext: loaderContext.rootContext,
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1463
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
1464
|
+
localIdentHashSalt: loaderContext.hashSalt ||
|
|
1465
|
+
// TODO remove in the next major release
|
|
1466
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
1467
|
+
loaderContext._compilation.outputOptions.hashSalt,
|
|
1468
|
+
localIdentHashFunction: loaderContext.hashFunction ||
|
|
1469
|
+
// TODO remove in the next major release
|
|
1470
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
1471
|
+
loaderContext._compilation.outputOptions.hashFunction,
|
|
1472
|
+
localIdentHashDigest: loaderContext.hashDigest ||
|
|
1473
|
+
// TODO remove in the next major release
|
|
1474
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
1475
|
+
loaderContext._compilation.outputOptions.hashDigest,
|
|
1476
|
+
localIdentHashDigestLength: loaderContext.hashDigestLength ||
|
|
1477
|
+
// TODO remove in the next major release
|
|
1478
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
1479
|
+
loaderContext._compilation.outputOptions.hashDigestLength,
|
|
1470
1480
|
// eslint-disable-next-line no-undefined
|
|
1471
1481
|
localIdentRegExp: undefined,
|
|
1472
1482
|
// eslint-disable-next-line no-undefined
|
|
@@ -1859,7 +1869,7 @@ function dashesCamelCase(str) {
|
|
|
1859
1869
|
return str.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase());
|
|
1860
1870
|
}
|
|
1861
1871
|
const validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/u;
|
|
1862
|
-
const keywords = new Set(["abstract", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with"]);
|
|
1872
|
+
const keywords = new Set(["abstract", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with", "module"]);
|
|
1863
1873
|
function getExportCode(exports, replacements, icssPluginUsed, options, isTemplateLiteralSupported) {
|
|
1864
1874
|
let code = "// Exports\n";
|
|
1865
1875
|
if (icssPluginUsed) {
|
|
@@ -2434,7 +2444,7 @@ module.exports = replaceValueSymbols;
|
|
|
2434
2444
|
|
|
2435
2445
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2436
2446
|
exports.LightningCssMinifyPlugin = void 0;
|
|
2437
|
-
|
|
2447
|
+
const loader_1 = __nccwpck_require__(4461);
|
|
2438
2448
|
var minify_1 = __nccwpck_require__(5476);
|
|
2439
2449
|
Object.defineProperty(exports, "LightningCssMinifyPlugin", ({ enumerable: true, get: function () { return minify_1.LightningCssMinifyPlugin; } }));
|
|
2440
2450
|
exports["default"] = loader_1.LightningCssLoader;
|
|
@@ -2453,7 +2463,7 @@ var ECacheKey;
|
|
|
2453
2463
|
(function (ECacheKey) {
|
|
2454
2464
|
ECacheKey["loader"] = "loader";
|
|
2455
2465
|
ECacheKey["minify"] = "minify";
|
|
2456
|
-
})(ECacheKey
|
|
2466
|
+
})(ECacheKey || (exports.ECacheKey = ECacheKey = {}));
|
|
2457
2467
|
|
|
2458
2468
|
|
|
2459
2469
|
/***/ }),
|
|
@@ -2463,17 +2473,6 @@ var ECacheKey;
|
|
|
2463
2473
|
|
|
2464
2474
|
"use strict";
|
|
2465
2475
|
|
|
2466
|
-
var __assign = (this && this.__assign) || function () {
|
|
2467
|
-
__assign = Object.assign || function(t) {
|
|
2468
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2469
|
-
s = arguments[i];
|
|
2470
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
2471
|
-
t[p] = s[p];
|
|
2472
|
-
}
|
|
2473
|
-
return t;
|
|
2474
|
-
};
|
|
2475
|
-
return __assign.apply(this, arguments);
|
|
2476
|
-
};
|
|
2477
2476
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2478
2477
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2479
2478
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -2483,33 +2482,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
2483
2482
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2484
2483
|
});
|
|
2485
2484
|
};
|
|
2486
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
2487
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2488
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2489
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2490
|
-
function step(op) {
|
|
2491
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2492
|
-
while (_) try {
|
|
2493
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2494
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2495
|
-
switch (op[0]) {
|
|
2496
|
-
case 0: case 1: t = op; break;
|
|
2497
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
2498
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2499
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2500
|
-
default:
|
|
2501
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2502
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2503
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2504
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2505
|
-
if (t[2]) _.ops.pop();
|
|
2506
|
-
_.trys.pop(); continue;
|
|
2507
|
-
}
|
|
2508
|
-
op = body.call(thisArg, _);
|
|
2509
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2510
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2511
|
-
}
|
|
2512
|
-
};
|
|
2513
2485
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2514
2486
|
var t = {};
|
|
2515
2487
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -2521,39 +2493,73 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
2521
2493
|
}
|
|
2522
2494
|
return t;
|
|
2523
2495
|
};
|
|
2496
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2497
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2498
|
+
};
|
|
2524
2499
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2525
|
-
exports.LightningCssLoader =
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2500
|
+
exports.LightningCssLoader = LightningCssLoader;
|
|
2501
|
+
const interface_1 = __nccwpck_require__(1959);
|
|
2502
|
+
const lightningcss_1 = __importDefault(__nccwpck_require__(9446));
|
|
2503
|
+
const buffer_1 = __nccwpck_require__(181);
|
|
2504
|
+
const utils_1 = __nccwpck_require__(4753);
|
|
2505
|
+
const LOADER_NAME = `lightningcss-loader`;
|
|
2506
|
+
// match `Custom media query {} is not defined`
|
|
2507
|
+
// https://github.com/parcel-bundler/lightningcss/blob/master/src/error.rs#L375
|
|
2508
|
+
const CUSTOM_MEDIA_ERROR_REG = /Custom media query (.+?) is not defined/;
|
|
2509
|
+
const isCustomMediaError = (err) => {
|
|
2510
|
+
const msg = err === null || err === void 0 ? void 0 : err.message;
|
|
2511
|
+
if (!(msg === null || msg === void 0 ? void 0 : msg.length)) {
|
|
2512
|
+
return false;
|
|
2513
|
+
}
|
|
2514
|
+
const isMatch = CUSTOM_MEDIA_ERROR_REG.test(msg);
|
|
2515
|
+
return isMatch;
|
|
2516
|
+
};
|
|
2531
2517
|
function LightningCssLoader(source, prevMap) {
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2518
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2519
|
+
var _a, _b, _c;
|
|
2520
|
+
const done = this.async();
|
|
2521
|
+
const options = this.getOptions();
|
|
2522
|
+
const { implementation, targets: userTargets } = options, opts = __rest(options, ["implementation", "targets"]);
|
|
2523
|
+
if (implementation && typeof implementation.transform !== 'function') {
|
|
2524
|
+
done(new TypeError(`[${LOADER_NAME}]: options.implementation.transform must be an 'lightningcss' transform function. Received ${typeof implementation.transform}`));
|
|
2525
|
+
return;
|
|
2526
|
+
}
|
|
2527
|
+
const transform = (_a = implementation === null || implementation === void 0 ? void 0 : implementation.transform) !== null && _a !== void 0 ? _a : lightningcss_1.default.transform;
|
|
2528
|
+
const bundle = (_b = implementation === null || implementation === void 0 ? void 0 : implementation.bundle) !== null && _b !== void 0 ? _b : lightningcss_1.default.bundle;
|
|
2529
|
+
const filename = this.resourcePath;
|
|
2530
|
+
const enableSourceMap = this.sourceMap;
|
|
2531
|
+
const targets = (0, utils_1.getTargets)({ default: userTargets, key: interface_1.ECacheKey.loader });
|
|
2532
|
+
const inputSourceMap = enableSourceMap && prevMap ? JSON.stringify(prevMap) : undefined;
|
|
2533
|
+
try {
|
|
2534
|
+
const codeBuffer = buffer_1.Buffer.from(source);
|
|
2535
|
+
const { code, map } = transform(Object.assign({ filename, code: codeBuffer, sourceMap: enableSourceMap, targets,
|
|
2536
|
+
inputSourceMap }, opts));
|
|
2537
|
+
const codeAsString = code.toString();
|
|
2538
|
+
done(null, codeAsString, map && JSON.parse(map.toString()));
|
|
2539
|
+
}
|
|
2540
|
+
catch (error) {
|
|
2541
|
+
// support @custom-media queries
|
|
2542
|
+
const isCustomMediaEnabled = ((_c = opts === null || opts === void 0 ? void 0 : opts.drafts) === null || _c === void 0 ? void 0 : _c.customMedia) === true;
|
|
2543
|
+
if (isCustomMediaEnabled) {
|
|
2544
|
+
const canBundle = typeof bundle === 'function' &&
|
|
2545
|
+
isCustomMediaError(error) &&
|
|
2546
|
+
filename;
|
|
2547
|
+
if (canBundle) {
|
|
2548
|
+
// fallback to bundle API
|
|
2549
|
+
try {
|
|
2550
|
+
const { code, map } = bundle(Object.assign({ filename, sourceMap: enableSourceMap, targets,
|
|
2551
|
+
inputSourceMap }, opts));
|
|
2552
|
+
const codeAsString = code.toString();
|
|
2553
|
+
done(null, codeAsString, map && JSON.parse(map.toString()));
|
|
2554
|
+
return;
|
|
2555
|
+
}
|
|
2556
|
+
catch (_d) { }
|
|
2557
|
+
}
|
|
2551
2558
|
}
|
|
2552
|
-
|
|
2553
|
-
}
|
|
2559
|
+
done(error);
|
|
2560
|
+
}
|
|
2554
2561
|
});
|
|
2555
2562
|
}
|
|
2556
|
-
exports.LightningCssLoader = LightningCssLoader;
|
|
2557
2563
|
|
|
2558
2564
|
|
|
2559
2565
|
/***/ }),
|
|
@@ -2563,17 +2569,6 @@ exports.LightningCssLoader = LightningCssLoader;
|
|
|
2563
2569
|
|
|
2564
2570
|
"use strict";
|
|
2565
2571
|
|
|
2566
|
-
var __assign = (this && this.__assign) || function () {
|
|
2567
|
-
__assign = Object.assign || function(t) {
|
|
2568
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2569
|
-
s = arguments[i];
|
|
2570
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
2571
|
-
t[p] = s[p];
|
|
2572
|
-
}
|
|
2573
|
-
return t;
|
|
2574
|
-
};
|
|
2575
|
-
return __assign.apply(this, arguments);
|
|
2576
|
-
};
|
|
2577
2572
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2578
2573
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2579
2574
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -2583,33 +2578,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
2583
2578
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2584
2579
|
});
|
|
2585
2580
|
};
|
|
2586
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
2587
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2588
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2589
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2590
|
-
function step(op) {
|
|
2591
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2592
|
-
while (_) try {
|
|
2593
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2594
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2595
|
-
switch (op[0]) {
|
|
2596
|
-
case 0: case 1: t = op; break;
|
|
2597
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
2598
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2599
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2600
|
-
default:
|
|
2601
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2602
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2603
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2604
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2605
|
-
if (t[2]) _.ops.pop();
|
|
2606
|
-
_.trys.pop(); continue;
|
|
2607
|
-
}
|
|
2608
|
-
op = body.call(thisArg, _);
|
|
2609
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2610
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2611
|
-
}
|
|
2612
|
-
};
|
|
2613
2581
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2614
2582
|
var t = {};
|
|
2615
2583
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -2624,124 +2592,144 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
2624
2592
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2625
2593
|
exports.LightningCssMinifyPlugin = void 0;
|
|
2626
2594
|
// @ts-ignore
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
if (opts === void 0) { opts = {}; }
|
|
2595
|
+
const ModuleFilenameHelpers_1 = __nccwpck_require__(761);
|
|
2596
|
+
const webpack_sources_1 = __nccwpck_require__(9842);
|
|
2597
|
+
const lightningcss_1 = __nccwpck_require__(9446);
|
|
2598
|
+
const interface_1 = __nccwpck_require__(1959);
|
|
2599
|
+
const path_1 = __nccwpck_require__(6928);
|
|
2600
|
+
const utils_1 = __nccwpck_require__(4753);
|
|
2601
|
+
const buffer_1 = __nccwpck_require__(181);
|
|
2602
|
+
const pkgPath = (0, path_1.join)(__dirname, '../../package.json');
|
|
2603
|
+
const pkg = require(pkgPath);
|
|
2604
|
+
const PLUGIN_NAME = 'lightning-css-minify';
|
|
2605
|
+
const CSS_FILE_REG = /\.css(?:\?.*)?$/i;
|
|
2606
|
+
class LightningCssMinifyPlugin {
|
|
2607
|
+
constructor(opts = {}) {
|
|
2641
2608
|
var _a;
|
|
2642
|
-
|
|
2609
|
+
const { implementation } = opts, otherOpts = __rest(opts, ["implementation"]);
|
|
2643
2610
|
if (implementation && typeof implementation.transform !== 'function') {
|
|
2644
|
-
throw new TypeError(
|
|
2611
|
+
throw new TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof implementation.transform}`);
|
|
2645
2612
|
}
|
|
2646
2613
|
this.transform = (_a = implementation === null || implementation === void 0 ? void 0 : implementation.transform) !== null && _a !== void 0 ? _a : lightningcss_1.transform;
|
|
2647
2614
|
this.options = otherOpts;
|
|
2648
2615
|
}
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
var meta = JSON.stringify({
|
|
2616
|
+
apply(compiler) {
|
|
2617
|
+
const meta = JSON.stringify({
|
|
2652
2618
|
name: pkg.name,
|
|
2653
2619
|
version: pkg.version,
|
|
2654
2620
|
options: this.options,
|
|
2655
2621
|
});
|
|
2656
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME,
|
|
2657
|
-
compilation.hooks.chunkHash.tap(PLUGIN_NAME,
|
|
2658
|
-
return hash.update(meta);
|
|
2659
|
-
});
|
|
2622
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
2623
|
+
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash) => hash.update(meta));
|
|
2660
2624
|
if ((0, utils_1.isWebpack5)(compilation)) {
|
|
2661
2625
|
compilation.hooks.processAssets.tapPromise({
|
|
2662
2626
|
name: PLUGIN_NAME,
|
|
2663
2627
|
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
|
|
2664
2628
|
additionalAssets: true,
|
|
2665
|
-
},
|
|
2666
|
-
|
|
2667
|
-
case 0: return [4 /*yield*/, this.transformAssets(compilation)];
|
|
2668
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
2669
|
-
}
|
|
2670
|
-
}); }); });
|
|
2671
|
-
compilation.hooks.statsPrinter.tap(PLUGIN_NAME, function (statsPrinter) {
|
|
2629
|
+
}, () => __awaiter(this, void 0, void 0, function* () { return yield this.transformAssets(compilation); }));
|
|
2630
|
+
compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (statsPrinter) => {
|
|
2672
2631
|
statsPrinter.hooks.print
|
|
2673
2632
|
.for('asset.info.minimized')
|
|
2674
2633
|
// @ts-ignore
|
|
2675
|
-
.tap(PLUGIN_NAME,
|
|
2676
|
-
var green = _a.green, formatFlag = _a.formatFlag;
|
|
2634
|
+
.tap(PLUGIN_NAME, (minimized, { green, formatFlag }) => {
|
|
2677
2635
|
// @ts-ignore
|
|
2678
2636
|
return minimized ? green(formatFlag('minimized')) : undefined;
|
|
2679
2637
|
});
|
|
2680
2638
|
});
|
|
2681
2639
|
}
|
|
2682
2640
|
else {
|
|
2683
|
-
compilation.hooks.optimizeChunkAssets.tapPromise(PLUGIN_NAME,
|
|
2684
|
-
switch (_a.label) {
|
|
2685
|
-
case 0: return [4 /*yield*/, this.transformAssets(compilation)];
|
|
2686
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
2687
|
-
}
|
|
2688
|
-
}); }); });
|
|
2641
|
+
compilation.hooks.optimizeChunkAssets.tapPromise(PLUGIN_NAME, () => __awaiter(this, void 0, void 0, function* () { return yield this.transformAssets(compilation); }));
|
|
2689
2642
|
}
|
|
2690
2643
|
});
|
|
2691
|
-
}
|
|
2692
|
-
|
|
2693
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
_a = asset.source.sourceAndMap(), source = _a.source, map = _a.map;
|
|
2717
|
-
sourceAsString = source.toString();
|
|
2718
|
-
code = typeof source === 'string' ? buffer_1.Buffer.from(source) : source;
|
|
2719
|
-
targets = (0, utils_1.getTargets)({
|
|
2720
|
-
default: userTargets,
|
|
2721
|
-
key: interface_1.ECacheKey.minify,
|
|
2722
|
-
});
|
|
2723
|
-
return [4 /*yield*/, this.transform(__assign({ filename: asset.name, code: code, minify: true, sourceMap: sourcemap, targets: targets }, transformOptions))];
|
|
2724
|
-
case 1:
|
|
2725
|
-
result = _b.sent();
|
|
2726
|
-
codeString = result.code.toString();
|
|
2727
|
-
compilation.updateAsset(asset.name,
|
|
2728
|
-
// @ts-ignore
|
|
2729
|
-
sourcemap
|
|
2730
|
-
? new webpack_sources_1.SourceMapSource(codeString, asset.name, JSON.parse(result.map.toString()), sourceAsString, map, true)
|
|
2731
|
-
: new webpack_sources_1.RawSource(codeString), __assign(__assign({}, asset.info), { minimized: true }));
|
|
2732
|
-
return [2 /*return*/];
|
|
2733
|
-
}
|
|
2734
|
-
});
|
|
2735
|
-
}); }))];
|
|
2736
|
-
case 1:
|
|
2737
|
-
_b.sent();
|
|
2738
|
-
return [2 /*return*/];
|
|
2644
|
+
}
|
|
2645
|
+
transformAssets(compilation) {
|
|
2646
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2647
|
+
const { options: { devtool }, } = compilation.compiler;
|
|
2648
|
+
const sourcemap = this.options.sourceMap === undefined
|
|
2649
|
+
? (devtool && devtool.includes('source-map'))
|
|
2650
|
+
: this.options.sourceMap;
|
|
2651
|
+
const _a = this.options, { include, exclude, test: testRegExp, targets: userTargets, features: transformFeatureOptions } = _a, transformOptions = __rest(_a, ["include", "exclude", "test", "targets", "features"]);
|
|
2652
|
+
const assets = compilation.getAssets().filter((asset) =>
|
|
2653
|
+
// Filter out already minimized
|
|
2654
|
+
!asset.info.minimized &&
|
|
2655
|
+
// Filter out by file type
|
|
2656
|
+
(testRegExp || CSS_FILE_REG).test(asset.name) &&
|
|
2657
|
+
(0, ModuleFilenameHelpers_1.matchObject)({ include, exclude }, asset.name));
|
|
2658
|
+
yield Promise.all(assets.map((asset) => __awaiter(this, void 0, void 0, function* () {
|
|
2659
|
+
const { source, map } = asset.source.sourceAndMap();
|
|
2660
|
+
const sourceAsString = source.toString();
|
|
2661
|
+
const code = typeof source === 'string' ? buffer_1.Buffer.from(source) : source;
|
|
2662
|
+
const targets = (0, utils_1.getTargets)({
|
|
2663
|
+
default: userTargets,
|
|
2664
|
+
key: interface_1.ECacheKey.minify,
|
|
2665
|
+
});
|
|
2666
|
+
let result;
|
|
2667
|
+
try {
|
|
2668
|
+
result = yield this.transform(Object.assign(Object.assign({ filename: asset.name, code, minify: true, sourceMap: sourcemap, targets }, transformFeatureOptions), transformOptions));
|
|
2739
2669
|
}
|
|
2740
|
-
|
|
2670
|
+
catch (error) {
|
|
2671
|
+
const err = error;
|
|
2672
|
+
const fileName = err.fileName || asset.name;
|
|
2673
|
+
const loc = err.loc;
|
|
2674
|
+
const messageParts = [`${err.message || error}`];
|
|
2675
|
+
if (loc && typeof loc.line === 'number') {
|
|
2676
|
+
const position = typeof loc.column === 'number'
|
|
2677
|
+
? `${loc.line}:${loc.column}`
|
|
2678
|
+
: `${loc.line}`;
|
|
2679
|
+
messageParts.push(` in ${fileName}:${position}`, '');
|
|
2680
|
+
const lines = sourceAsString.split('\n');
|
|
2681
|
+
const start = Math.max(0, loc.line - 4);
|
|
2682
|
+
const end = Math.min(lines.length, loc.line + 3);
|
|
2683
|
+
for (let i = start; i < end; i++) {
|
|
2684
|
+
const lineNum = i + 1;
|
|
2685
|
+
const marker = lineNum === loc.line ? '>' : ' ';
|
|
2686
|
+
messageParts.push(`${marker} ${lineNum} | ${lines[i]}`);
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
else {
|
|
2690
|
+
messageParts.push(` in ${fileName}`);
|
|
2691
|
+
}
|
|
2692
|
+
const tipsMessage = [];
|
|
2693
|
+
const errorMessage = messageParts.join('\n');
|
|
2694
|
+
const maySyntaxError = errorMessage.includes('SyntaxError:');
|
|
2695
|
+
if (maySyntaxError) {
|
|
2696
|
+
tipsMessage.push('');
|
|
2697
|
+
// Tips: `errorRecovery: true`
|
|
2698
|
+
// https://lightningcss.dev/docs.html#error-recovery
|
|
2699
|
+
const tipLine = '='.repeat(80);
|
|
2700
|
+
tipsMessage.push(tipLine);
|
|
2701
|
+
tipsMessage.push(`\n[LightningCssMinifyPlugin] This error might be caused by a syntax error in the CSS. \n\nLightningCSS has an 'errorRecovery' option that can be enabled to attempt to recover from syntax errors and provide more detailed error messages. You can enable it in the plugin options:`);
|
|
2702
|
+
tipsMessage.push(`
|
|
2703
|
+
new LightningCssMinifyPlugin({
|
|
2704
|
+
// other options...
|
|
2705
|
+
errorRecovery: true,
|
|
2706
|
+
})
|
|
2707
|
+
`);
|
|
2708
|
+
tipsMessage.push(tipLine);
|
|
2709
|
+
}
|
|
2710
|
+
// print tips
|
|
2711
|
+
console.log();
|
|
2712
|
+
console.log(tipsMessage.join('\n'));
|
|
2713
|
+
// print error
|
|
2714
|
+
console.log();
|
|
2715
|
+
console.log(`[LightningCssMinifyPlugin] LightningCSS error:`);
|
|
2716
|
+
console.log(errorMessage);
|
|
2717
|
+
console.log();
|
|
2718
|
+
// throw
|
|
2719
|
+
throw new Error('[LightningCssMinifyPlugin] minification failed', {
|
|
2720
|
+
cause: error,
|
|
2721
|
+
});
|
|
2722
|
+
}
|
|
2723
|
+
const codeString = result.code.toString();
|
|
2724
|
+
compilation.updateAsset(asset.name,
|
|
2725
|
+
// @ts-ignore
|
|
2726
|
+
sourcemap
|
|
2727
|
+
? new webpack_sources_1.SourceMapSource(codeString, asset.name, JSON.parse(result.map.toString()), sourceAsString, map, true)
|
|
2728
|
+
: new webpack_sources_1.RawSource(codeString), Object.assign(Object.assign({}, asset.info), { minimized: true }));
|
|
2729
|
+
})));
|
|
2741
2730
|
});
|
|
2742
|
-
}
|
|
2743
|
-
|
|
2744
|
-
}());
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2745
2733
|
exports.LightningCssMinifyPlugin = LightningCssMinifyPlugin;
|
|
2746
2734
|
|
|
2747
2735
|
|
|
@@ -2757,23 +2745,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2757
2745
|
};
|
|
2758
2746
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2759
2747
|
exports.getTargets = exports.isWebpack5 = void 0;
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2748
|
+
const browserslist_1 = __importDefault(__nccwpck_require__(6732));
|
|
2749
|
+
const lightningcss_1 = __nccwpck_require__(9446);
|
|
2750
|
+
const isWebpack5 = (compilation) => 'processAssets' in compilation.hooks;
|
|
2763
2751
|
exports.isWebpack5 = isWebpack5;
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2752
|
+
let targetsCache = {};
|
|
2753
|
+
const getTargets = (opts) => {
|
|
2754
|
+
const cache = targetsCache[opts.key];
|
|
2767
2755
|
if (cache) {
|
|
2768
2756
|
return cache;
|
|
2769
2757
|
}
|
|
2770
|
-
|
|
2771
|
-
|
|
2758
|
+
const cwd = process.cwd();
|
|
2759
|
+
const result = (0, browserslist_1.default)(opts.default, {
|
|
2772
2760
|
path: cwd,
|
|
2773
2761
|
env: process.env.NODE_ENV || 'production',
|
|
2774
2762
|
});
|
|
2775
2763
|
targetsCache[opts.key] = (0, lightningcss_1.browserslistToTargets)(result);
|
|
2776
|
-
return
|
|
2764
|
+
return targetsCache[opts.key];
|
|
2777
2765
|
};
|
|
2778
2766
|
exports.getTargets = getTargets;
|
|
2779
2767
|
|
|
@@ -4921,7 +4909,7 @@ var Parser = /*#__PURE__*/function () {
|
|
|
4921
4909
|
if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
|
|
4922
4910
|
spaces.before = _space2.slice(0, _space2.length - 1);
|
|
4923
4911
|
raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
|
|
4924
|
-
} else if (_space2
|
|
4912
|
+
} else if (_space2[0] === ' ' && _rawSpace2[0] === ' ') {
|
|
4925
4913
|
spaces.after = _space2.slice(1);
|
|
4926
4914
|
raws.spaces.after = _rawSpace2.slice(1);
|
|
4927
4915
|
} else {
|
|
@@ -9234,7 +9222,15 @@ class Input {
|
|
|
9234
9222
|
)
|
|
9235
9223
|
}
|
|
9236
9224
|
|
|
9237
|
-
result.input = {
|
|
9225
|
+
result.input = {
|
|
9226
|
+
column,
|
|
9227
|
+
endColumn,
|
|
9228
|
+
endLine,
|
|
9229
|
+
endOffset,
|
|
9230
|
+
line,
|
|
9231
|
+
offset,
|
|
9232
|
+
source: this.css
|
|
9233
|
+
}
|
|
9238
9234
|
if (this.file) {
|
|
9239
9235
|
if (pathToFileURL) {
|
|
9240
9236
|
result.input.url = pathToFileURL(this.file).toString()
|
|
@@ -9743,6 +9739,16 @@ class LazyResult {
|
|
|
9743
9739
|
if (opts.stringifier) str = opts.stringifier
|
|
9744
9740
|
if (str.stringify) str = str.stringify
|
|
9745
9741
|
|
|
9742
|
+
let rootSource = this.result.root.source
|
|
9743
|
+
if (opts.map === undefined && !(rootSource && rootSource.input && rootSource.input.map)) {
|
|
9744
|
+
let result = ''
|
|
9745
|
+
str(this.result.root, i => {
|
|
9746
|
+
result += i
|
|
9747
|
+
})
|
|
9748
|
+
this.result.css = result
|
|
9749
|
+
return this.result
|
|
9750
|
+
}
|
|
9751
|
+
|
|
9746
9752
|
let map = new MapGenerator(str, this.result.root, this.result.opts)
|
|
9747
9753
|
let data = map.generate()
|
|
9748
9754
|
this.result.css = data[0]
|
|
@@ -10064,7 +10070,15 @@ class MapGenerator {
|
|
|
10064
10070
|
}
|
|
10065
10071
|
}
|
|
10066
10072
|
} else if (this.css) {
|
|
10067
|
-
|
|
10073
|
+
let startIndex
|
|
10074
|
+
while ((startIndex = this.css.lastIndexOf('/*#')) !== -1) {
|
|
10075
|
+
let endIndex = this.css.indexOf('*/', startIndex + 3)
|
|
10076
|
+
if (endIndex === -1) break
|
|
10077
|
+
while (startIndex > 0 && this.css[startIndex - 1] === '\n') {
|
|
10078
|
+
startIndex--
|
|
10079
|
+
}
|
|
10080
|
+
this.css = this.css.slice(0, startIndex) + this.css.slice(endIndex + 2)
|
|
10081
|
+
}
|
|
10068
10082
|
}
|
|
10069
10083
|
}
|
|
10070
10084
|
|
|
@@ -10367,7 +10381,7 @@ module.exports = MapGenerator
|
|
|
10367
10381
|
|
|
10368
10382
|
let MapGenerator = __nccwpck_require__(2079)
|
|
10369
10383
|
let parse = __nccwpck_require__(9110)
|
|
10370
|
-
|
|
10384
|
+
let Result = __nccwpck_require__(3264)
|
|
10371
10385
|
let stringify = __nccwpck_require__(5720)
|
|
10372
10386
|
let warnOnce = __nccwpck_require__(5979)
|
|
10373
10387
|
|
|
@@ -10430,10 +10444,9 @@ class NoWorkResult {
|
|
|
10430
10444
|
this._css = css
|
|
10431
10445
|
this._opts = opts
|
|
10432
10446
|
this._map = undefined
|
|
10433
|
-
let root
|
|
10434
10447
|
|
|
10435
10448
|
let str = stringify
|
|
10436
|
-
this.result = new Result(this._processor,
|
|
10449
|
+
this.result = new Result(this._processor, undefined, this._opts)
|
|
10437
10450
|
this.result.css = css
|
|
10438
10451
|
|
|
10439
10452
|
let self = this
|
|
@@ -10443,7 +10456,7 @@ class NoWorkResult {
|
|
|
10443
10456
|
}
|
|
10444
10457
|
})
|
|
10445
10458
|
|
|
10446
|
-
let map = new MapGenerator(str,
|
|
10459
|
+
let map = new MapGenerator(str, undefined, this._opts, css)
|
|
10447
10460
|
if (map.isMap()) {
|
|
10448
10461
|
let [generatedCSS, generatedMap] = map.generate()
|
|
10449
10462
|
if (generatedCSS) {
|
|
@@ -11194,7 +11207,7 @@ class Parser {
|
|
|
11194
11207
|
node.source.end.offset++
|
|
11195
11208
|
|
|
11196
11209
|
let text = token[1].slice(2, -2)
|
|
11197
|
-
if (
|
|
11210
|
+
if (!text.trim()) {
|
|
11198
11211
|
node.text = ''
|
|
11199
11212
|
node.raws.left = text
|
|
11200
11213
|
node.raws.right = ''
|
|
@@ -11762,6 +11775,7 @@ function fromBase64(str) {
|
|
|
11762
11775
|
class PreviousMap {
|
|
11763
11776
|
constructor(css, opts) {
|
|
11764
11777
|
if (opts.map === false) return
|
|
11778
|
+
if (opts.unsafeMap) this.unsafeMap = true
|
|
11765
11779
|
this.loadAnnotation(css)
|
|
11766
11780
|
this.inline = this.startWith(this.annotation, 'data:')
|
|
11767
11781
|
|
|
@@ -11776,7 +11790,7 @@ class PreviousMap {
|
|
|
11776
11790
|
|
|
11777
11791
|
consumer() {
|
|
11778
11792
|
if (!this.consumerCache) {
|
|
11779
|
-
this.consumerCache = new SourceMapConsumer(this.text)
|
|
11793
|
+
this.consumerCache = new SourceMapConsumer(this.json || this.text)
|
|
11780
11794
|
}
|
|
11781
11795
|
return this.consumerCache
|
|
11782
11796
|
}
|
|
@@ -11797,7 +11811,8 @@ class PreviousMap {
|
|
|
11797
11811
|
return fromBase64(text.substr(baseUriMatch[0].length))
|
|
11798
11812
|
}
|
|
11799
11813
|
|
|
11800
|
-
let encoding = text.
|
|
11814
|
+
let encoding = text.slice('data:application/json;'.length)
|
|
11815
|
+
encoding = encoding.slice(0, encoding.indexOf(','))
|
|
11801
11816
|
throw new Error('Unsupported source map encoding ' + encoding)
|
|
11802
11817
|
}
|
|
11803
11818
|
|
|
@@ -11828,7 +11843,13 @@ class PreviousMap {
|
|
|
11828
11843
|
}
|
|
11829
11844
|
}
|
|
11830
11845
|
|
|
11831
|
-
loadFile(path) {
|
|
11846
|
+
loadFile(path, cssFile, trusted) {
|
|
11847
|
+
/* c8 ignore next 5 */
|
|
11848
|
+
if (!trusted && !this.unsafeMap) {
|
|
11849
|
+
if (!/\.map$/i.test(path)) {
|
|
11850
|
+
return undefined
|
|
11851
|
+
}
|
|
11852
|
+
}
|
|
11832
11853
|
this.root = dirname(path)
|
|
11833
11854
|
if (existsSync(path)) {
|
|
11834
11855
|
this.mapFile = path
|
|
@@ -11845,7 +11866,7 @@ class PreviousMap {
|
|
|
11845
11866
|
} else if (typeof prev === 'function') {
|
|
11846
11867
|
let prevPath = prev(file)
|
|
11847
11868
|
if (prevPath) {
|
|
11848
|
-
let map = this.loadFile(prevPath)
|
|
11869
|
+
let map = this.loadFile(prevPath, file, true)
|
|
11849
11870
|
if (!map) {
|
|
11850
11871
|
throw new Error(
|
|
11851
11872
|
'Unable to load previous source map: ' + prevPath.toString()
|
|
@@ -11869,7 +11890,16 @@ class PreviousMap {
|
|
|
11869
11890
|
} else if (this.annotation) {
|
|
11870
11891
|
let map = this.annotation
|
|
11871
11892
|
if (file) map = join(dirname(file), map)
|
|
11872
|
-
|
|
11893
|
+
let unknown = this.loadFile(map, file, false)
|
|
11894
|
+
if (unknown) {
|
|
11895
|
+
try {
|
|
11896
|
+
/* c8 ignore next 4 */
|
|
11897
|
+
this.json = JSON.parse(unknown.replace(/^\)]}'[^\n]*\n/, ''))
|
|
11898
|
+
} catch {
|
|
11899
|
+
return undefined
|
|
11900
|
+
}
|
|
11901
|
+
}
|
|
11902
|
+
return unknown
|
|
11873
11903
|
}
|
|
11874
11904
|
}
|
|
11875
11905
|
|
|
@@ -11905,7 +11935,7 @@ let Root = __nccwpck_require__(6265)
|
|
|
11905
11935
|
|
|
11906
11936
|
class Processor {
|
|
11907
11937
|
constructor(plugins = []) {
|
|
11908
|
-
this.version = '8.5.
|
|
11938
|
+
this.version = '8.5.12'
|
|
11909
11939
|
this.plugins = this.normalize(plugins)
|
|
11910
11940
|
}
|
|
11911
11941
|
|
|
@@ -12127,6 +12157,18 @@ Container.registerRule(Rule)
|
|
|
12127
12157
|
"use strict";
|
|
12128
12158
|
|
|
12129
12159
|
|
|
12160
|
+
// Escapes sequences that could break out of an HTML <style> context.
|
|
12161
|
+
// Uses CSS unicode escaping (\3c = '<') which is valid CSS and parsed
|
|
12162
|
+
// correctly by all compliant CSS consumers.
|
|
12163
|
+
const STYLE_TAG = /(<)(\/?style\b)/gi
|
|
12164
|
+
const COMMENT_OPEN = /(<)(!--)/g
|
|
12165
|
+
|
|
12166
|
+
function escapeHTMLInCSS(str) {
|
|
12167
|
+
if (typeof str !== 'string') return str
|
|
12168
|
+
if (!str.includes('<')) return str
|
|
12169
|
+
return str.replace(STYLE_TAG, '\\3c $2').replace(COMMENT_OPEN, '\\3c $2')
|
|
12170
|
+
}
|
|
12171
|
+
|
|
12130
12172
|
const DEFAULT_RAW = {
|
|
12131
12173
|
after: '\n',
|
|
12132
12174
|
beforeClose: '\n',
|
|
@@ -12152,11 +12194,12 @@ class Stringifier {
|
|
|
12152
12194
|
}
|
|
12153
12195
|
|
|
12154
12196
|
atrule(node, semicolon) {
|
|
12197
|
+
let raws = node.raws
|
|
12155
12198
|
let name = '@' + node.name
|
|
12156
12199
|
let params = node.params ? this.rawValue(node, 'params') : ''
|
|
12157
12200
|
|
|
12158
|
-
if (typeof
|
|
12159
|
-
name +=
|
|
12201
|
+
if (typeof raws.afterName !== 'undefined') {
|
|
12202
|
+
name += raws.afterName
|
|
12160
12203
|
} else if (params) {
|
|
12161
12204
|
name += ' '
|
|
12162
12205
|
}
|
|
@@ -12164,8 +12207,8 @@ class Stringifier {
|
|
|
12164
12207
|
if (node.nodes) {
|
|
12165
12208
|
this.block(node, name + params)
|
|
12166
12209
|
} else {
|
|
12167
|
-
let end = (
|
|
12168
|
-
this.builder(name + params + end, node)
|
|
12210
|
+
let end = (raws.between || '') + (semicolon ? ';' : '')
|
|
12211
|
+
this.builder(escapeHTMLInCSS(name + params + end), node)
|
|
12169
12212
|
}
|
|
12170
12213
|
}
|
|
12171
12214
|
|
|
@@ -12199,53 +12242,77 @@ class Stringifier {
|
|
|
12199
12242
|
}
|
|
12200
12243
|
|
|
12201
12244
|
block(node, start) {
|
|
12202
|
-
let
|
|
12203
|
-
|
|
12245
|
+
let raws = node.raws
|
|
12246
|
+
let between = typeof raws.between !== 'undefined'
|
|
12247
|
+
? raws.between
|
|
12248
|
+
: this.raw(node, 'between', 'beforeOpen')
|
|
12249
|
+
this.builder(escapeHTMLInCSS(start + between) + '{', node, 'start')
|
|
12204
12250
|
|
|
12205
12251
|
let after
|
|
12206
12252
|
if (node.nodes && node.nodes.length) {
|
|
12207
12253
|
this.body(node)
|
|
12208
|
-
after =
|
|
12254
|
+
after = typeof raws.after !== 'undefined'
|
|
12255
|
+
? raws.after
|
|
12256
|
+
: this.raw(node, 'after')
|
|
12209
12257
|
} else {
|
|
12210
|
-
after =
|
|
12258
|
+
after = typeof raws.after !== 'undefined'
|
|
12259
|
+
? raws.after
|
|
12260
|
+
: this.raw(node, 'after', 'emptyBody')
|
|
12211
12261
|
}
|
|
12212
12262
|
|
|
12213
|
-
if (after) this.builder(after)
|
|
12263
|
+
if (after) this.builder(escapeHTMLInCSS(after))
|
|
12214
12264
|
this.builder('}', node, 'end')
|
|
12215
12265
|
}
|
|
12216
12266
|
|
|
12217
12267
|
body(node) {
|
|
12218
|
-
let
|
|
12268
|
+
let nodes = node.nodes
|
|
12269
|
+
let last = nodes.length - 1
|
|
12219
12270
|
while (last > 0) {
|
|
12220
|
-
if (
|
|
12271
|
+
if (nodes[last].type !== 'comment') break
|
|
12221
12272
|
last -= 1
|
|
12222
12273
|
}
|
|
12223
12274
|
|
|
12224
12275
|
let semicolon = this.raw(node, 'semicolon')
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
let
|
|
12228
|
-
|
|
12276
|
+
let isDocument = node.type === 'document'
|
|
12277
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
12278
|
+
let child = nodes[i]
|
|
12279
|
+
let before = child.raws.before
|
|
12280
|
+
if (typeof before === 'undefined') {
|
|
12281
|
+
before = this.raw(child, 'before')
|
|
12282
|
+
}
|
|
12283
|
+
if (before) this.builder(isDocument ? before : escapeHTMLInCSS(before))
|
|
12229
12284
|
this.stringify(child, last !== i || semicolon)
|
|
12230
12285
|
}
|
|
12231
12286
|
}
|
|
12232
12287
|
|
|
12233
12288
|
comment(node) {
|
|
12234
|
-
let
|
|
12235
|
-
let
|
|
12236
|
-
|
|
12289
|
+
let raws = node.raws
|
|
12290
|
+
let left = typeof raws.left !== 'undefined'
|
|
12291
|
+
? raws.left
|
|
12292
|
+
: this.raw(node, 'left', 'commentLeft')
|
|
12293
|
+
let right = typeof raws.right !== 'undefined'
|
|
12294
|
+
? raws.right
|
|
12295
|
+
: this.raw(node, 'right', 'commentRight')
|
|
12296
|
+
this.builder(escapeHTMLInCSS('/*' + left + node.text + right + '*/'), node)
|
|
12237
12297
|
}
|
|
12238
12298
|
|
|
12239
12299
|
decl(node, semicolon) {
|
|
12240
|
-
let
|
|
12241
|
-
let
|
|
12300
|
+
let raws = node.raws
|
|
12301
|
+
let between = typeof raws.between !== 'undefined'
|
|
12302
|
+
? raws.between
|
|
12303
|
+
: this.raw(node, 'between', 'colon')
|
|
12304
|
+
|
|
12305
|
+
let rawVal = raws.value
|
|
12306
|
+
let value = rawVal && rawVal.value === node.value ? rawVal.raw : node.value
|
|
12307
|
+
|
|
12308
|
+
let string = node.prop + between + value
|
|
12242
12309
|
|
|
12243
12310
|
if (node.important) {
|
|
12244
|
-
string +=
|
|
12311
|
+
string += raws.important || ' !important'
|
|
12245
12312
|
}
|
|
12246
12313
|
|
|
12247
12314
|
if (semicolon) string += ';'
|
|
12248
|
-
this.builder(string, node)
|
|
12315
|
+
this.builder(escapeHTMLInCSS(string), node)
|
|
12249
12316
|
}
|
|
12250
12317
|
|
|
12251
12318
|
document(node) {
|
|
@@ -12281,9 +12348,9 @@ class Stringifier {
|
|
|
12281
12348
|
|
|
12282
12349
|
// Detect style by other nodes
|
|
12283
12350
|
let root = node.root()
|
|
12284
|
-
|
|
12285
|
-
if (typeof
|
|
12286
|
-
return
|
|
12351
|
+
let cache = root.rawCache || (root.rawCache = {})
|
|
12352
|
+
if (typeof cache[detect] !== 'undefined') {
|
|
12353
|
+
return cache[detect]
|
|
12287
12354
|
}
|
|
12288
12355
|
|
|
12289
12356
|
if (detect === 'before' || detect === 'after') {
|
|
@@ -12302,7 +12369,7 @@ class Stringifier {
|
|
|
12302
12369
|
|
|
12303
12370
|
if (typeof value === 'undefined') value = DEFAULT_RAW[detect]
|
|
12304
12371
|
|
|
12305
|
-
|
|
12372
|
+
cache[detect] = value
|
|
12306
12373
|
return value
|
|
12307
12374
|
}
|
|
12308
12375
|
|
|
@@ -12451,13 +12518,17 @@ class Stringifier {
|
|
|
12451
12518
|
|
|
12452
12519
|
root(node) {
|
|
12453
12520
|
this.body(node)
|
|
12454
|
-
if (node.raws.after)
|
|
12521
|
+
if (node.raws.after) {
|
|
12522
|
+
let after = node.raws.after
|
|
12523
|
+
let isDocument = node.parent && node.parent.type === 'document'
|
|
12524
|
+
this.builder(isDocument ? after : escapeHTMLInCSS(after))
|
|
12525
|
+
}
|
|
12455
12526
|
}
|
|
12456
12527
|
|
|
12457
12528
|
rule(node) {
|
|
12458
12529
|
this.block(node, this.rawValue(node, 'selector'))
|
|
12459
12530
|
if (node.raws.ownSemicolon) {
|
|
12460
|
-
this.builder(node.raws.ownSemicolon, node, 'end')
|
|
12531
|
+
this.builder(escapeHTMLInCSS(node.raws.ownSemicolon), node, 'end')
|
|
12461
12532
|
}
|
|
12462
12533
|
}
|
|
12463
12534
|
|
|
@@ -12634,6 +12705,7 @@ module.exports = function tokenizer(input, options = {}) {
|
|
|
12634
12705
|
let pos = 0
|
|
12635
12706
|
let buffer = []
|
|
12636
12707
|
let returned = []
|
|
12708
|
+
let lastBadParen = -1
|
|
12637
12709
|
|
|
12638
12710
|
function position() {
|
|
12639
12711
|
return pos
|
|
@@ -12725,11 +12797,14 @@ module.exports = function tokenizer(input, options = {}) {
|
|
|
12725
12797
|
currentToken = ['brackets', css.slice(pos, next + 1), pos, next]
|
|
12726
12798
|
|
|
12727
12799
|
pos = next
|
|
12800
|
+
} else if (pos <= lastBadParen) {
|
|
12801
|
+
currentToken = ['(', '(', pos]
|
|
12728
12802
|
} else {
|
|
12729
12803
|
next = css.indexOf(')', pos + 1)
|
|
12730
12804
|
content = css.slice(pos, next + 1)
|
|
12731
12805
|
|
|
12732
12806
|
if (next === -1 || RE_BAD_BRACKET.test(content)) {
|
|
12807
|
+
lastBadParen = next === -1 ? length : next
|
|
12733
12808
|
currentToken = ['(', '(', pos]
|
|
12734
12809
|
} else {
|
|
12735
12810
|
currentToken = ['brackets', content, pos, next]
|
|
@@ -13345,15 +13420,6 @@ function getSetAttributesCode(esModule, loaderContext, options) {
|
|
|
13345
13420
|
module.exports = __nccwpck_require__(9023).deprecate;
|
|
13346
13421
|
|
|
13347
13422
|
|
|
13348
|
-
/***/ }),
|
|
13349
|
-
|
|
13350
|
-
/***/ 3707:
|
|
13351
|
-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
13352
|
-
|
|
13353
|
-
module.exports.cssLoader = function() { return __nccwpck_require__(644); };
|
|
13354
|
-
module.exports.styleLoader = function() { return __nccwpck_require__(9318); };
|
|
13355
|
-
module.exports.lightningcssLoader = function() { return __nccwpck_require__(4536); };
|
|
13356
|
-
|
|
13357
13423
|
/***/ }),
|
|
13358
13424
|
|
|
13359
13425
|
/***/ 761:
|
|
@@ -13491,13 +13557,22 @@ let nanoid = (size = 21) => {
|
|
|
13491
13557
|
module.exports = { nanoid, customAlphabet }
|
|
13492
13558
|
|
|
13493
13559
|
|
|
13560
|
+
/***/ }),
|
|
13561
|
+
|
|
13562
|
+
/***/ 7590:
|
|
13563
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
13564
|
+
|
|
13565
|
+
module.exports.cssLoader = function() { return __nccwpck_require__(644); };
|
|
13566
|
+
module.exports.styleLoader = function() { return __nccwpck_require__(9318); };
|
|
13567
|
+
module.exports.lightningcssLoader = function() { return __nccwpck_require__(4536); };
|
|
13568
|
+
|
|
13494
13569
|
/***/ }),
|
|
13495
13570
|
|
|
13496
13571
|
/***/ 2149:
|
|
13497
13572
|
/***/ ((module) => {
|
|
13498
13573
|
|
|
13499
13574
|
"use strict";
|
|
13500
|
-
module.exports = /*#__PURE__*/JSON.parse('{"title":"CSS Loader options","additionalProperties":false,"properties":{"url":{"description":"Allows to enables/disables `url()`/`image-set()` functions handling.","link":"https://github.com/webpack
|
|
13575
|
+
module.exports = /*#__PURE__*/JSON.parse('{"title":"CSS Loader options","additionalProperties":false,"properties":{"url":{"description":"Allows to enables/disables `url()`/`image-set()` functions handling.","link":"https://github.com/webpack/css-loader#url","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"import":{"description":"Allows to enables/disables `@import` at-rules handling.","link":"https://github.com/webpack/css-loader#import","anyOf":[{"type":"boolean"},{"type":"object","properties":{"filter":{"instanceof":"Function"}},"additionalProperties":false}]},"modules":{"description":"Allows to enable/disable CSS Modules or ICSS and setup configuration.","link":"https://github.com/webpack/css-loader#modules","anyOf":[{"type":"boolean"},{"enum":["local","global","pure","icss"]},{"type":"object","additionalProperties":false,"properties":{"auto":{"description":"Allows auto enable CSS modules based on filename.","link":"https://github.com/webpack/css-loader#auto","anyOf":[{"instanceof":"RegExp"},{"instanceof":"Function"},{"type":"boolean"}]},"mode":{"description":"Setup `mode` option.","link":"https://github.com/webpack/css-loader#mode","anyOf":[{"enum":["local","global","pure","icss"]},{"instanceof":"Function"}]},"localIdentName":{"description":"Allows to configure the generated local ident name.","link":"https://github.com/webpack/css-loader#localidentname","type":"string","minLength":1},"localIdentContext":{"description":"Allows to redefine basic loader context for local ident name.","link":"https://github.com/webpack/css-loader#localidentcontext","type":"string","minLength":1},"localIdentHashSalt":{"description":"Allows to add custom hash to generate more unique classes.","link":"https://github.com/webpack/css-loader#localidenthashsalt","type":"string","minLength":1},"localIdentHashFunction":{"description":"Allows to specify hash function to generate classes.","link":"https://github.com/webpack/css-loader#localidenthashfunction","type":"string","minLength":1},"localIdentHashDigest":{"description":"Allows to specify hash digest to generate classes.","link":"https://github.com/webpack/css-loader#localidenthashdigest","type":"string","minLength":1},"localIdentHashDigestLength":{"description":"Allows to specify hash digest length to generate classes.","link":"https://github.com/webpack/css-loader#localidenthashdigestlength","type":"number"},"hashStrategy":{"description":"Allows to specify should localName be used when computing the hash.","link":"https://github.com/webpack/css-loader#hashstrategy","enum":["resource-path-and-local-name","minimal-subset"]},"localIdentRegExp":{"description":"Allows to specify custom RegExp for local ident name.","link":"https://github.com/webpack/css-loader#localidentregexp","anyOf":[{"type":"string","minLength":1},{"instanceof":"RegExp"}]},"getLocalIdent":{"description":"Allows to specify a function to generate the classname.","link":"https://github.com/webpack/css-loader#getlocalident","instanceof":"Function"},"namedExport":{"description":"Enables/disables ES modules named export for locals.","link":"https://github.com/webpack/css-loader#namedexport","type":"boolean"},"exportGlobals":{"description":"Allows to export names from global class or id, so you can use that as local name.","link":"https://github.com/webpack/css-loader#exportglobals","type":"boolean"},"exportLocalsConvention":{"description":"Style of exported classnames.","link":"https://github.com/webpack/css-loader#localsconvention","anyOf":[{"enum":["asIs","as-is","camelCase","camel-case","camelCaseOnly","camel-case-only","dashes","dashesOnly","dashes-only"]},{"instanceof":"Function"}]},"exportOnlyLocals":{"description":"Export only locals.","link":"https://github.com/webpack/css-loader#exportonlylocals","type":"boolean"},"getJSON":{"description":"Allows outputting of CSS modules mapping through a callback.","link":"https://github.com/webpack/css-loader#getJSON","instanceof":"Function"}}}]},"sourceMap":{"description":"Allows to enable/disable source maps.","link":"https://github.com/webpack/css-loader#sourcemap","type":"boolean"},"importLoaders":{"description":"Allows enables/disables or setups number of loaders applied before CSS loader for `@import`/CSS Modules and ICSS imports.","link":"https://github.com/webpack/css-loader#importloaders","anyOf":[{"type":"boolean"},{"type":"string"},{"type":"integer"}]},"esModule":{"description":"Use the ES modules syntax.","link":"https://github.com/webpack/css-loader#esmodule","type":"boolean"},"exportType":{"description":"Allows exporting styles as array with modules, string or constructable stylesheet (i.e. `CSSStyleSheet`).","link":"https://github.com/webpack/css-loader#exporttype","enum":["array","string","css-style-sheet"]}},"type":"object"}');
|
|
13501
13576
|
|
|
13502
13577
|
/***/ }),
|
|
13503
13578
|
|
|
@@ -13505,7 +13580,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"title":"CSS Loader options","additio
|
|
|
13505
13580
|
/***/ ((module) => {
|
|
13506
13581
|
|
|
13507
13582
|
"use strict";
|
|
13508
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"postcss","version":"8.5.
|
|
13583
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"postcss","version":"8.5.12","description":"Tool for transforming styles with JS plugins","keywords":["css","manipulation","parser","postcss","preprocessor","rework","source map","transform","transpiler"],"homepage":"https://postcss.org/","bugs":{"url":"https://github.com/postcss/postcss/issues"},"license":"MIT","author":"Andrey Sitnik <andrey@sitnik.es>","repository":"postcss/postcss","funding":[{"type":"opencollective","url":"https://opencollective.com/postcss/"},{"type":"tidelift","url":"https://tidelift.com/funding/github/npm/postcss"},{"type":"github","url":"https://github.com/sponsors/ai"}],"main":"./lib/postcss.js","browser":{"./lib/terminal-highlight":false,"source-map-js":false,"path":false,"url":false,"fs":false},"types":"./lib/postcss.d.ts","exports":{".":{"import":"./lib/postcss.mjs","require":"./lib/postcss.js"},"./lib/at-rule":"./lib/at-rule.js","./lib/comment":"./lib/comment.js","./lib/container":"./lib/container.js","./lib/css-syntax-error":"./lib/css-syntax-error.js","./lib/declaration":"./lib/declaration.js","./lib/fromJSON":"./lib/fromJSON.js","./lib/input":"./lib/input.js","./lib/lazy-result":"./lib/lazy-result.js","./lib/no-work-result":"./lib/no-work-result.js","./lib/list":"./lib/list.js","./lib/map-generator":"./lib/map-generator.js","./lib/node":"./lib/node.js","./lib/parse":"./lib/parse.js","./lib/parser":"./lib/parser.js","./lib/postcss":"./lib/postcss.js","./lib/previous-map":"./lib/previous-map.js","./lib/processor":"./lib/processor.js","./lib/result":"./lib/result.js","./lib/root":"./lib/root.js","./lib/rule":"./lib/rule.js","./lib/stringifier":"./lib/stringifier.js","./lib/stringify":"./lib/stringify.js","./lib/symbols":"./lib/symbols.js","./lib/terminal-highlight":"./lib/terminal-highlight.js","./lib/tokenize":"./lib/tokenize.js","./lib/warn-once":"./lib/warn-once.js","./lib/warning":"./lib/warning.js","./package.json":"./package.json"},"dependencies":{"nanoid":"^3.3.11","picocolors":"^1.1.1","source-map-js":"^1.2.1"},"engines":{"node":"^10 || ^12 || >=14"}}');
|
|
13509
13584
|
|
|
13510
13585
|
/***/ }),
|
|
13511
13586
|
|
|
@@ -13559,7 +13634,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"title":"Style Loader options","type"
|
|
|
13559
13634
|
/******/ // startup
|
|
13560
13635
|
/******/ // Load entry module and return exports
|
|
13561
13636
|
/******/ // This entry module used 'module' so it can't be inlined
|
|
13562
|
-
/******/ var __webpack_exports__ = __nccwpck_require__(
|
|
13637
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(7590);
|
|
13563
13638
|
/******/ module.exports = __webpack_exports__;
|
|
13564
13639
|
/******/
|
|
13565
13640
|
/******/ })()
|