Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.js
node_modules
/node_modules/
/lib/**/*.js
index.js
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',
]
};
94 changes: 47 additions & 47 deletions lib/__tests__/convertCssForEmotion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,53 +115,6 @@ select.form-control:not([size]):not([multiple]) {

const cssForEmotion = `import { css, injectGlobal } from "emotion";

injectGlobal\`*, *::before, *::after {
box-sizing: inherit;
}



@-ms-viewport {
width: device-width;
}




































\`;

export const close = css\`
float: right;
font-size: 1.5rem;
Expand Down Expand Up @@ -281,6 +234,53 @@ export const formControl = css\`select&:not([size]):not([multiple]) {
color: #868e96;
opacity: 1;
}

\`;

injectGlobal\`*, *::before, *::after {
box-sizing: inherit;
}



@-ms-viewport {
width: device-width;
}




































\`;
`;
Expand Down
2 changes: 1 addition & 1 deletion lib/convertCssForEmotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function convertCssForEmotion(css: string): string {

return collator.compare(scopeA, scopeB);
})
.reduce((previousSortedKnownScopes: Set<string>, knownScope) => {
.reduce((previousSortedKnownScopes: Set<string>, knownScope: string) => {
getRequiredScopes(
cssIndexedByScope.get(knownScope) as string,
knownScope,
Expand Down
2 changes: 1 addition & 1 deletion lib/getNodeScopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as postcss from "postcss";
import { getSelectorScope } from "./getSelectorScope";

export function getNodeScopes(node: postcss.Node): Set<string> {
const nodeScopes = new Set();
const nodeScopes: Set<string> = new Set();

if (
node.type === "rule" &&
Expand Down
2 changes: 1 addition & 1 deletion lib/getRequiredScopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function getRequiredScopes(
scope: string,
knownScopes: Set<string>,
): Set<string> {
const requiredScopes = new Set();
const requiredScopes: Set<string> = new Set();

const root = postcss.parse(css);
root.walkRules((rule) => {
Expand Down
Loading