Skip to content

Commit

Permalink
fix(all): Use optional chain
Browse files Browse the repository at this point in the history
  • Loading branch information
bukinoshita committed Dec 18, 2024
1 parent 72cf4d0 commit b429e9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ export const startDevServer = async (

try {
if (
parsedUrl.path &&
parsedUrl.path.includes('static/') &&
parsedUrl?.path?.includes('static/') &&
!parsedUrl.path.includes('_next/static/')
) {
void serveStaticFile(res, parsedUrl, staticBaseDirRelativePath);
} else if (!isNextReady) {
void nextReadyPromise.then(
() => nextHandleRequest?.(req, res, parsedUrl),
void nextReadyPromise.then(() =>
nextHandleRequest?.(req, res, parsedUrl),
);
} else {
void nextHandleRequest?.(req, res, parsedUrl);
Expand Down
11 changes: 5 additions & 6 deletions packages/tailwind/src/utils/css/resolve-all-css-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import {
rule as createRule,
decl as createDeclaration,
AtRule,
} from "postcss";
import { removeIfEmptyRecursively } from "./remove-if-empty-recursively";
} from 'postcss';
import { removeIfEmptyRecursively } from './remove-if-empty-recursively';

const doNodesMatch = (first: Node | undefined, second: Node | undefined) => {
if (first instanceof Rule && second instanceof Rule) {
return (
first.selector === second.selector ||
second.selector.includes("*") ||
second.selector.includes(":root")
second.selector.includes('*') ||
second.selector.includes(':root')
);
}

Expand All @@ -39,8 +39,7 @@ export const resolveAllCSSVariables = (root: Root) => {
if (/--[^\s]+/.test(otherDecl.prop)) {
const variable = `var(${otherDecl.prop})`;
if (
variablesUsed &&
variablesUsed.includes(variable) &&
variablesUsed?.includes(variable) &&
doNodesMatch(decl.parent, otherDecl.parent)
) {
if (
Expand Down

0 comments on commit b429e9e

Please sign in to comment.