@astryxdesign/build 0.6.3-canary.f22695a → 0.6.3
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/README.md +2 -2
- package/package.json +2 -2
- package/src/babel.test.mjs +8 -7
- package/src/vite.test.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @astryxdesign/build
|
|
2
2
|
|
|
3
|
-
Build plugins for
|
|
3
|
+
Build plugins for XDS source builds. Provides babel, PostCSS, and Vite integrations that compile XDS library and product code with separate class name prefixes, which enables independent CSS layers:
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
reset < astryx-base (library, astryx prefix) < astryx-theme < product (app, x prefix)
|
|
@@ -12,7 +12,7 @@ StyleX generates atomic CSS: same declaration = same class name. Without separat
|
|
|
12
12
|
|
|
13
13
|
`@astryxdesign/build` solves this by:
|
|
14
14
|
|
|
15
|
-
1. Compiling
|
|
15
|
+
1. Compiling XDS library code with `astryx` prefix (`.astryx78zum5`)
|
|
16
16
|
2. Compiling product code with default `x` prefix (`.x78zum5`)
|
|
17
17
|
3. Placing each group in its own CSS `@layer`
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/build",
|
|
3
|
-
"version": "0.6.3
|
|
4
|
-
"description": "Build plugins for
|
|
3
|
+
"version": "0.6.3",
|
|
4
|
+
"description": "Build plugins for XDS source builds — babel, PostCSS, and Vite integrations",
|
|
5
5
|
"author": "Meta Open Source",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/facebook/astryx#readme",
|
package/src/babel.test.mjs
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file babel.test.mjs
|
|
5
|
-
* @description Verifies that the
|
|
6
|
-
* library StyleX class-name prefix to
|
|
7
|
-
* defaults to `astryx` and
|
|
5
|
+
* @description Verifies that the XDS babel wrapper applies the configured
|
|
6
|
+
* library StyleX class-name prefix to XDS library files. Part of the
|
|
7
|
+
* the library atom prefix defaults to `astryx` and is configurable
|
|
8
|
+
* before the final cutover.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import {describe, it, expect} from 'vitest';
|
|
@@ -22,15 +23,15 @@ export const styles = stylex.create({
|
|
|
22
23
|
`;
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
|
-
* Transform a StyleX source through the
|
|
26
|
-
*
|
|
26
|
+
* Transform a StyleX source through the XDS babel wrapper as if it were a
|
|
27
|
+
* library file, returning the emitted code. `libraryPrefix` controls the
|
|
27
28
|
* atomic class-name prefix for library files.
|
|
28
29
|
*/
|
|
29
30
|
function transformLibraryFile(libraryPrefix) {
|
|
30
31
|
const result = babel.transformSync(SOURCE, {
|
|
31
32
|
// A path matching one of the library patterns so the wrapper routes it
|
|
32
33
|
// through the library plugin instance.
|
|
33
|
-
filename: 'node_modules/@astryxdesign/core/src/Box/
|
|
34
|
+
filename: 'node_modules/@astryxdesign/core/src/Box/XDSBox.tsx',
|
|
34
35
|
babelrc: false,
|
|
35
36
|
configFile: false,
|
|
36
37
|
plugins: [
|
|
@@ -52,7 +53,7 @@ function atomicClasses(code) {
|
|
|
52
53
|
return code.match(/\b(?:xds|astryx|lib)[a-z0-9]{4,}\b/g) ?? [];
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
describe('
|
|
56
|
+
describe('xds babel wrapper -- library StyleX prefix', () => {
|
|
56
57
|
it('defaults library atoms to the `astryx` prefix', () => {
|
|
57
58
|
const code = transformLibraryFile(undefined);
|
|
58
59
|
const atoms = atomicClasses(code);
|
package/src/vite.test.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file vite.test.ts
|
|
5
|
-
* @description Verifies CSS layer-order injection in the
|
|
5
|
+
* @description Verifies CSS layer-order injection in the XDS Vite plugin.
|
|
6
6
|
* The library layer name is configurable (default `astryx-base`); the
|
|
7
7
|
* theme layer name is fixed at `astryx-theme`.
|
|
8
8
|
*/
|