@astryxdesign/build 0.1.1-canary.a514b99 → 0.1.1-canary.b6827c4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vite.d.ts +92 -0
- package/package.json +5 -2
- package/src/vite.ts +1 -1
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import stylex from '@stylexjs/unplugin';
|
|
3
|
+
/**
|
|
4
|
+
* Browser targets for lightningcss (opt-in).
|
|
5
|
+
* Only needed if your StyleX version lowers light-dark() without them.
|
|
6
|
+
* Exported for consumers who want to opt in explicitly.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LIGHTNINGCSS_TARGETS: {
|
|
9
|
+
chrome: number;
|
|
10
|
+
firefox: number;
|
|
11
|
+
safari: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Legacy options shape — kept for backward compatibility.
|
|
15
|
+
* Prefer the zero-config form: astryxStylex()
|
|
16
|
+
*/
|
|
17
|
+
export interface AstryxVitePluginLegacyOptions {
|
|
18
|
+
stylexOptions: Parameters<typeof stylex.vite>[0];
|
|
19
|
+
libraryPattern?: string;
|
|
20
|
+
/** StyleX atomic class-name prefix for Astryx library styles. @default 'astryx' */
|
|
21
|
+
stylexPrefix?: string;
|
|
22
|
+
layers?: {
|
|
23
|
+
library?: string;
|
|
24
|
+
product?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface AstryxVitePluginOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Whether to enable dev mode for StyleX.
|
|
30
|
+
* @default process.env.NODE_ENV !== 'production'
|
|
31
|
+
*/
|
|
32
|
+
dev?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Root directory for module resolution.
|
|
35
|
+
* @default process.cwd()
|
|
36
|
+
*/
|
|
37
|
+
rootDir?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Pattern to identify Astryx library files vs product files.
|
|
40
|
+
* @default 'node_modules/@astryxdesign/'
|
|
41
|
+
*/
|
|
42
|
+
libraryPattern?: string;
|
|
43
|
+
/**
|
|
44
|
+
* CSS layer names for the split output.
|
|
45
|
+
*/
|
|
46
|
+
layers?: {
|
|
47
|
+
/** Layer name for Astryx library styles @default 'astryx-base' */
|
|
48
|
+
library?: string;
|
|
49
|
+
/** Layer name for product styles @default 'product' */
|
|
50
|
+
product?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* LightningCSS browser targets. Only needed if your StyleX version
|
|
54
|
+
* lowers light-dark() without them. Most recent versions preserve
|
|
55
|
+
* light-dark() by default.
|
|
56
|
+
* @default undefined (no targets set)
|
|
57
|
+
*/
|
|
58
|
+
lightningcssTargets?: Record<string, number>;
|
|
59
|
+
/**
|
|
60
|
+
* StyleX atomic class-name prefix for Astryx *library* styles. The product
|
|
61
|
+
* build uses a distinct prefix so library and product atoms never collide
|
|
62
|
+
* across layers.
|
|
63
|
+
*
|
|
64
|
+
* Configurable to support the Astryx-prefix migration: a consumer
|
|
65
|
+
* can rebrand the library atom prefix to `astryx` before the final cutover.
|
|
66
|
+
* Defaults to `xds` so existing consumers are unaffected.
|
|
67
|
+
*
|
|
68
|
+
* @default 'astryx'
|
|
69
|
+
*/
|
|
70
|
+
stylexPrefix?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Extra StyleX options to merge.
|
|
73
|
+
*/
|
|
74
|
+
stylexOverrides?: Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Astryx Vite plugin for source builds.
|
|
78
|
+
*
|
|
79
|
+
* Provides sensible defaults for StyleX compilation with Astryx.
|
|
80
|
+
* Just spread into your plugins array:
|
|
81
|
+
*
|
|
82
|
+
* plugins: [...astryxStylex(), react()]
|
|
83
|
+
*
|
|
84
|
+
* Handles:
|
|
85
|
+
* - StyleX compilation with correct settings
|
|
86
|
+
* - CSS layer ordering (reset < astryx-base < astryx-theme < product)
|
|
87
|
+
* - resolve.alias for @astryxdesign/core source
|
|
88
|
+
* - optimizeDeps.exclude to prevent Vite pre-bundling Astryx
|
|
89
|
+
*
|
|
90
|
+
* @param options — optional overrides
|
|
91
|
+
*/
|
|
92
|
+
export declare function astryxStylex(options?: AstryxVitePluginOptions | AstryxVitePluginLegacyOptions): Plugin[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/build",
|
|
3
|
-
"version": "0.1.1-canary.
|
|
3
|
+
"version": "0.1.1-canary.b6827c4",
|
|
4
4
|
"description": "Build plugins for XDS source builds — babel, PostCSS, and Vite integrations",
|
|
5
5
|
"author": "Meta Open Source",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
".": "./src/config.js",
|
|
26
26
|
"./babel": "./src/babel.js",
|
|
27
27
|
"./postcss": "./src/index.js",
|
|
28
|
-
"./vite":
|
|
28
|
+
"./vite": {
|
|
29
|
+
"types": "./dist/vite.d.ts",
|
|
30
|
+
"import": "./dist/vite.mjs"
|
|
31
|
+
},
|
|
29
32
|
"./next": "./src/next.js"
|
|
30
33
|
},
|
|
31
34
|
"files": [
|
package/src/vite.ts
CHANGED
|
@@ -79,7 +79,7 @@ export interface AstryxVitePluginOptions {
|
|
|
79
79
|
* build uses a distinct prefix so library and product atoms never collide
|
|
80
80
|
* across layers.
|
|
81
81
|
*
|
|
82
|
-
* Configurable to support the Astryx-prefix migration
|
|
82
|
+
* Configurable to support the Astryx-prefix migration: a consumer
|
|
83
83
|
* can rebrand the library atom prefix to `astryx` before the final cutover.
|
|
84
84
|
* Defaults to `xds` so existing consumers are unaffected.
|
|
85
85
|
*
|