-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Create utils package to share logic across runtime and bundler #345
base: master
Are you sure you want to change the base?
Conversation
b30ef1e
to
4003aa6
Compare
e1c0ebc
to
903cc78
Compare
@@ -1,8 +1,7 @@ | |||
{ | |||
"extends": "../../tsconfig.json", | |||
"compilerOptions": { | |||
"resolveJsonModule": true, | |||
"target": "ES2015" | |||
"skipLibCheck": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it, it was typechecking for stuff inside unplugin
package that does not affect our package.
../../node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.d.mts(1,31): error TS2307: Cannot find module '@farmfe/core' or its corresponding type declarations.
../../node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.d.mts(2,46): error TS2307: Cannot find module '@farmfe/core' or its corresponding type declarations.
../../node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.d.mts(3,47): error TS2307: Cannot find module '@rspack/core/dist/config/zod' or its corresponding type declarations.
../../node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.d.mts(7,45): error TS2307: Cannot find module 'rolldown/dist/types/plugin' or its corresponding type declarations.
../../node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.d.mts(14,126): error TS2307: Cannot find module '@rspack/core' or its corresponding type declarations.
../../node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.d.mts(15,66): error TS2307: Cannot find module '@rspack/core' or its corresponding type declarations.
../../node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.d.mts(19,36): error TS2307: Cannot find module 'rolldown' or its corresponding type declarations.
../../node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.d.mts(20,42): error TS2307: Cannot find module 'rolldown' or its corresponding type declarations.
ELIFECYCLE Command failed with exit code 2.
This check can be safely ignored since at the moment we don't care about farm/rolldown/rspack etc.
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@pigment-css/theme", | |||
"version": "0.0.27", | |||
"version": "0.0.28", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can bump the version during the release process.
"module": "build/index.mjs", | ||
"types": "build/index.d.ts", | ||
"author": "MUI Team", | ||
"description": "Utilities to be used internally across Pigment CSS libraries.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "Utilities to be used internally across Pigment CSS libraries.", | |
"description": "Utilities to be used internally across different Pigment CSS packages.", |
nit
/** | ||
* Parses array expression string to AST for locating sourcemap points. | ||
*/ | ||
export function parseArray( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename the file to parseArray.ts
, or at least to parseExpressions.ts
(plural) if we plan to add more things.
>; | ||
defaultVariants?: Record<string, string | number>; | ||
}; | ||
type BaseStyleObject = ExtendedStyleObj & Record<string, string | object>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we miss here the CSS template string type?
}, | ||
}, | ||
variables: { | ||
'--var-1': [style[`.cls1`].color, 0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where would this style[`.cls1`].color
be defined?
$$hello: 'world', | ||
$hello1: 'world', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$$hello: 'world', | |
$hello1: 'world', | |
$$hello: 'world', | |
$hello1: 'world', |
What's the difference betweem $ and $$?
903cc78
to
1a1a33b
Compare
1a1a33b
to
95d0598
Compare
…packages
For reference, here's the next PR that uses this package.
This PR has the following utils -
$$value
keys in the css object to convert to css variables---value
variants
,compoundVariants
anddefaultVariants
keysvalueToLiteral
- Copied over from@pigment-css/react
to convert JS values to equivalent AST.Also, fixes tsconfig to used the latest config from core and updated the script to actually run typecheck in the CI which was not happening right now.