@gjsify/rolldown-plugin-gjsify 0.64.13 → 0.64.15-next.287

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 CHANGED
@@ -55,6 +55,10 @@ For a GJS build the bundle records the addon's **package identity**, not a path
55
55
 
56
56
  `import bytes from './data/app.data.gresource.xml'` yields the compiled GResource as a `Uint8Array` ([ADR 0116](../../../docs/adr/0116-app-gresources-are-embedded-at-build-time-for-web-and-nativescript.md)). To type it, add `"@gjsify/rolldown-plugin-gjsify/types"` to your `tsconfig.json` `compilerOptions.types`. The same entry declares `*.gschema.xml?schema` ([ADR 0099](../../../docs/adr/0099-gio-settings-runs-on-the-browser-and-nativescript.md) § 1).
57
57
 
58
+ ## Stylesheet imports
59
+
60
+ The same entry types `import css from './style.css'` — plus `.scss`/`.sass` — as the `string` that `cssAsStringPlugin` emits, so a `Gtk.CssProvider` app needs no hand-written `css.d.ts`. Import the value and apply it: a bare `import './style.css'` has no effect to keep and is tree-shaken away.
61
+
58
62
  ## License
59
63
 
60
64
  MIT
@@ -403,6 +403,20 @@ export function cssAsStringPlugin(options = {}) {
403
403
  ? new TextDecoder('utf-8').decode(await loadAndBundleCss(id, targets, declare))
404
404
  : await readFile(id, 'utf8');
405
405
  }
406
+ // A stylesheet that PARSES to nothing loses every rule SILENTLY: lightningcss
407
+ // accepts a `//` header (Sass syntax, not CSS) and emits an empty file, so a
408
+ // template shipped an unstyled window at exit 0 with a green build. Anything left
409
+ // after stripping comments is content that must survive; a genuinely empty or
410
+ // comment-only file stays legal. Sass is exempt: dart-sass IS the authority on
411
+ // what its source compiles to, and a comment-only `.scss` legitimately has no CSS.
412
+ if (bundle && !/\.s[ac]ss$/.test(id) && !code.trim()) {
413
+ const source = await readFile(stripQuery(id), 'utf8');
414
+ if (source.replace(/\/\*[\s\S]*?\*\//g, '').trim()) {
415
+ throw new Error(`gjsify css-as-string: ${id} holds CSS but bundled to nothing. A \`//\` ` +
416
+ 'comment is Sass syntax, not CSS — lightningcss drops the rule that ' +
417
+ 'follows it. Use /* … */ comments, or move the file to `.scss`.');
418
+ }
419
+ }
406
420
  return {
407
421
  code: `export default ${JSON.stringify(code)};`,
408
422
  moduleType: 'js',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/rolldown-plugin-gjsify",
3
- "version": "0.64.13",
3
+ "version": "0.64.15-next.287",
4
4
  "description": "Rolldown / Rollup / Vite plugin orchestrator for GJS, Node, and Browser targets",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -67,13 +67,13 @@
67
67
  ],
68
68
  "license": "MIT",
69
69
  "dependencies": {
70
- "@gjsify/console": "^0.64.13",
71
- "@gjsify/resolve-npm": "^0.64.13",
72
- "@gjsify/rolldown-plugin-deepkit": "^0.64.13",
73
- "@gjsify/rolldown-plugin-pnp": "^0.64.13",
74
- "@gjsify/utils": "^0.64.13",
75
- "@gjsify/vite-plugin-blueprint": "^0.64.13",
76
- "@gjsify/vite-plugin-gettext": "^0.64.13",
70
+ "@gjsify/console": "0.64.15-next.287",
71
+ "@gjsify/resolve-npm": "0.64.15-next.287",
72
+ "@gjsify/rolldown-plugin-deepkit": "0.64.15-next.287",
73
+ "@gjsify/rolldown-plugin-pnp": "0.64.15-next.287",
74
+ "@gjsify/utils": "0.64.15-next.287",
75
+ "@gjsify/vite-plugin-blueprint": "0.64.15-next.287",
76
+ "@gjsify/vite-plugin-gettext": "0.64.15-next.287",
77
77
  "@rollup/pluginutils": "^5.4.0",
78
78
  "acorn": "^8.17.0",
79
79
  "acorn-typescript": "^1.4.13",
@@ -83,7 +83,7 @@
83
83
  "sass": "^1.101.0"
84
84
  },
85
85
  "peerDependencies": {
86
- "@gjsify/lightningcss-native": "^0.64.13",
86
+ "@gjsify/lightningcss-native": "0.64.15-next.287",
87
87
  "rolldown": "^1.1.4"
88
88
  },
89
89
  "peerDependenciesMeta": {
@@ -95,8 +95,8 @@
95
95
  }
96
96
  },
97
97
  "devDependencies": {
98
- "@gjsify/cli": "^0.64.13",
99
- "@gjsify/unit": "^0.64.13",
98
+ "@gjsify/cli": "0.64.15-next.287",
99
+ "@gjsify/unit": "0.64.15-next.287",
100
100
  "@types/node": "^25.9.2",
101
101
  "rolldown": "^1.1.4",
102
102
  "typescript": "^6.0.3"
@@ -108,5 +108,6 @@
108
108
  "darwin": "supported",
109
109
  "win32": "supported"
110
110
  }
111
- }
111
+ },
112
+ "gitHead": "5742b282a8a2bc8633dd8384ef436768447f6a83"
112
113
  }
package/types/index.d.ts CHANGED
@@ -18,3 +18,30 @@ declare module '*.gschema.xml?schema' {
18
18
  const schema: unknown;
19
19
  export default schema;
20
20
  }
21
+
22
+ /**
23
+ * `import css from './style.css'` — and `.scss`/`.sass`, which `plugins/css-as-string.ts`
24
+ * compiles to flat CSS first. That plugin's `load` hook runs before the CSS classification
25
+ * Rolldown no longer has, and the emitted module's default export is the stylesheet source,
26
+ * which is what `Gtk.CssProvider` wants: `provider.load_from_string(css)`. Without this
27
+ * declaration every stylesheet import failed `check` with TS2307 and each project shipped its
28
+ * own `src/css.d.ts` to say the same thing.
29
+ *
30
+ * Import the VALUE and apply it. A bare `import './x.css'` reaches a module whose only effect
31
+ * is that default export, so it tree-shakes away at exit 0 — the reason
32
+ * `gjsify/no-css-side-effect-import` exists.
33
+ */
34
+ declare module '*.css' {
35
+ const css: string;
36
+ export default css;
37
+ }
38
+
39
+ declare module '*.scss' {
40
+ const css: string;
41
+ export default css;
42
+ }
43
+
44
+ declare module '*.sass' {
45
+ const css: string;
46
+ export default css;
47
+ }