@astryxdesign/build 0.6.3-canary.e9b8aa1 → 0.6.3-canary.ebaebc4
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 +7 -8
- 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 Astryx source builds. Provides babel, PostCSS, and Vite integrations that compile Astryx 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 Astryx 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-canary.
|
|
4
|
-
"description": "Build plugins for
|
|
3
|
+
"version": "0.6.3-canary.ebaebc4",
|
|
4
|
+
"description": "Build plugins for Astryx 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,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file babel.test.mjs
|
|
5
|
-
* @description Verifies that the
|
|
6
|
-
* library StyleX class-name prefix to
|
|
7
|
-
*
|
|
8
|
-
* before the final cutover.
|
|
5
|
+
* @description Verifies that the Astryx babel wrapper applies the configured
|
|
6
|
+
* library StyleX class-name prefix to Astryx library files. The prefix
|
|
7
|
+
* defaults to `astryx` and remains configurable.
|
|
9
8
|
*/
|
|
10
9
|
|
|
11
10
|
import {describe, it, expect} from 'vitest';
|
|
@@ -23,15 +22,15 @@ export const styles = stylex.create({
|
|
|
23
22
|
`;
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
|
-
* Transform a StyleX source through the
|
|
27
|
-
* library file, returning the emitted code. `libraryPrefix` controls the
|
|
25
|
+
* Transform a StyleX source through the Astryx babel wrapper as if it were an
|
|
26
|
+
* Astryx library file, returning the emitted code. `libraryPrefix` controls the
|
|
28
27
|
* atomic class-name prefix for library files.
|
|
29
28
|
*/
|
|
30
29
|
function transformLibraryFile(libraryPrefix) {
|
|
31
30
|
const result = babel.transformSync(SOURCE, {
|
|
32
31
|
// A path matching one of the library patterns so the wrapper routes it
|
|
33
32
|
// through the library plugin instance.
|
|
34
|
-
filename: 'node_modules/@astryxdesign/core/src/Box/
|
|
33
|
+
filename: 'node_modules/@astryxdesign/core/src/Box/AstryxBox.tsx',
|
|
35
34
|
babelrc: false,
|
|
36
35
|
configFile: false,
|
|
37
36
|
plugins: [
|
|
@@ -53,7 +52,7 @@ function atomicClasses(code) {
|
|
|
53
52
|
return code.match(/\b(?:xds|astryx|lib)[a-z0-9]{4,}\b/g) ?? [];
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
describe('
|
|
55
|
+
describe('Astryx babel wrapper -- library StyleX prefix', () => {
|
|
57
56
|
it('defaults library atoms to the `astryx` prefix', () => {
|
|
58
57
|
const code = transformLibraryFile(undefined);
|
|
59
58
|
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 Astryx 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
|
*/
|