Skip to content

Commit

Permalink
Final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshb42 committed Feb 2, 2024
1 parent 1be7dd2 commit 47dfc2b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 32 deletions.
8 changes: 2 additions & 6 deletions apps/zero-runtime-vite-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { styled, generateAtomics, css } from '@mui/zero-runtime';
import { styled, generateAtomics } from '@mui/zero-runtime';
import type { Breakpoint } from '@mui/system';
import { Button, bounceAnim } from 'local-ui-lib';
import Slider from './Slider/ZeroSlider';
Expand Down Expand Up @@ -58,11 +58,7 @@ export function App({ isRed }: AppProps) {
const [isHorizontal, setIsHorizontal] = React.useState(true);

return (
<div
className={css`
color: red;
`}
>
<div>
<ShowCaseDiv>
<Button>This button&apos;s text color has been overridden.</Button>
</ShowCaseDiv>
Expand Down
8 changes: 8 additions & 0 deletions apps/zero-runtime-vite-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ export default defineConfig({
reactPlugin(),
splitVendorChunkPlugin(),
],
resolve: {
alias: [
{
find: /^@mui\/system\/(.*)/,
replacement: '@mui/system/esm/$1',
},
],
},
});
2 changes: 1 addition & 1 deletion packages/zero-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"publishConfig": {
"access": "public"
},
"linaria": {
"wyw-in-js": {
"tags": {
"styled": "./exports/styled.js",
"default": "./exports/styled.js",
Expand Down
1 change: 0 additions & 1 deletion packages/zero-runtime/src/processors/generateAtomics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export class GenerateAtomicsProcessor extends BaseProcessor {
}

doRuntimeReplacement(): void {
console.log(this.runtimeConfig);
if (!this.runtimeConfig) {
this.doEvaltimeReplacement();
return;
Expand Down
10 changes: 5 additions & 5 deletions packages/zero-runtime/src/utils/sxObjectExtractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ function validateObjectKey(
throw keyPath.buildCodeFrameError('Expressions in css object keys are not supported.');
}
if (
!identifiers.every((item: any) => {
!identifiers.every((item) => {
const binding = item.scope.getBinding(item.node.name);
if (!binding) {
return false;
}
if (
binding.path.findParent((parent: any) => parent === parentCall) ||
binding.path.findParent((parent) => parent === parentCall) ||
binding.path.scope === rootScope
) {
return true;
Expand Down Expand Up @@ -72,15 +72,15 @@ function traverseObjectExpression(
const identifiers = findIdentifiers([value], 'reference');
const themeIdentifiers: NodePath<Identifier>[] = [];
const localIdentifiers: NodePath<Identifier>[] = [];
identifiers.forEach((id: any) => {
identifiers.forEach((id) => {
if (!id.isIdentifier()) {
return;
}
const binding = id.scope.getBinding(id.node.name);
if (!binding) {
return;
}
if (binding.path.findParent((parent: any) => parent === parentCall)) {
if (binding.path.findParent((parent) => parent === parentCall)) {
themeIdentifiers.push(id);
} else if (binding.scope !== rootScope) {
localIdentifiers.push(id);
Expand All @@ -101,7 +101,7 @@ function traverseObjectExpression(
} else if (property.isSpreadElement()) {
const identifiers = findIdentifiers([property.get('argument')]);
if (
!identifiers.every((id: any) => {
!identifiers.every((id) => {
const binding = property.scope.getBinding(id.node.name);
if (!binding || binding.scope !== rootScope) {
return false;
Expand Down
3 changes: 0 additions & 3 deletions packages/zero-unplugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import {
createUnplugin,
UnpluginOptions,
} from 'unplugin';
// import type { PluginOptions as LinariaPluginOptions, Preprocessor } from '@linaria/babel-preset';
// import { TransformCacheCollection, transform } from '@linaria/babel-preset';
// import { createPerfMeter, asyncResolveFallback, slugify } from '@linaria/utils';
import {
preprocessor as basePreprocessor,
generateTokenCss,
Expand Down
4 changes: 2 additions & 2 deletions packages/zero-vite-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export function zeroVitePlugin(options: ZeroVitePluginOptions) {
},
load(id) {
if (id === VIRTUAL_CSS_FILE) {
return generateTokenCss(theme);
return generateTokenCss(theme as BaseTheme);
}
if (id === VIRTUAL_THEME_FILE) {
return `export default ${JSON.stringify(generateThemeTokens(theme))};`;
return `export default ${JSON.stringify(generateThemeTokens(theme as BaseTheme))};`;
}
return null;
},
Expand Down
5 changes: 0 additions & 5 deletions packages/zero-vite-plugin/src/zero-vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import path from 'node:path';
import type { ModuleNode, Plugin, ResolvedConfig, ViteDevServer, FilterPattern } from 'vite';
import { optimizeDeps, createFilter } from 'vite';

// import { transform, slugify, TransformCacheCollection } from '@linaria/babel-preset';
// import type { PluginOptions, Preprocessor } from '@linaria/babel-preset';
// import { linariaLogger } from '@linaria/logger';
// import type { IPerfMeterOptions } from '@linaria/utils';
// import { createPerfMeter, getFileIdx, syncResolve } from '@linaria/utils';
import { slugify, logger as wywLogger, syncResolve } from '@wyw-in-js/shared';
import {
TransformCacheCollection,
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 47dfc2b

Please sign in to comment.