Skip to content

Commit b4ede3a

Browse files
authored
Merge pull request #4 from steveblue/bugfix/version-bumps
feat: version bump all dependencies
2 parents 3b234ff + 32163ce commit b4ede3a

File tree

10 files changed

+5613
-4272
lines changed

10 files changed

+5613
-4272
lines changed

.eslintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"ecmaVersion": 2021
5+
},
6+
"extends": ["plugin:@typescript-eslint/recommended"],
7+
"rules": {
8+
"@typescript-eslint/explicit-module-boundary-types": "off",
9+
"@typescript-eslint/no-explicit-any": "off",
10+
"@typescript-eslint/no-var-requires": "off"
11+
}
12+
}

.eslintrc.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"ecmaVersion": 2021
5+
},
6+
"extends": [
7+
"plugin:@typescript-eslint/recommended",
8+
"prettier/@typescript-eslint",
9+
"plugin:prettier/recommended"
10+
]
11+
}

dist/index.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3+
// rollup-plugin-inline-postcss.js
34
const findup = require("findup");
45
const path = require("path");
5-
const postcss = require("postcss");
6+
const postcss_1 = require("postcss");
67
const rollup_pluginutils_1 = require("rollup-pluginutils");
78
function inlinePostCSS(options = {}) {
89
const filter = rollup_pluginutils_1.createFilter(options.include, options.exclude);
9-
const styleRegex = options.styleRegex ? options.styleRegex : /(css\`((.|\n)*)\`)/g;
10+
const styleRegex = options.styleRegex
11+
? options.styleRegex
12+
: /(css\`((.|\n)*)\`)/g;
1013
return {
11-
name: "inline-postcss",
14+
name: 'inline-postcss',
1215
transform(code, id) {
1316
if (!filter(id)) {
1417
return;
@@ -17,38 +20,43 @@ function inlinePostCSS(options = {}) {
1720
return;
1821
}
1922
let punc = code.match(styleRegex)[0][code.match(styleRegex)[0].length - 1];
20-
if (punc !== "," && punc !== ";") {
23+
if (punc !== ',' && punc !== ';') {
2124
punc = null;
2225
}
2326
try {
2427
let configFolder;
2528
if (!options.plugins) {
26-
configFolder = findup.sync(__dirname, "postcss.config.js");
29+
configFolder = findup.sync(__dirname, 'postcss.config.js');
2730
}
2831
else {
29-
configFolder = "";
32+
configFolder = '';
3033
}
31-
const config = options.plugins ? options.plugins : require(path.join(configFolder, "postcss.config.js"))({
32-
env: process.env.NODE_ENV,
33-
});
34-
const css = code.match(styleRegex)[0].split("`")[1];
35-
const opts = { from: options.from ? path.join(process.cwd(), options.from) : id,
34+
const config = options.plugins
35+
? options.plugins
36+
: require(path.join(configFolder, 'postcss.config.js'))({
37+
env: process.env.NODE_ENV,
38+
});
39+
const css = code.match(styleRegex)[0].split('`')[1];
40+
const opts = {
41+
from: options.from ? path.join(process.cwd(), options.from) : id,
3642
to: options.to ? path.join(process.cwd(), options.to) : id,
3743
map: {
3844
inline: false,
3945
annotation: false,
4046
},
4147
};
42-
const outputConfig = options.plugins ? options.plugins : Object.keys(config.plugins)
43-
.filter((key) => config.plugins[key])
44-
.map((key) => require(key));
45-
return postcss(outputConfig)
48+
const outputConfig = options.plugins
49+
? options.plugins
50+
: Object.keys(config.plugins)
51+
.filter((key) => config.plugins[key])
52+
.map((key) => require(key));
53+
return postcss_1.default(outputConfig)
4654
.process(css, opts)
4755
.then((result) => {
48-
code = code.replace(styleRegex, `\`${result.css}\`${punc ? punc : ""}`);
56+
code = code.replace(styleRegex, `\`${result.css}\`${punc ? punc : ''}`);
4957
const map = result.map
5058
? JSON.parse(result.map)
51-
: { mappings: "" };
59+
: { mappings: '' };
5260
return {
5361
code,
5462
map,

index.ts

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,65 @@
11
// rollup-plugin-inline-postcss.js
2-
import * as cssesc from "cssesc";
3-
import * as findup from "findup";
4-
import * as path from "path";
5-
import * as postcss from "postcss";
6-
import { createFilter } from "rollup-pluginutils";
2+
import * as findup from 'findup';
3+
import * as path from 'path';
4+
import postcss from 'postcss';
5+
import { createFilter } from 'rollup-pluginutils';
76

87
export default function inlinePostCSS(options: any = {}) {
98
const filter = createFilter(options.include, options.exclude);
10-
const styleRegex = options.styleRegex ? options.styleRegex : /(css\`((.|\n)*)\`)/g;
9+
const styleRegex = options.styleRegex
10+
? options.styleRegex
11+
: /(css\`((.|\n)*)\`)/g;
1112
return {
12-
name: "inline-postcss",
13+
name: 'inline-postcss',
1314
transform(code, id) {
1415
if (!filter(id)) {
15-
return;
16+
return;
1617
}
1718
if (!code.match(styleRegex)) {
18-
return;
19+
return;
1920
}
20-
let punc = code.match(styleRegex)[0][code.match(styleRegex)[0].length - 1];
21-
if (punc !== "," && punc !== ";") {
21+
let punc = code.match(styleRegex)[0][
22+
code.match(styleRegex)[0].length - 1
23+
];
24+
if (punc !== ',' && punc !== ';') {
2225
punc = null;
2326
}
2427
try {
2528
let configFolder;
2629
if (!options.plugins) {
27-
configFolder = findup.sync(__dirname, "postcss.config.js");
30+
configFolder = findup.sync(__dirname, 'postcss.config.js');
2831
} else {
29-
configFolder = "";
32+
configFolder = '';
3033
}
31-
const config = options.plugins ? options.plugins : require(path.join(configFolder, "postcss.config.js"))({
32-
env: process.env.NODE_ENV,
33-
});
34-
const css = code.match(styleRegex)[0].split("`")[1];
35-
const opts = { from: options.from ? path.join(process.cwd(), options.from) : id,
34+
const config = options.plugins
35+
? options.plugins
36+
: require(path.join(configFolder, 'postcss.config.js'))({
37+
env: process.env.NODE_ENV,
38+
});
39+
const css = code.match(styleRegex)[0].split('`')[1];
40+
const opts = {
41+
from: options.from ? path.join(process.cwd(), options.from) : id,
3642
to: options.to ? path.join(process.cwd(), options.to) : id,
3743
map: {
3844
inline: false,
3945
annotation: false,
4046
},
4147
};
42-
const outputConfig = options.plugins ? options.plugins : Object.keys(config.plugins)
43-
.filter((key) => config.plugins[key])
44-
.map((key) => require(key));
48+
const outputConfig = options.plugins
49+
? options.plugins
50+
: Object.keys(config.plugins)
51+
.filter((key) => config.plugins[key])
52+
.map((key) => require(key));
4553
return postcss(outputConfig)
4654
.process(css, opts)
4755
.then((result) => {
48-
code = code.replace(styleRegex, `\`${result.css}\`${punc ? punc : ""}`);
56+
code = code.replace(
57+
styleRegex,
58+
`\`${result.css}\`${punc ? punc : ''}`,
59+
);
4960
const map = result.map
5061
? JSON.parse((result as any).map)
51-
: { mappings: "" };
62+
: { mappings: '' };
5263
return {
5364
code,
5465
map,

0 commit comments

Comments
 (0)