@gjsify/lightningcss-native 0.23.0 → 0.24.1
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/lib/esm/index.gjs.spec.js +1 -0
- package/lib/esm/index.js +1 -1
- package/package.json +11 -7
- package/prebuilds/darwin-arm64/GjsifyLightningcss-1.0.gir +87 -0
- package/prebuilds/darwin-arm64/GjsifyLightningcss-1.0.typelib +0 -0
- package/prebuilds/darwin-arm64/libgjsify_lightningcss.dylib +0 -0
- package/prebuilds/darwin-arm64/libgjsifylightningcss.dylib +0 -0
- package/prebuilds/{linux-aarch64 → linux-arm64}/libgjsify_lightningcss.so +0 -0
- package/prebuilds/{linux-aarch64 → linux-arm64}/libgjsifylightningcss.so +0 -0
- package/prebuilds/linux-ppc64/libgjsify_lightningcss.so +0 -0
- package/prebuilds/linux-ppc64/libgjsifylightningcss.so +0 -0
- package/prebuilds/linux-riscv64/libgjsify_lightningcss.so +0 -0
- package/prebuilds/linux-riscv64/libgjsifylightningcss.so +0 -0
- package/prebuilds/linux-s390x/GjsifyLightningcss-1.0.typelib +0 -0
- package/prebuilds/linux-s390x/libgjsify_lightningcss.so +0 -0
- package/prebuilds/linux-s390x/libgjsifylightningcss.so +0 -0
- package/prebuilds/{linux-x86_64 → linux-x64}/libgjsify_lightningcss.so +0 -0
- package/prebuilds/{linux-x86_64 → linux-x64}/libgjsifylightningcss.so +0 -0
- /package/prebuilds/{linux-aarch64 → linux-arm64}/GjsifyLightningcss-1.0.gir +0 -0
- /package/prebuilds/{linux-aarch64 → linux-arm64}/GjsifyLightningcss-1.0.typelib +0 -0
- /package/prebuilds/{linux-x86_64 → linux-x64}/GjsifyLightningcss-1.0.gir +0 -0
- /package/prebuilds/{linux-x86_64 → linux-x64}/GjsifyLightningcss-1.0.typelib +0 -0
package/README.md
CHANGED
|
@@ -36,8 +36,8 @@ The native bridge is consumed automatically by `gjsify build --app gjs` via `@gj
|
|
|
36
36
|
|
|
37
37
|
| Platform | Prebuild | Built by |
|
|
38
38
|
|---|---|---|
|
|
39
|
-
| `linux-
|
|
40
|
-
| `linux-
|
|
39
|
+
| `linux-x64` | ✅ `.so` + `.gir` + `.typelib` | native runner |
|
|
40
|
+
| `linux-arm64` | ✅ | native runner |
|
|
41
41
|
| `linux-ppc64`, `linux-s390x`, `linux-riscv64` | ✅ | QEMU emulation |
|
|
42
42
|
| `darwin-arm64` (macOS, Apple silicon) | ✅ `.dylib` + `.gir` + `.typelib` | `macos-latest` runner |
|
|
43
43
|
| `darwin-x64` (macOS, Intel) | ❌ | — no runner leg yet |
|
|
@@ -0,0 +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"@girs/glib-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/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";let e=null,t=!1,n=null;function loadNativeLightningcss(){if(t)return e;t=!0;try{let t=globalThis.imports?.gi;if(!t)return n=Error(`imports.gi not available — not running under GJS?`),null;let r=t.GjsifyLightningcss;return r?(e=r,e):(n=Error(`GjsifyLightningcss typelib not found on GI_TYPELIB_PATH`),null)}catch(t){return n=t instanceof Error?t:Error(String(t)),e=null,null}}function hasNativeLightningcss(){return loadNativeLightningcss()!==null}function getLoadError(){return n}function getGLib(){let e=globalThis.imports?.gi;if(!e||!e.GLib)throw Error(`@gjsify/lightningcss-native: GLib not available (not running under GJS?)`);return e.GLib}function transform(e){let t=loadNativeLightningcss();if(!t)throw Error(`@gjsify/lightningcss-native: prebuild not available (${n?.message??`unknown`})`);let r=typeof e.code==`string`?new TextEncoder().encode(e.code):e.code,i=getGLib().Bytes.new(r),[a,o]=
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";let e=null,t=!1,n=null;function loadNativeLightningcss(){if(t)return e;t=!0;try{let t=globalThis.imports?.gi;if(!t)return n=Error(`imports.gi not available — not running under GJS?`),null;let r=t.GjsifyLightningcss;return r?(e=r,e):(n=Error(`GjsifyLightningcss typelib not found on GI_TYPELIB_PATH`),null)}catch(t){return n=t instanceof Error?t:Error(String(t)),e=null,null}}function hasNativeLightningcss(){return loadNativeLightningcss()!==null}function getLoadError(){return n}let r=null;function getEngine(e){return r===null&&(r=new e.Engine),r}function getGLib(){let e=globalThis.imports?.gi;if(!e||!e.GLib)throw Error(`@gjsify/lightningcss-native: GLib not available (not running under GJS?)`);return e.GLib}function transform(e){let t=loadNativeLightningcss();if(!t)throw Error(`@gjsify/lightningcss-native: prebuild not available (${n?.message??`unknown`})`);let r=typeof e.code==`string`?new TextEncoder().encode(e.code):e.code,i=getGLib().Bytes.new(r),[a,o]=getEngine(t).transform(e.filename??null,i,e.targets??null,!!e.minify,!!e.sourceMap),s={code:a.get_data()??new Uint8Array};if(o){let e=o.get_data();e&&(s.map=e)}return s}function bundle(e){let t=loadNativeLightningcss();if(!t)throw Error(`@gjsify/lightningcss-native: prebuild not available (${n?.message??`unknown`})`);let[r,i]=getEngine(t).bundle(e.filename,e.targets??null,!!e.minify,!!e.sourceMap,e.errorRecovery??!0),a={code:r.get_data()??new Uint8Array};if(i){let e=i.get_data();e&&(a.map=e)}return a}export{bundle,getLoadError,hasNativeLightningcss,loadNativeLightningcss,transform};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/lightningcss-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
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",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
],
|
|
22
22
|
"gjsify": {
|
|
23
23
|
"platforms": [
|
|
24
|
-
"linux-
|
|
25
|
-
"linux-
|
|
24
|
+
"linux-x64",
|
|
25
|
+
"linux-arm64",
|
|
26
26
|
"linux-ppc64",
|
|
27
27
|
"linux-s390x",
|
|
28
28
|
"linux-riscv64",
|
|
@@ -32,16 +32,19 @@
|
|
|
32
32
|
"tier": 1
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"clear": "rm -rf lib build tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo || exit 0",
|
|
36
|
-
"check": "gjsify tsc --noEmit",
|
|
35
|
+
"clear": "rm -rf lib build tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs || exit 0",
|
|
36
|
+
"check": "gjsify tsc --noEmit && gjsify tsc --noEmit -p tsconfig.spec.json",
|
|
37
37
|
"init:meson": "meson setup build .",
|
|
38
38
|
"init:meson:wipe": "gjsify run init:meson --wipe",
|
|
39
39
|
"build": "gjsify run build:gjsify && gjsify run build:types",
|
|
40
40
|
"build:gjsify": "gjsify build --library 'src/ts/**/*.{ts,js}'",
|
|
41
41
|
"build:meson": "node ../../../scripts/check-refs-pin.mjs . && gjsify run init:meson && meson compile -C build",
|
|
42
42
|
"build:types": "gjsify tsc",
|
|
43
|
+
"build:test:gjs": "gjsify build src/ts/test.mts --app gjs --outfile test.gjs.mjs",
|
|
44
|
+
"test": "gjsify run build:gjsify && gjsify run build:test:gjs && gjsify run test:gjs",
|
|
45
|
+
"test:gjs": "gjsify run test.gjs.mjs",
|
|
43
46
|
"build:prebuilds": "gjsify run build:meson && node ../../../scripts/stage-prebuild.mjs .",
|
|
44
|
-
"build:gir-types": "ts-for-gir generate --externalDeps --allowMissingDeps --girDirectories=./prebuilds/linux-
|
|
47
|
+
"build:gir-types": "ts-for-gir generate --externalDeps --allowMissingDeps --girDirectories=./prebuilds/linux-x64 --girDirectories=/usr/share/gir-1.0 --modules=GjsifyLightningcss-1.0 --outdir=src/ts --npmScope=@girs --package=false --ignoreVersionConflicts=true"
|
|
45
48
|
},
|
|
46
49
|
"keywords": [
|
|
47
50
|
"gjs",
|
|
@@ -59,7 +62,8 @@
|
|
|
59
62
|
"@girs/gobject-2.0": "^4.1.0"
|
|
60
63
|
},
|
|
61
64
|
"devDependencies": {
|
|
62
|
-
"@gjsify/cli": "^0.
|
|
65
|
+
"@gjsify/cli": "^0.24.1",
|
|
66
|
+
"@gjsify/unit": "^0.24.1",
|
|
63
67
|
"@ts-for-gir/cli": "^4.1.0",
|
|
64
68
|
"@types/node": "^25.9.2",
|
|
65
69
|
"typescript": "^6.0.3"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<!-- GjsifyLightningcss-1.0.gir generated by valac 0.56.19, do not modify. -->
|
|
3
|
+
<repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0" xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:doc="http://www.gtk.org/introspection/doc/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
|
|
4
|
+
<include name="GObject" version="2.0"/>
|
|
5
|
+
<include name="GLib" version="2.0"/>
|
|
6
|
+
<package name="gjsifylightningcss"/>
|
|
7
|
+
<c:include name="gjsify-lightningcss-glue.h"/>
|
|
8
|
+
<c:include name="gjsifylightningcss.h"/>
|
|
9
|
+
<doc:format name="unknown"/>
|
|
10
|
+
<namespace name="GjsifyLightningcss" version="1.0" shared-library="libgjsifylightningcss.dylib" c:prefix="GjsifyLightningcss" c:identifier-prefixes="GjsifyLightningcss" c:symbol-prefixes="gjsify_lightningcss">
|
|
11
|
+
<class name="Engine" c:type="GjsifyLightningcssEngine" c:symbol-prefix="engine" glib:type-name="GjsifyLightningcssEngine" glib:get-type="gjsify_lightningcss_engine_get_type" glib:type-struct="EngineClass" parent="GObject.Object">
|
|
12
|
+
<field name="parent_instance" readable="0" private="1">
|
|
13
|
+
<type name="GObject.Object" c:type="GObject"/>
|
|
14
|
+
</field>
|
|
15
|
+
<field name="priv" readable="0" private="1">
|
|
16
|
+
<type name="EnginePrivate" c:type="GjsifyLightningcssEnginePrivate*"/>
|
|
17
|
+
</field>
|
|
18
|
+
<method name="transform" c:identifier="gjsify_lightningcss_engine_transform" throws="1">
|
|
19
|
+
<return-value transfer-ownership="full">
|
|
20
|
+
<type name="GLib.Bytes" c:type="GBytes*"/>
|
|
21
|
+
</return-value>
|
|
22
|
+
<parameters>
|
|
23
|
+
<instance-parameter name="self" transfer-ownership="none">
|
|
24
|
+
<type name="GjsifyLightningcss.Engine" c:type="GjsifyLightningcssEngine*"/>
|
|
25
|
+
</instance-parameter>
|
|
26
|
+
<parameter name="filename" transfer-ownership="none" nullable="1">
|
|
27
|
+
<type name="utf8" c:type="const gchar*"/>
|
|
28
|
+
</parameter>
|
|
29
|
+
<parameter name="code" transfer-ownership="none">
|
|
30
|
+
<type name="GLib.Bytes" c:type="GBytes*"/>
|
|
31
|
+
</parameter>
|
|
32
|
+
<parameter name="browserslist" transfer-ownership="none" nullable="1">
|
|
33
|
+
<type name="utf8" c:type="const gchar*"/>
|
|
34
|
+
</parameter>
|
|
35
|
+
<parameter name="minify" transfer-ownership="none">
|
|
36
|
+
<type name="gboolean" c:type="gboolean"/>
|
|
37
|
+
</parameter>
|
|
38
|
+
<parameter name="source_map" transfer-ownership="none">
|
|
39
|
+
<type name="gboolean" c:type="gboolean"/>
|
|
40
|
+
</parameter>
|
|
41
|
+
<parameter name="out_source_map" direction="out" transfer-ownership="full" optional="1">
|
|
42
|
+
<type name="GLib.Bytes" c:type="GBytes**"/>
|
|
43
|
+
</parameter>
|
|
44
|
+
</parameters>
|
|
45
|
+
</method>
|
|
46
|
+
<method name="bundle" c:identifier="gjsify_lightningcss_engine_bundle" throws="1">
|
|
47
|
+
<return-value transfer-ownership="full">
|
|
48
|
+
<type name="GLib.Bytes" c:type="GBytes*"/>
|
|
49
|
+
</return-value>
|
|
50
|
+
<parameters>
|
|
51
|
+
<instance-parameter name="self" transfer-ownership="none">
|
|
52
|
+
<type name="GjsifyLightningcss.Engine" c:type="GjsifyLightningcssEngine*"/>
|
|
53
|
+
</instance-parameter>
|
|
54
|
+
<parameter name="filename" transfer-ownership="none">
|
|
55
|
+
<type name="utf8" c:type="const gchar*"/>
|
|
56
|
+
</parameter>
|
|
57
|
+
<parameter name="browserslist" transfer-ownership="none" nullable="1">
|
|
58
|
+
<type name="utf8" c:type="const gchar*"/>
|
|
59
|
+
</parameter>
|
|
60
|
+
<parameter name="minify" transfer-ownership="none">
|
|
61
|
+
<type name="gboolean" c:type="gboolean"/>
|
|
62
|
+
</parameter>
|
|
63
|
+
<parameter name="source_map" transfer-ownership="none">
|
|
64
|
+
<type name="gboolean" c:type="gboolean"/>
|
|
65
|
+
</parameter>
|
|
66
|
+
<parameter name="error_recovery" transfer-ownership="none">
|
|
67
|
+
<type name="gboolean" c:type="gboolean"/>
|
|
68
|
+
</parameter>
|
|
69
|
+
<parameter name="out_source_map" direction="out" transfer-ownership="full" optional="1">
|
|
70
|
+
<type name="GLib.Bytes" c:type="GBytes**"/>
|
|
71
|
+
</parameter>
|
|
72
|
+
</parameters>
|
|
73
|
+
</method>
|
|
74
|
+
<constructor name="new" c:identifier="gjsify_lightningcss_engine_new">
|
|
75
|
+
<return-value transfer-ownership="full">
|
|
76
|
+
<type name="GjsifyLightningcss.Engine" c:type="GjsifyLightningcssEngine*"/>
|
|
77
|
+
</return-value>
|
|
78
|
+
</constructor>
|
|
79
|
+
</class>
|
|
80
|
+
<record name="EngineClass" c:type="GjsifyLightningcssEngineClass" glib:is-gtype-struct-for="Engine">
|
|
81
|
+
<field name="parent_class" readable="0" private="1">
|
|
82
|
+
<type name="GObject.ObjectClass" c:type="GObjectClass"/>
|
|
83
|
+
</field>
|
|
84
|
+
</record>
|
|
85
|
+
<record name="EnginePrivate" c:type="GjsifyLightningcssEnginePrivate" disguised="1"/>
|
|
86
|
+
</namespace>
|
|
87
|
+
</repository>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
index d275a04..df4b6a7 100644
|
|
|
Binary file
|
|
index 6c3093e..55ef7c2 100644
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
index 2d1f0dd..eb8324f 100755
|
|
|
Binary file
|
|
index b2554a7..d20fa59 100755
|
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|