Skip to content

Commit

Permalink
us cssmodules-pure-no-check
Browse files Browse the repository at this point in the history
  • Loading branch information
jantimon committed Dec 12, 2024
1 parent 76ad638 commit 7ffa69b
Show file tree
Hide file tree
Showing 83 changed files with 71 additions and 246 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@
"pnpm": {
"overrides": {
"yak-swc": "workspace:*"
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
},
"packageManager": "[email protected]",
"author": "Jan Nicklas",
"license": "MIT",
"devDependencies": {
"prettier": "^3.0.3",
"@changesets/cli": "^2.27.9"
"@changesets/cli": "^2.27.9",
"prettier": "^3.0.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import { styled, css } from "next-yak/internal";
import { colors, negative, siteMaxWidth } from "./constants";
import "./index.yak.module.css!=!./index?./index.yak.module.css";
export var Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_wIxfWW) {
color: red;
height: --yak-css-import: url("./constants:siteMaxWidth",mixin)px;
color: --yak-css-import: url("./constants:colors:primary",mixin);
background-color: --yak-css-import: url("./constants:colors:secondary",mixin);
z-index: --yak-css-import: url("./constants:negative",mixin);
}
// cssmodules-pure-ignore
:global(.Button___wIxfWW) {
color: --yak-css-import: url("./constants:colors:secondary",mixin);
background-color: --yak-css-import: url("./constants:colors:primary",mixin);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.Button_wIxfWW) {
color: red;
height: 10px;
color: var(--color-primary);
background-color: var(--color-secondary);
z-index: -1;
}
/* cssmodules-pure-ignore * /
:global(.Button___wIxfWW) {
color: var(--color-secondary);
background-color: var(--color-primary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { styled } from "next-yak/internal";
import { colors } from "./constants";
import "./index.yak.module.css!=!./index?./index.yak.module.css";
export var Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_bAtfrp) {
color: --yak-css-import: url("./constants:colors:primary",mixin);
background-color: --yak-css-import: url("./constants:colors:secondary",mixin);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.Button_bAtfrp) {
color: var(--color-primary);
background-color: var(--color-secondary);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { styled } from "next-yak/internal";
import "./icon.yak.module.css!=!./icon?./icon.yak.module.css";
export var Icon = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Icon_je4Wtv) {
display: inline-block;
width: 20px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.Icon_je4Wtv) {
display: inline-block;
width: 20px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { buttonMixin } from './mixin';
import { primaryButtonMixin } from './helper/anotherMixin';
import "./index.yak.module.css!=!./index?./index.yak.module.css";
export var Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_oPtJMe) {
--yak-css-import: url("./mixin:buttonMixin",mixin);
}
*/ /*#__PURE__*/ styled.button("Button_oPtJMe");
export var PrimaryButton = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.PrimaryButton_oPtJMe) {
--yak-css-import: url("./helper/anotherMixin:primaryButtonMixin",mixin);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.Button_oPtJMe) {
color: black;
:global(.icon_Icon__vdEsc) {
color: black;
}

}
/* cssmodules-pure-ignore * /
:global(.PrimaryButton_oPtJMe) {
color: black;
:global(.icon_Icon__vdEsc) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@ var buttonTextMixin = /*#__PURE__*/ css(function(param) {
return $disabled && /*#__PURE__*/ css("buttonTextMixin__$disabled_xEUJ1U");
});
var Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_xEUJ1U) {
color: black;
}
// cssmodules-pure-ignore
:global(.Button__$disabled_xEUJ1U) {
opacity: 0.5;
}
// cssmodules-pure-ignore
:global(.Button__$hasIcon_xEUJ1U) {
padding-left: 30px;
}
// cssmodules-pure-ignore
:global(.Button__$disabled_xEUJ1U-01) {
color: gray;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.Button_xEUJ1U) {
color: black;
}
/* cssmodules-pure-ignore * /
:global(.Button__$disabled_xEUJ1U) {
opacity: 0.5;
}
/* cssmodules-pure-ignore * /
:global(.Button__$hasIcon_xEUJ1U) {
padding-left: 30px;
}
/* cssmodules-pure-ignore * /
:global(.Button__$disabled_xEUJ1U-01) {
color: gray;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { styled } from "next-yak/internal";
import { AnyIcon, Icon } from "./icon";
import "./index.yak.module.css!=!./index?./index.yak.module.css";
export var Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_JKqlji) {
--yak-css-import: url("./icon:Icon",selector) {
margin-right: 10px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.Button_JKqlji) {
:global(.icon_Icon___yEni) {
margin-right: 10px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { styled } from "next-yak/internal";
import { lastChildMixin } from './mixin';
import "./index.yak.module.css!=!./index?./index.yak.module.css";
var ListItem = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.ListItem_PZqRtI) {
margin-bottom: 10px;
&:hover {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.ListItem_PZqRtI) {
margin-bottom: 10px;
&:hover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { styled } from "next-yak/internal";
import { siteMaxWidth } from "./constants.yak";
import "./index.yak.module.css!=!./index?./index.yak.module.css";
export var Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_Mx2s9f) {
color: red;
height: --yak-css-import: url("./constants.yak:siteMaxWidth",mixin)px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.Button_Mx2s9f) {
color: red;
height: 10px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { styled } from "next-yak/internal";
import { typography } from "./typography.yak";
import "./index.yak.module.css!=!./index?./index.yak.module.css";
export var Headline = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Headline_mxjUbw) {
color: red;
--yak-css-import: url("./typography.yak:typography:h1",mixin);
}
*/ /*#__PURE__*/ styled.button("Headline_mxjUbw");
export var Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_mxjUbw) {
color: red;
--yak-css-import: url("./typography.yak:typography:h3",mixin);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* cssmodules-pure-ignore * /
/* cssmodules-pure-no-check * /
:global(.Headline_mxjUbw) {
color: red;

Expand All @@ -9,7 +9,6 @@
letter-spacing: 0.00938em;

}
/* cssmodules-pure-ignore * /
:global(.Button_mxjUbw) {
color: red;

Expand Down
9 changes: 4 additions & 5 deletions packages/next-yak/loaders/css-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ function extractCss(code: string): string {
const codeUntilEnd = codeParts[i].split("*/")[0];
result += codeUntilEnd;
}
// postcss can't handle // comments
result = result.replace(
/\/\/ cssmodules-pure-ignore/g,
"/* cssmodules-pure-ignore */",
);
if (result) {
result = "/* cssmodules-pure-no-check */\n" + result;
}

