-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add postcss-plugin * fix postcss-plugin readme text * remove .ts, .tsx from node_modules @stylexjs/open-props globs in postcss.config.js * do not rely on internal exports path * fix: remove redundant @layer stylex
- Loading branch information
1 parent
074aef1
commit b9441d6
Showing
12 changed files
with
870 additions
and
507 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* 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. | ||
* | ||
* | ||
*/ | ||
|
||
/** | ||
* The @stylex directive is used by the @stylexjs/postcss-plugin. | ||
* It is automatically replaced with generated CSS during builds. | ||
*/ | ||
|
||
@stylex; |
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.