-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
812 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const projectRoot = __dirname; | ||
const monorepoRoot = path.join(projectRoot, '../../'); | ||
|
||
function getPackageIncludePaths(packageName, nodeModulePaths) { | ||
let packagePath = null; | ||
|
||
for (const nodeModulePath of nodeModulePaths) { | ||
const packageJsonPath = path.resolve( | ||
nodeModulePath, | ||
packageName, | ||
'package.json', | ||
); | ||
if (fs.existsSync(packageJsonPath)) { | ||
packagePath = path.dirname(packageJsonPath); | ||
break; | ||
} | ||
} | ||
if (!packagePath) { | ||
throw new Error(`Could not find package ${packageName}`); | ||
} | ||
|
||
return [ | ||
path.join(packagePath, '**/*.{js,mjs}'), | ||
'!' + path.join(packagePath, 'node_modules/**/*.{js,mjs}'), | ||
]; | ||
} | ||
|
||
const openPropsIncludePaths = getPackageIncludePaths('@stylexjs/open-props', [ | ||
path.join(projectRoot, 'node_modules'), | ||
path.join(monorepoRoot, 'node_modules'), | ||
]); | ||
|
||
module.exports = { | ||
plugins: { | ||
'@stylexjs/postcss-plugin': { | ||
include: [ | ||
'app/**/*.{js,jsx,ts,tsx}', | ||
'components/**/*.{js,jsx,ts,tsx}', | ||
...openPropsIncludePaths, | ||
], | ||
useCSSLayers: true, | ||
}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
Oops, something went wrong.