@gjsify/lightningcss-native 0.45.0 → 0.46.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.
- package/lib/esm/index.gjs.spec.js +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__name as e}from"./_virtual/_rolldown/runtime.js";import{bundle as t,getLoadError as n,hasNativeLightningcss as r,loadNativeLightningcss as i,transform as a}from"./index.js";import{describe as o,expect as s,it as c,on as l}from"@gjsify/unit";import u from"
|
|
1
|
+
import{__name as e}from"./_virtual/_rolldown/runtime.js";import{bundle as t,getLoadError as n,hasNativeLightningcss as r,loadNativeLightningcss as i,transform as a}from"./index.js";import{describe as o,expect as s,it as c,on as l}from"@gjsify/unit";import u from"gi://GLib?version=2.0";const decode=e=>new TextDecoder().decode(e),d=`.btn { color: red; & .icon { padding: 4px; } &:hover { color: blue; } }`,f=`firefox >= 60`;function writeTempCss(e,t,n){let r=`${e}/${t}`;return u.file_set_contents(r,new TextEncoder().encode(n)),r}var p=e(async()=>{await l(`Gjs`,async()=>{await o(`@gjsify/lightningcss-native — module loading`,async()=>{await c(`loads the GjsifyLightningcss typelib successfully`,()=>{s(r()).toBe(!0),s(n()).toBeNull(),s(typeof i()?.Engine).toBe(`function`)})}),await o(`@gjsify/lightningcss-native — shared engine: option independence`,async()=>{let e=decode(a({filename:`a.css`,code:d}).code),t=decode(a({filename:`a.css`,code:d,targets:f}).code);await c(`the fixture actually distinguishes targets (guards the guard)`,()=>{s(e).not.toBe(t),s(t).toContain(`.btn .icon`)}),await c(`targets do not leak from a previous call`,()=>{a({filename:`a.css`,code:d,targets:f}),s(decode(a({filename:`a.css`,code:d}).code)).toBe(e),a({filename:`a.css`,code:d}),s(decode(a({filename:`a.css`,code:d,targets:f}).code)).toBe(t)}),await c(`minify does not leak from a previous call`,()=>{let e=decode(a({filename:`a.css`,code:d,minify:!1}).code),t=decode(a({filename:`a.css`,code:d,minify:!0}).code);s(e).not.toBe(t),s(decode(a({filename:`a.css`,code:d,minify:!1}).code)).toBe(e),s(decode(a({filename:`a.css`,code:d,minify:!0}).code)).toBe(t)}),await c(`a stored source map does not leak into a later map-less call`,()=>{s(a({filename:`a.css`,code:d,sourceMap:!0}).map).toBeDefined(),s(a({filename:`a.css`,code:d,sourceMap:!1}).map).toBeUndefined()}),await c(`the filename of a previous call does not leak into a later source map`,()=>{a({filename:`first.css`,code:d,sourceMap:!0});let e=a({filename:`second.css`,code:d,sourceMap:!0}),t=JSON.parse(decode(e.map));s(t.sources.join(`,`)).toContain(`second.css`),s(t.sources.join(`,`)).not.toContain(`first.css`)}),await c(`stays stable across many interleaved option changes`,()=>{for(let n=0;n<25;n++)s(decode(a({filename:`a.css`,code:d}).code)).toBe(e),s(decode(a({filename:`a.css`,code:d,targets:f}).code)).toBe(t)})}),await o(`@gjsify/lightningcss-native — shared engine: error isolation`,async()=>{await c(`surfaces a transform error and leaves the shared engine usable`,()=>{let e=decode(a({filename:`a.css`,code:d}).code);s(()=>a({filename:`a.css`,code:``})).toThrow(),s(decode(a({filename:`a.css`,code:d}).code)).toBe(e)}),await c(`surfaces a bundle error and leaves the shared engine usable`,()=>{let e=decode(a({filename:`a.css`,code:d}).code);s(()=>t({filename:`/nonexistent/gjsify-does-not-exist.css`})).toThrow(),s(decode(a({filename:`a.css`,code:d}).code)).toBe(e)})}),await o(`@gjsify/lightningcss-native — shared engine: bundle/transform interop`,async()=>{let e=u.Dir.make_tmp(`gjsify-lightningcss-XXXXXX`),n=writeTempCss(e,`leaf.css`,`.leaf { color: green; }`),r=writeTempCss(e,`entry.css`,`@import "./leaf.css";\n${d}`);await c(`bundle() resolves @import chains`,()=>{let e=decode(t({filename:r}).code);s(e).toContain(`.leaf`),s(e).toContain(`.btn`)}),await c(`bundle() and transform() do not contaminate each other`,()=>{let e=decode(t({filename:r}).code),n=decode(a({filename:`a.css`,code:d}).code);t({filename:r,targets:f,minify:!0}),s(decode(a({filename:`a.css`,code:d}).code)).toBe(n),a({filename:`a.css`,code:d,targets:f,sourceMap:!0}),s(decode(t({filename:r}).code)).toBe(e)}),await c(`cleans up the temp fixture directory`,()=>{u.unlink(r),u.unlink(n),u.rmdir(e),s(u.file_test(e,u.FileTest.EXISTS)).toBe(!1)})}),await o(`@gjsify/lightningcss-native — shared engine: the engine really is reused`,async()=>{await c(`constructs no further Engine instances after the first call`,()=>{let e=i();s(e).not.toBeNull(),a({filename:`a.css`,code:d});let t=e.Engine,n=0,Counting=function(){return n++,new t},r=!1;try{e.Engine=Counting,r=e.Engine===Counting;for(let e=0;e<25;e++)a({filename:`a.css`,code:d})}finally{r&&(e.Engine=t)}r?s(n).toBe(0):s(e.Engine).toBe(t)})})})},`default`);export{p as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/lightningcss-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "Vala/GObject + Rust cdylib bridge to lightningcss for GJS. Replaces the Node-only npm `lightningcss` package: parse, transform, minify, and browserslist-target lowering of CSS without leaving a Node-free GJS process. Backs `@gjsify/rolldown-plugin-gjsify`'s cssAsStringPlugin under `--app gjs` so GTK4-CSS lowering (firefox60) works without a Node runtime in the build pipeline.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/esm/index.js",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"native"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@girs/gjs": "
|
|
60
|
-
"@girs/glib-2.0": "
|
|
61
|
-
"@girs/gobject-2.0": "
|
|
59
|
+
"@girs/gjs": "4.6.0",
|
|
60
|
+
"@girs/glib-2.0": "4.6.0",
|
|
61
|
+
"@girs/gobject-2.0": "4.6.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@gjsify/cli": "^0.
|
|
65
|
-
"@gjsify/unit": "^0.
|
|
64
|
+
"@gjsify/cli": "^0.46.0",
|
|
65
|
+
"@gjsify/unit": "^0.46.0",
|
|
66
66
|
"@ts-for-gir/cli": "^4.1.0",
|
|
67
67
|
"@types/node": "^25.9.2",
|
|
68
68
|
"typescript": "^6.0.3"
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
},
|
|
80
80
|
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/infra/lightningcss-native#readme",
|
|
81
81
|
"optionalDependencies": {
|
|
82
|
-
"@gjsify/lightningcss-native-darwin-arm64": "0.
|
|
83
|
-
"@gjsify/lightningcss-native-darwin-x64": "0.
|
|
84
|
-
"@gjsify/lightningcss-native-linux-arm64": "0.
|
|
85
|
-
"@gjsify/lightningcss-native-linux-ppc64": "0.
|
|
86
|
-
"@gjsify/lightningcss-native-linux-riscv64": "0.
|
|
87
|
-
"@gjsify/lightningcss-native-linux-s390x": "0.
|
|
88
|
-
"@gjsify/lightningcss-native-linux-x64": "0.
|
|
82
|
+
"@gjsify/lightningcss-native-darwin-arm64": "0.46.0",
|
|
83
|
+
"@gjsify/lightningcss-native-darwin-x64": "0.46.0",
|
|
84
|
+
"@gjsify/lightningcss-native-linux-arm64": "0.46.0",
|
|
85
|
+
"@gjsify/lightningcss-native-linux-ppc64": "0.46.0",
|
|
86
|
+
"@gjsify/lightningcss-native-linux-riscv64": "0.46.0",
|
|
87
|
+
"@gjsify/lightningcss-native-linux-s390x": "0.46.0",
|
|
88
|
+
"@gjsify/lightningcss-native-linux-x64": "0.46.0"
|
|
89
89
|
}
|
|
90
90
|
}
|