Skip to content

Commit 4f3ddd0

Browse files
committed
fix: wrong path import
- fix wrong path import (was importing path/posix instead of path - add vinyl-sourcempas-apply to external (rollup config) - run prettier
1 parent 55c26d2 commit 4f3ddd0

File tree

14 files changed

+63
-56
lines changed

14 files changed

+63
-56
lines changed

packages/gulp-purgecss/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import * as path from "path";
1616
"plugin-error",
1717
"purgecss",
1818
"glob",
19+
"vinyl-sourcemaps-apply",
1920
]);
2021
await buildRollup(rollupConfig);
2122
await extractAPI(__dirname);

packages/gulp-purgecss/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function gulpPurgeCSS(options: UserDefinedOptions): internal.Transform {
4040
},
4141
],
4242
stdin: true,
43-
sourceMap: !!file.sourceMap
43+
sourceMap: !!file.sourceMap,
4444
};
4545
const purgedCSSResults = await new PurgeCSS().purge(optionsGulp);
4646
const purge = purgedCSSResults[0];
@@ -77,7 +77,7 @@ function gulpPurgeCSS(options: UserDefinedOptions): internal.Transform {
7777
raw: css,
7878
},
7979
],
80-
sourceMap: !!file.sourceMap
80+
sourceMap: !!file.sourceMap,
8181
};
8282

8383
const purgedCSSResults = await new PurgeCSS().purge(optionsGulp);

packages/postcss-purgecss/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ async function purgeCSS(
7373
}
7474

7575
/**
76-
*
76+
*
7777
* @param opts - opts
78-
* @returns
79-
*
78+
* @returns
79+
*
8080
* @public
8181
*/
8282
const purgeCSSPlugin: postcss.PluginCreator<UserDefinedOptions> = function (
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import {
22
UserDefinedOptions as PurgeCSSUserDefinedOptions,
3-
RawContent
3+
RawContent,
44
} from "purgecss";
55

6-
76
/**
87
* {@inheritDoc purgecss#UserDefinedOptions}
9-
*
8+
*
109
* @public
1110
*/
12-
export interface UserDefinedOptions extends Omit<PurgeCSSUserDefinedOptions,"content" | "css"> {
13-
content?: PurgeCSSUserDefinedOptions['content'];
11+
export interface UserDefinedOptions
12+
extends Omit<PurgeCSSUserDefinedOptions, "content" | "css"> {
13+
content?: PurgeCSSUserDefinedOptions["content"];
1414
contentFunction?: (sourceFile: string) => Array<string | RawContent>;
1515
}

packages/purgecss-from-html/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ const getSelectorsInNodes = (
9595

9696
/**
9797
* Get the potential selectors from HTML code
98-
*
98+
*
9999
* @param content - HTML code
100100
* @returns the attributes, classes, ids, and tags from the HTML code
101-
*
101+
*
102102
* @public
103103
*/
104104
const purgecssFromHtml = (content: string): ExtractorResultDetailed => {

packages/purgecss-from-jsx/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ extend<NodeState>(walk.base);
1818

1919
/**
2020
* Create function to extract selectors from jsx code
21-
*
21+
*
2222
* @param options - acorn options
2323
* @returns function to extract selectors from jsx code
24-
*
24+
*
2525
* @public
2626
*/
2727
function purgeFromJsx(options?: acorn.Options) {

packages/purgecss-from-pug/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import lex from "pug-lexer";
22

33
/**
44
* Get the potential selectors from Pug code
5-
*
5+
*
66
* @param content - Pug code
77
* @returns the attributes, classes, ids, and tags from the Pug code
8-
*
8+
*
99
* @public
1010
*/
1111
const purgeFromPug = (content: string): string[] => {

packages/purgecss-from-tsx/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import * as ts from "typescript";
44

55
/**
66
* Create function to extract selectors from tsx code
7-
*
7+
*
88
* @param options - acorn options
99
* @returns the function to extract selectors from tsx code
10-
*
10+
*
1111
* @public
1212
*/
1313
function purgeFromTsx(options?: {

packages/purgecss-webpack-plugin/src/types/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import type {
22
ComplexSafelist,
33
StringRegExpArray,
4-
UserDefinedOptions as PurgeCSSUserDefinedOptions
4+
UserDefinedOptions as PurgeCSSUserDefinedOptions,
55
} from "purgecss";
66

7-
87
/**
9-
* @public
8+
* @public
109
*/
1110
export type PathFunction = () => string[];
1211
/**
@@ -28,11 +27,14 @@ export type PurgedStats = {
2827
/**
2928
* @public
3029
*/
31-
export type UserDefinedOptions = Omit<PurgeCSSUserDefinedOptions, "css" | "content" | "safelist" | "blocklist" | "sourceMap"> & {
30+
export type UserDefinedOptions = Omit<
31+
PurgeCSSUserDefinedOptions,
32+
"css" | "content" | "safelist" | "blocklist" | "sourceMap"
33+
> & {
3234
paths: string[] | PathFunction;
3335
moduleExtensions?: string[];
3436
verbose?: boolean;
35-
safelist: PurgeCSSUserDefinedOptions['safelist'] | SafelistFunction;
36-
blocklist: PurgeCSSUserDefinedOptions['blocklist'] | BlocklistFunction;
37+
safelist: PurgeCSSUserDefinedOptions["safelist"] | SafelistFunction;
38+
blocklist: PurgeCSSUserDefinedOptions["blocklist"] | BlocklistFunction;
3739
only?: string[];
38-
}
40+
};
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
import { PurgeCSS } from '../src/'
2-
import { ROOT_TEST_EXAMPLES } from './utils';
1+
import { PurgeCSS } from "../src/";
2+
import { ROOT_TEST_EXAMPLES } from "./utils";
33

44
describe("source map option", () => {
5-
it('contains the source map inlined in the CSS file', async () => {
5+
it("contains the source map inlined in the CSS file", async () => {
66
const resultsPurge = await new PurgeCSS().purge({
77
content: [`${ROOT_TEST_EXAMPLES}others/remove_unused.js`],
88
css: [`${ROOT_TEST_EXAMPLES}others/remove_unused.css`],
9-
sourceMap: true
9+
sourceMap: true,
1010
});
1111

12-
expect(resultsPurge[0].css).toContain('sourceMappingURL=data:application/json;base64');
12+
expect(resultsPurge[0].css).toContain(
13+
"sourceMappingURL=data:application/json;base64"
14+
);
1315
});
1416

15-
it('contains the source map separately when setting inline to false', async () => {
17+
it("contains the source map separately when setting inline to false", async () => {
1618
const resultsPurge = await new PurgeCSS().purge({
1719
content: [`${ROOT_TEST_EXAMPLES}others/remove_unused.js`],
1820
css: [`${ROOT_TEST_EXAMPLES}others/remove_unused.css`],
1921
sourceMap: {
20-
inline: false
21-
}
22+
inline: false,
23+
},
2224
});
2325

24-
expect(resultsPurge[0].sourceMap).toContain('sources":["__tests__/test_examples/others/remove_unused.css"]');
25-
})
26+
expect(resultsPurge[0].sourceMap).toContain(
27+
'sources":["__tests__/test_examples/others/remove_unused.css"]'
28+
);
29+
});
2630
});

0 commit comments

Comments
 (0)