@octane-xplat/bamboo 0.9.0 → 0.11.0

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.
Files changed (3) hide show
  1. package/README.md +18 -8
  2. package/package.json +1 -1
  3. package/src/vite.ts +21 -0
package/README.md CHANGED
@@ -14,13 +14,15 @@ pnpm add -D @octane-xplat/bamboo
14
14
  Two entry points:
15
15
 
16
16
  ```ts
17
- // bamboo.config.ts — ./ or ./config
18
- import { xplatBambooConfig, xplatPortablePreset } from '@octane-xplat/bamboo'
19
-
20
- // vite.config.ts — ./vite
21
- import { xplatBamboo } from '@octane-xplat/bamboo/vite'
22
-
23
- plugins: [xplatBamboo()] // { native: true } for the native build
17
+ // bamboo.config.ts
18
+ import { defineConfig } from '@bamboocss/dev'
19
+ import { xplatBambooConfig } from '@octane-xplat/bamboo'
20
+
21
+ export default defineConfig({
22
+ ...xplatBambooConfig,
23
+ include: ['src/**/*.ts'],
24
+ outdir: 'src/styled',
25
+ })
24
26
  ```
25
27
 
26
28
  Preflight is off by default and tokens land on `:root, .ns-root`. The
@@ -28,4 +30,12 @@ xplat NativeScript CSS transform unwraps the emitted `@layer` blocks for
28
30
  native builds (the NS parser drops unknown at-rules); browsers keep the
29
31
  layers, which is what lets app CSS stay unlayered on top.
30
32
 
31
- Guide: [Styling screens](../../docs/styling.md).
33
+ ```ts
34
+ // Add this plugin alongside your app's existing renderer plugins.
35
+ import { xplatBamboo } from '@octane-xplat/bamboo/vite'
36
+
37
+ const webPlugins = xplatBamboo()
38
+ const nativePlugins = xplatBamboo({ native: true })
39
+ ```
40
+
41
+ Guide: [Styling screens](../../docs/app/styling.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octane-xplat/bamboo",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Bamboo CSS integration defaults for Octane xplat apps",
5
5
  "keywords": [
6
6
  "bamboo",
package/src/vite.ts CHANGED
@@ -22,6 +22,27 @@ export function xplatBamboo({ native = false, ...options }: XplatBambooOptions =
22
22
  cssPlugin.generateBundle.order = 'pre'
23
23
  }
24
24
 
25
+ plugins.push({
26
+ name: 'xplat-bamboo:nativescript-entry-graph',
27
+ enforce: 'post',
28
+ transform(code, id) {
29
+ // @nativescript/vite builds from a generated entry
30
+ // (`virtual:entry-with-polyfills`). Under HMR that entry boots
31
+ // the app over HTTP instead of statically importing the app's
32
+ // main module, so `import 'virtual:bamboo.css'` there never
33
+ // enters the bundle's module graph — while class values still
34
+ // compile, tripping bamboocss's entry-graph check at buildEnd.
35
+ // Import the stylesheet from the generated entry itself so it
36
+ // is in the graph in every mode; the emitted asset then flows
37
+ // through the same generateBundle path as every other .css.
38
+ if (id !== '\0virtual:entry-with-polyfills' || code.includes('virtual:bamboo.css')) {
39
+ return
40
+ }
41
+
42
+ return { code: `${code}\nimport 'virtual:bamboo.css';\n`, map: null }
43
+ },
44
+ })
45
+
25
46
  plugins.push({
26
47
  name: 'xplat-bamboo:nativescript-output',
27
48
  enforce: 'post',