@gjsify/vite-plugin-gjsify 0.16.1 → 0.16.2
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/lib/index.d.ts +17 -0
- package/lib/index.js +6 -1
- package/package.json +6 -6
package/lib/index.d.ts
CHANGED
|
@@ -19,6 +19,23 @@ export interface GjsifyBrowserOptions {
|
|
|
19
19
|
* is always excluded.
|
|
20
20
|
*/
|
|
21
21
|
optimizeDepsExclude?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Resolve `.css` imports to their CSS **string** (default export) instead of
|
|
24
|
+
* routing them through Vite's native CSS pipeline (auto-injected `<link>` /
|
|
25
|
+
* HMR). OFF by default — a browser-native app wants Vite's pipeline.
|
|
26
|
+
*
|
|
27
|
+
* Turn this ON to UNIFY styling with the native (`--app gjs`) target, where
|
|
28
|
+
* CSS is authored in real `.css` files and consumed as a string
|
|
29
|
+
* (`import css from './x.css'` → `Gtk.CssProvider.load_from_string(css)`).
|
|
30
|
+
* With it on, `gjsify build --app browser` (which always applies
|
|
31
|
+
* css-as-string) and this Vite dev preset agree: `import css from './x.css'`
|
|
32
|
+
* yields the identical CSS string on BOTH, so a cross-platform app can share
|
|
33
|
+
* one authoring pattern (real `.css` file + import-as-string + a per-target
|
|
34
|
+
* apply step: `Gtk.CssProvider` on GJS, a `<style>` element on the browser).
|
|
35
|
+
* The app owns injection, mirroring how `@gjsify/adwaita-web` self-injects
|
|
36
|
+
* its skin. Trades away Vite CSS HMR / `<link>` extraction for that parity.
|
|
37
|
+
*/
|
|
38
|
+
cssAsString?: boolean;
|
|
22
39
|
}
|
|
23
40
|
/**
|
|
24
41
|
* Returns the Vite plugin array that brings `gjsify build --app browser`'s
|
package/lib/index.js
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
import { createRequire } from 'node:module';
|
|
32
32
|
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
33
33
|
import * as nodePath from 'node:path';
|
|
34
|
-
import { gjsImportsEmptyPlugin, platformResolvePlugin, detectNativescriptPlatform, nativescriptPlatformDefines, } from '@gjsify/rolldown-plugin-gjsify';
|
|
34
|
+
import { gjsImportsEmptyPlugin, platformResolvePlugin, detectNativescriptPlatform, nativescriptPlatformDefines, cssAsStringPlugin, } from '@gjsify/rolldown-plugin-gjsify';
|
|
35
35
|
import blueprintPlugin from '@gjsify/vite-plugin-blueprint';
|
|
36
36
|
import { deepkitPlugin } from '@gjsify/rolldown-plugin-deepkit';
|
|
37
37
|
import { ALIASES_NODE_FOR_NATIVESCRIPT } from '@gjsify/resolve-npm';
|
|
@@ -98,6 +98,11 @@ export function gjsifyBrowser(options = {}) {
|
|
|
98
98
|
gjsImportsEmptyPlugin(),
|
|
99
99
|
blueprintPlugin(),
|
|
100
100
|
deepkitPlugin({ reflection: options.reflection }),
|
|
101
|
+
// Opt-in: mirror `--app browser`'s css-as-string so `import css from
|
|
102
|
+
// './x.css'` yields the CSS string in dev too (unify with the native
|
|
103
|
+
// `--app gjs` target). `enforce: 'pre'` so this `load` fires before
|
|
104
|
+
// Vite's built-in CSS transform claims the `.css` id.
|
|
105
|
+
...(options.cssAsString ? [{ ...cssAsStringPlugin(), enforce: 'pre' }] : []),
|
|
101
106
|
configPlugin,
|
|
102
107
|
];
|
|
103
108
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/vite-plugin-gjsify",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"description": "Vite plugin presets mirroring `gjsify build --app browser` / `--app nativescript` — dev (Vite/HMR) parity with the gjsify CLI targets.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
],
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@gjsify/empty": "^0.16.
|
|
43
|
-
"@gjsify/resolve-npm": "^0.16.
|
|
44
|
-
"@gjsify/rolldown-plugin-deepkit": "^0.16.
|
|
45
|
-
"@gjsify/rolldown-plugin-gjsify": "^0.16.
|
|
46
|
-
"@gjsify/vite-plugin-blueprint": "^0.16.
|
|
42
|
+
"@gjsify/empty": "^0.16.2",
|
|
43
|
+
"@gjsify/resolve-npm": "^0.16.2",
|
|
44
|
+
"@gjsify/rolldown-plugin-deepkit": "^0.16.2",
|
|
45
|
+
"@gjsify/rolldown-plugin-gjsify": "^0.16.2",
|
|
46
|
+
"@gjsify/vite-plugin-blueprint": "^0.16.2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"vite": "^8.1.3"
|