Skip to content
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

fix: Fix exports = for TS types for Babel plugin #926

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions packages/babel-plugin/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* 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.
*
*
*/

import type { PluginObj } from '@babel/core';
import type { StyleXOptions } from './utils/state-manager';
export type Options = StyleXOptions;
/**
* Entry point for the StyleX babel plugin.
*/
declare function styleXTransform(): PluginObj;
declare function stylexPluginWithOptions(
options: Partial<StyleXOptions>,
): [typeof styleXTransform, Partial<StyleXOptions>];
/**
*
* @param rules An array of CSS rules that has been generated and collected from all JS files
* in a project
* @returns A string that represents the final CSS file.
*
* This function take an Array of CSS rules, de-duplicates them, sorts them priority and generates
* a final CSS file.
*
* When Stylex is correctly configured, the babel plugin will return an array of CSS rule objects.
* You're expected to concatenate all the Rules into a single Array and use this function to convert
* that into the final CSS file.
*
* End-users can choose to not use this function and use their own logic instead.
*/
export type Rule = [string, { ltr: string; rtl?: null | string }, number];
declare function processStylexRules(
rules: Array<Rule>,
useLayers: boolean,
): string;
export type StyleXTransformObj = Readonly<{
(): PluginObj;
withOptions: typeof stylexPluginWithOptions;
processStylexRules: typeof processStylexRules;
}>;
declare const $$EXPORT_DEFAULT_DECLARATION$$: StyleXTransformObj;
export = $$EXPORT_DEFAULT_DECLARATION$$;