return result;
}

Expand Down
11 changes: 4 additions & 7 deletions packages/yak-swc/yak_swc/src/yak_transforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl YakTransform for TransformNestedCss {
let mut parser_state = previous_parser_state.clone().unwrap();
// The first scope is the class name which gets attached to the element
parser_state.current_scopes[0] = CssScope {
name: format!("// cssmodules-pure-ignore\n:global(.{})", css_identifier),
name: format!(":global(.{})", css_identifier),
scope_type: ScopeType::Selector,
};
parser_state
Expand Down Expand Up @@ -174,7 +174,7 @@ impl YakTransform for TransformCssMixin {
naming_convention.get_css_class_name(&declaration_name.to_readable_string());
self.class_name = Some(css_identifier.clone());
parser_state.current_scopes = vec![CssScope {
name: format!("// cssmodules-pure-ignore\n:global(.{})", css_identifier),
name: format!(":global(.{})", css_identifier),
scope_type: ScopeType::AtRule,
}];
parser_state
Expand Down Expand Up @@ -294,7 +294,7 @@ impl YakTransform for TransformStyled {
self.class_name = Some(css_identifier.clone());
let mut parser_state = ParserState::new();
parser_state.current_scopes = vec![CssScope {
name: format!("// cssmodules-pure-ignore\n:global(.{})", css_identifier),
name: format!(":global(.{})", css_identifier),
scope_type: ScopeType::AtRule,
}];
parser_state
Expand Down Expand Up @@ -381,10 +381,7 @@ impl YakTransform for TransformKeyframes {
};
let mut parser_state = ParserState::new();
parser_state.current_scopes = vec![CssScope {
name: format!(
"// cssmodules-pure-ignore\n@keyframes :global({})",
css_identifier
),
name: format!("@keyframes :global({})", css_identifier),
scope_type: ScopeType::AtRule,
}];
parser_state
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { styled } from "next-yak/internal";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_m7uBBu) {
background-color: #007bff;
color: #fff;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { styled } from "next-yak/internal";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.ym7uBBu) {
background-color: #007bff;
color: #fff;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { styled } from "next-yak/internal";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_m7uBBu) {
background-color: #007bff;
color: #fff;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { styled } from "next-yak/internal";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.ym7uBBu) {
background-color: #007bff;
color: #fff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { styled } from "next-yak/internal";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
const primary = "green";
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_m7uBBu) {
color: green;
background: red;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { styled } from "next-yak/internal";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
const primary = "green";
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.ym7uBBu) {
color: green;
background: red;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { styled } from "next-yak/internal";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
export const ArticleCard = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.ArticleCard_m7uBBu) {
background-color: #fff;
border-radius: 8px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { styled } from "next-yak/internal";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
export const ArticleCard = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.ym7uBBu) {
background-color: #fff;
border-radius: 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const colors = {
const borderRadius = "4px";
const stacking = 1;
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_m7uBBu) {
background-color: #007bff;
color: #f8f9fa;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const colors = {
const borderRadius = "4px";
const stacking = 1;
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.ym7uBBu) {
background-color: #007bff;
color: #f8f9fa;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { fonts } from "./fontDefinitions";
import { sizes } from "./sizeDefinitions";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.Button_m7uBBu) {
font-size: --yak-css-import: url("./fontDefinitions:fonts:sm",mixin);
color: --yak-css-import: url("./colorDefinitions:colors:dark:primary",mixin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { fonts } from "./fontDefinitions";
import { sizes } from "./sizeDefinitions";
import "./input.yak.module.css!=!./input?./input.yak.module.css";
export const Button = /*YAK Extracted CSS:
// cssmodules-pure-ignore
:global(.ym7uBBu) {
font-size: --yak-css-import: url("./fontDefinitions:fonts:sm",mixin);
color: --yak-css-import: url("./colorDefinitions:colors:dark:primary",mixin);
Expand Down
Loading

0 comments on commit 7ffa69b

Please sign in to comment.