source: trip-planner-front/node_modules/stylehacks/dist/index.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[6a3a178]1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var _browserslist = _interopRequireDefault(require("browserslist"));
9
10var _plugins = _interopRequireDefault(require("./plugins"));
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14function pluginCreator(opts = {}) {
15 return {
16 postcssPlugin: 'stylehacks',
17
18 OnceExit(css, {
19 result
20 }) {
21 const resultOpts = result.opts || {};
22 const browsers = (0, _browserslist.default)(null, {
23 stats: resultOpts.stats,
24 path: __dirname,
25 env: resultOpts.env
26 });
27
28 const processors = _plugins.default.reduce((list, Plugin) => {
29 const hack = new Plugin(result);
30 const applied = browsers.some(browser => {
31 return hack.targets.some(target => browser === target);
32 });
33
34 if (applied) {
35 return list;
36 }
37
38 return [...list, hack];
39 }, []);
40
41 css.walk(node => {
42 processors.forEach(proc => {
43 if (!~proc.nodeTypes.indexOf(node.type)) {
44 return;
45 }
46
47 if (opts.lint) {
48 return proc.detectAndWarn(node);
49 }
50
51 return proc.detectAndResolve(node);
52 });
53 });
54 }
55
56 };
57}
58
59pluginCreator.detect = node => {
60 return _plugins.default.some(Plugin => {
61 const hack = new Plugin();
62 return hack.any(node);
63 });
64};
65
66pluginCreator.postcss = true;
67var _default = pluginCreator;
68exports.default = _default;
69module.exports = exports.default;
Note: See TracBrowser for help on using the repository browser.