@swissquote/crafty-preset-lightningcss 1.29.0-beta.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.
|
@@ -2444,7 +2444,7 @@ module.exports = replaceValueSymbols;
|
|
|
2444
2444
|
|
|
2445
2445
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2446
2446
|
exports.LightningCssMinifyPlugin = void 0;
|
|
2447
|
-
|
|
2447
|
+
const loader_1 = __nccwpck_require__(4461);
|
|
2448
2448
|
var minify_1 = __nccwpck_require__(5476);
|
|
2449
2449
|
Object.defineProperty(exports, "LightningCssMinifyPlugin", ({ enumerable: true, get: function () { return minify_1.LightningCssMinifyPlugin; } }));
|
|
2450
2450
|
exports["default"] = loader_1.LightningCssLoader;
|
|
@@ -2463,7 +2463,7 @@ var ECacheKey;
|
|
|
2463
2463
|
(function (ECacheKey) {
|
|
2464
2464
|
ECacheKey["loader"] = "loader";
|
|
2465
2465
|
ECacheKey["minify"] = "minify";
|
|
2466
|
-
})(ECacheKey
|
|
2466
|
+
})(ECacheKey || (exports.ECacheKey = ECacheKey = {}));
|
|
2467
2467
|
|
|
2468
2468
|
|
|
2469
2469
|
/***/ }),
|
|
@@ -2473,17 +2473,6 @@ var ECacheKey;
|
|
|
2473
2473
|
|
|
2474
2474
|
"use strict";
|
|
2475
2475
|
|
|
2476
|
-
var __assign = (this && this.__assign) || function () {
|
|
2477
|
-
__assign = Object.assign || function(t) {
|
|
2478
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2479
|
-
s = arguments[i];
|
|
2480
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
2481
|
-
t[p] = s[p];
|
|
2482
|
-
}
|
|
2483
|
-
return t;
|
|
2484
|
-
};
|
|
2485
|
-
return __assign.apply(this, arguments);
|
|
2486
|
-
};
|
|
2487
2476
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2488
2477
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2489
2478
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -2493,33 +2482,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
2493
2482
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2494
2483
|
});
|
|
2495
2484
|
};
|
|
2496
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
2497
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2498
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2499
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2500
|
-
function step(op) {
|
|
2501
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2502
|
-
while (_) try {
|
|
2503
|
-
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;
|
|
2504
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2505
|
-
switch (op[0]) {
|
|
2506
|
-
case 0: case 1: t = op; break;
|
|
2507
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
2508
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2509
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2510
|
-
default:
|
|
2511
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2512
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2513
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2514
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2515
|
-
if (t[2]) _.ops.pop();
|
|
2516
|
-
_.trys.pop(); continue;
|
|
2517
|
-
}
|
|
2518
|
-
op = body.call(thisArg, _);
|
|
2519
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2520
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2521
|
-
}
|
|
2522
|
-
};
|
|
2523
2485
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2524
2486
|
var t = {};
|
|
2525
2487
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -2531,39 +2493,73 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
2531
2493
|
}
|
|
2532
2494
|
return t;
|
|
2533
2495
|
};
|
|
2496
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2497
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2498
|
+
};
|
|
2534
2499
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2535
|
-
exports.LightningCssLoader =
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
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
|
+
};
|
|
2541
2517
|
function LightningCssLoader(source, prevMap) {
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
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
|
+
}
|
|
2561
2558
|
}
|
|
2562
|
-
|
|
2563
|
-
}
|
|
2559
|
+
done(error);
|
|
2560
|
+
}
|
|
2564
2561
|
});
|
|
2565
2562
|
}
|
|
2566
|
-
exports.LightningCssLoader = LightningCssLoader;
|
|
2567
2563
|
|
|
2568
2564
|
|
|
2569
2565
|
/***/ }),
|
|
@@ -2573,17 +2569,6 @@ exports.LightningCssLoader = LightningCssLoader;
|
|
|
2573
2569
|
|
|
2574
2570
|
"use strict";
|
|
2575
2571
|
|
|
2576
|
-
var __assign = (this && this.__assign) || function () {
|
|
2577
|
-
__assign = Object.assign || function(t) {
|
|
2578
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2579
|
-
s = arguments[i];
|
|
2580
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
2581
|
-
t[p] = s[p];
|
|
2582
|
-
}
|
|
2583
|
-
return t;
|
|
2584
|
-
};
|
|
2585
|
-
return __assign.apply(this, arguments);
|
|
2586
|
-
};
|
|
2587
2572
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2588
2573
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2589
2574
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -2593,33 +2578,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
2593
2578
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2594
2579
|
});
|
|
2595
2580
|
};
|
|
2596
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
2597
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2598
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2599
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2600
|
-
function step(op) {
|
|
2601
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2602
|
-
while (_) try {
|
|
2603
|
-
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;
|
|
2604
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2605
|
-
switch (op[0]) {
|
|
2606
|
-
case 0: case 1: t = op; break;
|
|
2607
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
2608
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2609
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2610
|
-
default:
|
|
2611
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2612
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2613
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2614
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2615
|
-
if (t[2]) _.ops.pop();
|
|
2616
|
-
_.trys.pop(); continue;
|
|
2617
|
-
}
|
|
2618
|
-
op = body.call(thisArg, _);
|
|
2619
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2620
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2621
|
-
}
|
|
2622
|
-
};
|
|
2623
2581
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2624
2582
|
var t = {};
|
|
2625
2583
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -2634,124 +2592,144 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
2634
2592
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2635
2593
|
exports.LightningCssMinifyPlugin = void 0;
|
|
2636
2594
|
// @ts-ignore
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
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 = {}) {
|
|
2651
2608
|
var _a;
|
|
2652
|
-
|
|
2609
|
+
const { implementation } = opts, otherOpts = __rest(opts, ["implementation"]);
|
|
2653
2610
|
if (implementation && typeof implementation.transform !== 'function') {
|
|
2654
|
-
throw new TypeError(
|
|
2611
|
+
throw new TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof implementation.transform}`);
|
|
2655
2612
|
}
|
|
2656
2613
|
this.transform = (_a = implementation === null || implementation === void 0 ? void 0 : implementation.transform) !== null && _a !== void 0 ? _a : lightningcss_1.transform;
|
|
2657
2614
|
this.options = otherOpts;
|
|
2658
2615
|
}
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
var meta = JSON.stringify({
|
|
2616
|
+
apply(compiler) {
|
|
2617
|
+
const meta = JSON.stringify({
|
|
2662
2618
|
name: pkg.name,
|
|
2663
2619
|
version: pkg.version,
|
|
2664
2620
|
options: this.options,
|
|
2665
2621
|
});
|
|
2666
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME,
|
|
2667
|
-
compilation.hooks.chunkHash.tap(PLUGIN_NAME,
|
|
2668
|
-
return hash.update(meta);
|
|
2669
|
-
});
|
|
2622
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
2623
|
+
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash) => hash.update(meta));
|
|
2670
2624
|
if ((0, utils_1.isWebpack5)(compilation)) {
|
|
2671
2625
|
compilation.hooks.processAssets.tapPromise({
|
|
2672
2626
|
name: PLUGIN_NAME,
|
|
2673
2627
|
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
|
|
2674
2628
|
additionalAssets: true,
|
|
2675
|
-
},
|
|
2676
|
-
|
|
2677
|
-
case 0: return [4 /*yield*/, this.transformAssets(compilation)];
|
|
2678
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
2679
|
-
}
|
|
2680
|
-
}); }); });
|
|
2681
|
-
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) => {
|
|
2682
2631
|
statsPrinter.hooks.print
|
|
2683
2632
|
.for('asset.info.minimized')
|
|
2684
2633
|
// @ts-ignore
|
|
2685
|
-
.tap(PLUGIN_NAME,
|
|
2686
|
-
var green = _a.green, formatFlag = _a.formatFlag;
|
|
2634
|
+
.tap(PLUGIN_NAME, (minimized, { green, formatFlag }) => {
|
|
2687
2635
|
// @ts-ignore
|
|
2688
2636
|
return minimized ? green(formatFlag('minimized')) : undefined;
|
|
2689
2637
|
});
|
|
2690
2638
|
});
|
|
2691
2639
|
}
|
|
2692
2640
|
else {
|
|
2693
|
-
compilation.hooks.optimizeChunkAssets.tapPromise(PLUGIN_NAME,
|
|
2694
|
-
switch (_a.label) {
|
|
2695
|
-
case 0: return [4 /*yield*/, this.transformAssets(compilation)];
|
|
2696
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
2697
|
-
}
|
|
2698
|
-
}); }); });
|
|
2641
|
+
compilation.hooks.optimizeChunkAssets.tapPromise(PLUGIN_NAME, () => __awaiter(this, void 0, void 0, function* () { return yield this.transformAssets(compilation); }));
|
|
2699
2642
|
}
|
|
2700
2643
|
});
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
_a = asset.source.sourceAndMap(), source = _a.source, map = _a.map;
|
|
2727
|
-
sourceAsString = source.toString();
|
|
2728
|
-
code = typeof source === 'string' ? buffer_1.Buffer.from(source) : source;
|
|
2729
|
-
targets = (0, utils_1.getTargets)({
|
|
2730
|
-
default: userTargets,
|
|
2731
|
-
key: interface_1.ECacheKey.minify,
|
|
2732
|
-
});
|
|
2733
|
-
return [4 /*yield*/, this.transform(__assign({ filename: asset.name, code: code, minify: true, sourceMap: sourcemap, targets: targets }, transformOptions))];
|
|
2734
|
-
case 1:
|
|
2735
|
-
result = _b.sent();
|
|
2736
|
-
codeString = result.code.toString();
|
|
2737
|
-
compilation.updateAsset(asset.name,
|
|
2738
|
-
// @ts-ignore
|
|
2739
|
-
sourcemap
|
|
2740
|
-
? new webpack_sources_1.SourceMapSource(codeString, asset.name, JSON.parse(result.map.toString()), sourceAsString, map, true)
|
|
2741
|
-
: new webpack_sources_1.RawSource(codeString), __assign(__assign({}, asset.info), { minimized: true }));
|
|
2742
|
-
return [2 /*return*/];
|
|
2743
|
-
}
|
|
2744
|
-
});
|
|
2745
|
-
}); }))];
|
|
2746
|
-
case 1:
|
|
2747
|
-
_b.sent();
|
|
2748
|
-
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));
|
|
2749
2669
|
}
|
|
2750
|
-
|
|
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
|
+
})));
|
|
2751
2730
|
});
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
|
-
}());
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2755
2733
|
exports.LightningCssMinifyPlugin = LightningCssMinifyPlugin;
|
|
2756
2734
|
|
|
2757
2735
|
|
|
@@ -2767,23 +2745,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2767
2745
|
};
|
|
2768
2746
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2769
2747
|
exports.getTargets = exports.isWebpack5 = void 0;
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2748
|
+
const browserslist_1 = __importDefault(__nccwpck_require__(6732));
|
|
2749
|
+
const lightningcss_1 = __nccwpck_require__(9446);
|
|
2750
|
+
const isWebpack5 = (compilation) => 'processAssets' in compilation.hooks;
|
|
2773
2751
|
exports.isWebpack5 = isWebpack5;
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2752
|
+
let targetsCache = {};
|
|
2753
|
+
const getTargets = (opts) => {
|
|
2754
|
+
const cache = targetsCache[opts.key];
|
|
2777
2755
|
if (cache) {
|
|
2778
2756
|
return cache;
|
|
2779
2757
|
}
|
|
2780
|
-
|
|
2781
|
-
|
|
2758
|
+
const cwd = process.cwd();
|
|
2759
|
+
const result = (0, browserslist_1.default)(opts.default, {
|
|
2782
2760
|
path: cwd,
|
|
2783
2761
|
env: process.env.NODE_ENV || 'production',
|
|
2784
2762
|
});
|
|
2785
2763
|
targetsCache[opts.key] = (0, lightningcss_1.browserslistToTargets)(result);
|
|
2786
|
-
return
|
|
2764
|
+
return targetsCache[opts.key];
|
|
2787
2765
|
};
|
|
2788
2766
|
exports.getTargets = getTargets;
|
|
2789
2767
|
|
|
@@ -9244,7 +9222,15 @@ class Input {
|
|
|
9244
9222
|
)
|
|
9245
9223
|
}
|
|
9246
9224
|
|
|
9247
|
-
result.input = {
|
|
9225
|
+
result.input = {
|
|
9226
|
+
column,
|
|
9227
|
+
endColumn,
|
|
9228
|
+
endLine,
|
|
9229
|
+
endOffset,
|
|
9230
|
+
line,
|
|
9231
|
+
offset,
|
|
9232
|
+
source: this.css
|
|
9233
|
+
}
|
|
9248
9234
|
if (this.file) {
|
|
9249
9235
|
if (pathToFileURL) {
|
|
9250
9236
|
result.input.url = pathToFileURL(this.file).toString()
|
|
@@ -9753,6 +9739,16 @@ class LazyResult {
|
|
|
9753
9739
|
if (opts.stringifier) str = opts.stringifier
|
|
9754
9740
|
if (str.stringify) str = str.stringify
|
|
9755
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
|
+
|
|
9756
9752
|
let map = new MapGenerator(str, this.result.root, this.result.opts)
|
|
9757
9753
|
let data = map.generate()
|
|
9758
9754
|
this.result.css = data[0]
|
|
@@ -10074,7 +10070,15 @@ class MapGenerator {
|
|
|
10074
10070
|
}
|
|
10075
10071
|
}
|
|
10076
10072
|
} else if (this.css) {
|
|
10077
|
-
|
|
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
|
+
}
|
|
10078
10082
|
}
|
|
10079
10083
|
}
|
|
10080
10084
|
|
|
@@ -10377,7 +10381,7 @@ module.exports = MapGenerator
|
|
|
10377
10381
|
|
|
10378
10382
|
let MapGenerator = __nccwpck_require__(2079)
|
|
10379
10383
|
let parse = __nccwpck_require__(9110)
|
|
10380
|
-
|
|
10384
|
+
let Result = __nccwpck_require__(3264)
|
|
10381
10385
|
let stringify = __nccwpck_require__(5720)
|
|
10382
10386
|
let warnOnce = __nccwpck_require__(5979)
|
|
10383
10387
|
|
|
@@ -10440,10 +10444,9 @@ class NoWorkResult {
|
|
|
10440
10444
|
this._css = css
|
|
10441
10445
|
this._opts = opts
|
|
10442
10446
|
this._map = undefined
|
|
10443
|
-
let root
|
|
10444
10447
|
|
|
10445
10448
|
let str = stringify
|
|
10446
|
-
this.result = new Result(this._processor,
|
|
10449
|
+
this.result = new Result(this._processor, undefined, this._opts)
|
|
10447
10450
|
this.result.css = css
|
|
10448
10451
|
|
|
10449
10452
|
let self = this
|
|
@@ -10453,7 +10456,7 @@ class NoWorkResult {
|
|
|
10453
10456
|
}
|
|
10454
10457
|
})
|
|
10455
10458
|
|
|
10456
|
-
let map = new MapGenerator(str,
|
|
10459
|
+
let map = new MapGenerator(str, undefined, this._opts, css)
|
|
10457
10460
|
if (map.isMap()) {
|
|
10458
10461
|
let [generatedCSS, generatedMap] = map.generate()
|
|
10459
10462
|
if (generatedCSS) {
|
|
@@ -11204,7 +11207,7 @@ class Parser {
|
|
|
11204
11207
|
node.source.end.offset++
|
|
11205
11208
|
|
|
11206
11209
|
let text = token[1].slice(2, -2)
|
|
11207
|
-
if (
|
|
11210
|
+
if (!text.trim()) {
|
|
11208
11211
|
node.text = ''
|
|
11209
11212
|
node.raws.left = text
|
|
11210
11213
|
node.raws.right = ''
|
|
@@ -11772,6 +11775,7 @@ function fromBase64(str) {
|
|
|
11772
11775
|
class PreviousMap {
|
|
11773
11776
|
constructor(css, opts) {
|
|
11774
11777
|
if (opts.map === false) return
|
|
11778
|
+
if (opts.unsafeMap) this.unsafeMap = true
|
|
11775
11779
|
this.loadAnnotation(css)
|
|
11776
11780
|
this.inline = this.startWith(this.annotation, 'data:')
|
|
11777
11781
|
|
|
@@ -11786,7 +11790,7 @@ class PreviousMap {
|
|
|
11786
11790
|
|
|
11787
11791
|
consumer() {
|
|
11788
11792
|
if (!this.consumerCache) {
|
|
11789
|
-
this.consumerCache = new SourceMapConsumer(this.text)
|
|
11793
|
+
this.consumerCache = new SourceMapConsumer(this.json || this.text)
|
|
11790
11794
|
}
|
|
11791
11795
|
return this.consumerCache
|
|
11792
11796
|
}
|
|
@@ -11807,7 +11811,8 @@ class PreviousMap {
|
|
|
11807
11811
|
return fromBase64(text.substr(baseUriMatch[0].length))
|
|
11808
11812
|
}
|
|
11809
11813
|
|
|
11810
|
-
let encoding = text.
|
|
11814
|
+
let encoding = text.slice('data:application/json;'.length)
|
|
11815
|
+
encoding = encoding.slice(0, encoding.indexOf(','))
|
|
11811
11816
|
throw new Error('Unsupported source map encoding ' + encoding)
|
|
11812
11817
|
}
|
|
11813
11818
|
|
|
@@ -11838,7 +11843,13 @@ class PreviousMap {
|
|
|
11838
11843
|
}
|
|
11839
11844
|
}
|
|
11840
11845
|
|
|
11841
|
-
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
|
+
}
|
|
11842
11853
|
this.root = dirname(path)
|
|
11843
11854
|
if (existsSync(path)) {
|
|
11844
11855
|
this.mapFile = path
|
|
@@ -11855,7 +11866,7 @@ class PreviousMap {
|
|
|
11855
11866
|
} else if (typeof prev === 'function') {
|
|
11856
11867
|
let prevPath = prev(file)
|
|
11857
11868
|
if (prevPath) {
|
|
11858
|
-
let map = this.loadFile(prevPath)
|
|
11869
|
+
let map = this.loadFile(prevPath, file, true)
|
|
11859
11870
|
if (!map) {
|
|
11860
11871
|
throw new Error(
|
|
11861
11872
|
'Unable to load previous source map: ' + prevPath.toString()
|
|
@@ -11879,7 +11890,16 @@ class PreviousMap {
|
|
|
11879
11890
|
} else if (this.annotation) {
|
|
11880
11891
|
let map = this.annotation
|
|
11881
11892
|
if (file) map = join(dirname(file), map)
|
|
11882
|
-
|
|
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
|
|
11883
11903
|
}
|
|
11884
11904
|
}
|
|
11885
11905
|
|
|
@@ -11915,7 +11935,7 @@ let Root = __nccwpck_require__(6265)
|
|
|
11915
11935
|
|
|
11916
11936
|
class Processor {
|
|
11917
11937
|
constructor(plugins = []) {
|
|
11918
|
-
this.version = '8.5.
|
|
11938
|
+
this.version = '8.5.12'
|
|
11919
11939
|
this.plugins = this.normalize(plugins)
|
|
11920
11940
|
}
|
|
11921
11941
|
|
|
@@ -12137,6 +12157,18 @@ Container.registerRule(Rule)
|
|
|
12137
12157
|
"use strict";
|
|
12138
12158
|
|
|
12139
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
|
+
|
|
12140
12172
|
const DEFAULT_RAW = {
|
|
12141
12173
|
after: '\n',
|
|
12142
12174
|
beforeClose: '\n',
|
|
@@ -12162,11 +12194,12 @@ class Stringifier {
|
|
|
12162
12194
|
}
|
|
12163
12195
|
|
|
12164
12196
|
atrule(node, semicolon) {
|
|
12197
|
+
let raws = node.raws
|
|
12165
12198
|
let name = '@' + node.name
|
|
12166
12199
|
let params = node.params ? this.rawValue(node, 'params') : ''
|
|
12167
12200
|
|
|
12168
|
-
if (typeof
|
|
12169
|
-
name +=
|
|
12201
|
+
if (typeof raws.afterName !== 'undefined') {
|
|
12202
|
+
name += raws.afterName
|
|
12170
12203
|
} else if (params) {
|
|
12171
12204
|
name += ' '
|
|
12172
12205
|
}
|
|
@@ -12174,8 +12207,8 @@ class Stringifier {
|
|
|
12174
12207
|
if (node.nodes) {
|
|
12175
12208
|
this.block(node, name + params)
|
|
12176
12209
|
} else {
|
|
12177
|
-
let end = (
|
|
12178
|
-
this.builder(name + params + end, node)
|
|
12210
|
+
let end = (raws.between || '') + (semicolon ? ';' : '')
|
|
12211
|
+
this.builder(escapeHTMLInCSS(name + params + end), node)
|
|
12179
12212
|
}
|
|
12180
12213
|
}
|
|
12181
12214
|
|
|
@@ -12209,53 +12242,77 @@ class Stringifier {
|
|
|
12209
12242
|
}
|
|
12210
12243
|
|
|
12211
12244
|
block(node, start) {
|
|
12212
|
-
let
|
|
12213
|
-
|
|
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')
|
|
12214
12250
|
|
|
12215
12251
|
let after
|
|
12216
12252
|
if (node.nodes && node.nodes.length) {
|
|
12217
12253
|
this.body(node)
|
|
12218
|
-
after =
|
|
12254
|
+
after = typeof raws.after !== 'undefined'
|
|
12255
|
+
? raws.after
|
|
12256
|
+
: this.raw(node, 'after')
|
|
12219
12257
|
} else {
|
|
12220
|
-
after =
|
|
12258
|
+
after = typeof raws.after !== 'undefined'
|
|
12259
|
+
? raws.after
|
|
12260
|
+
: this.raw(node, 'after', 'emptyBody')
|
|
12221
12261
|
}
|
|
12222
12262
|
|
|
12223
|
-
if (after) this.builder(after)
|
|
12263
|
+
if (after) this.builder(escapeHTMLInCSS(after))
|
|
12224
12264
|
this.builder('}', node, 'end')
|
|
12225
12265
|
}
|
|
12226
12266
|
|
|
12227
12267
|
body(node) {
|
|
12228
|
-
let
|
|
12268
|
+
let nodes = node.nodes
|
|
12269
|
+
let last = nodes.length - 1
|
|
12229
12270
|
while (last > 0) {
|
|
12230
|
-
if (
|
|
12271
|
+
if (nodes[last].type !== 'comment') break
|
|
12231
12272
|
last -= 1
|
|
12232
12273
|
}
|
|
12233
12274
|
|
|
12234
12275
|
let semicolon = this.raw(node, 'semicolon')
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
let
|
|
12238
|
-
|
|
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))
|
|
12239
12284
|
this.stringify(child, last !== i || semicolon)
|
|
12240
12285
|
}
|
|
12241
12286
|
}
|
|
12242
12287
|
|
|
12243
12288
|
comment(node) {
|
|
12244
|
-
let
|
|
12245
|
-
let
|
|
12246
|
-
|
|
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)
|
|
12247
12297
|
}
|
|
12248
12298
|
|
|
12249
12299
|
decl(node, semicolon) {
|
|
12250
|
-
let
|
|
12251
|
-
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
|
|
12252
12309
|
|
|
12253
12310
|
if (node.important) {
|
|
12254
|
-
string +=
|
|
12311
|
+
string += raws.important || ' !important'
|
|
12255
12312
|
}
|
|
12256
12313
|
|
|
12257
12314
|
if (semicolon) string += ';'
|
|
12258
|
-
this.builder(string, node)
|
|
12315
|
+
this.builder(escapeHTMLInCSS(string), node)
|
|
12259
12316
|
}
|
|
12260
12317
|
|
|
12261
12318
|
document(node) {
|
|
@@ -12291,9 +12348,9 @@ class Stringifier {
|
|
|
12291
12348
|
|
|
12292
12349
|
// Detect style by other nodes
|
|
12293
12350
|
let root = node.root()
|
|
12294
|
-
|
|
12295
|
-
if (typeof
|
|
12296
|
-
return
|
|
12351
|
+
let cache = root.rawCache || (root.rawCache = {})
|
|
12352
|
+
if (typeof cache[detect] !== 'undefined') {
|
|
12353
|
+
return cache[detect]
|
|
12297
12354
|
}
|
|
12298
12355
|
|
|
12299
12356
|
if (detect === 'before' || detect === 'after') {
|
|
@@ -12312,7 +12369,7 @@ class Stringifier {
|
|
|
12312
12369
|
|
|
12313
12370
|
if (typeof value === 'undefined') value = DEFAULT_RAW[detect]
|
|
12314
12371
|
|
|
12315
|
-
|
|
12372
|
+
cache[detect] = value
|
|
12316
12373
|
return value
|
|
12317
12374
|
}
|
|
12318
12375
|
|
|
@@ -12461,13 +12518,17 @@ class Stringifier {
|
|
|
12461
12518
|
|
|
12462
12519
|
root(node) {
|
|
12463
12520
|
this.body(node)
|
|
12464
|
-
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
|
+
}
|
|
12465
12526
|
}
|
|
12466
12527
|
|
|
12467
12528
|
rule(node) {
|
|
12468
12529
|
this.block(node, this.rawValue(node, 'selector'))
|
|
12469
12530
|
if (node.raws.ownSemicolon) {
|
|
12470
|
-
this.builder(node.raws.ownSemicolon, node, 'end')
|
|
12531
|
+
this.builder(escapeHTMLInCSS(node.raws.ownSemicolon), node, 'end')
|
|
12471
12532
|
}
|
|
12472
12533
|
}
|
|
12473
12534
|
|
|
@@ -12644,6 +12705,7 @@ module.exports = function tokenizer(input, options = {}) {
|
|
|
12644
12705
|
let pos = 0
|
|
12645
12706
|
let buffer = []
|
|
12646
12707
|
let returned = []
|
|
12708
|
+
let lastBadParen = -1
|
|
12647
12709
|
|
|
12648
12710
|
function position() {
|
|
12649
12711
|
return pos
|
|
@@ -12735,11 +12797,14 @@ module.exports = function tokenizer(input, options = {}) {
|
|
|
12735
12797
|
currentToken = ['brackets', css.slice(pos, next + 1), pos, next]
|
|
12736
12798
|
|
|
12737
12799
|
pos = next
|
|
12800
|
+
} else if (pos <= lastBadParen) {
|
|
12801
|
+
currentToken = ['(', '(', pos]
|
|
12738
12802
|
} else {
|
|
12739
12803
|
next = css.indexOf(')', pos + 1)
|
|
12740
12804
|
content = css.slice(pos, next + 1)
|
|
12741
12805
|
|
|
12742
12806
|
if (next === -1 || RE_BAD_BRACKET.test(content)) {
|
|
12807
|
+
lastBadParen = next === -1 ? length : next
|
|
12743
12808
|
currentToken = ['(', '(', pos]
|
|
12744
12809
|
} else {
|
|
12745
12810
|
currentToken = ['brackets', content, pos, next]
|
|
@@ -13515,7 +13580,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"title":"CSS Loader options","additio
|
|
|
13515
13580
|
/***/ ((module) => {
|
|
13516
13581
|
|
|
13517
13582
|
"use strict";
|
|
13518
|
-
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"}}');
|
|
13519
13584
|
|
|
13520
13585
|
/***/ }),
|
|
13521
13586
|
|