@gjsify/rolldown-plugin-gjsify 0.15.1 → 0.16.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/lib/plugins/css-as-string.js +26 -1
- package/package.json +10 -10
|
@@ -123,6 +123,19 @@ async function loadNpmBundler() {
|
|
|
123
123
|
// `exports` maps in the target package.json are honored (e.g.
|
|
124
124
|
// `@pixelrpg/gjs` exposes `./index.css` via its exports field — that
|
|
125
125
|
// must resolve through `package.json#exports`, not a direct file probe).
|
|
126
|
+
// A `url()`/asset reference (a `@font-face { src: url('x.woff2') }`, a
|
|
127
|
+
// `background: url('img.png')`, a `data:`/`http:` URL) is NOT a bundle-able
|
|
128
|
+
// CSS module — it is served by the consumer at runtime. lightningcss keeps
|
|
129
|
+
// `url()` verbatim by default, but a bare-specifier asset reference routed
|
|
130
|
+
// through the resolver (a future lightningcss version, or the native Rust
|
|
131
|
+
// `Bundler`) would otherwise hit `req.resolve()` and throw `Cannot find
|
|
132
|
+
// module`, aborting the ENTIRE CSS build over a font/image the bundler was
|
|
133
|
+
// never meant to resolve. This predicate lets the resolver leave such
|
|
134
|
+
// references as-authored so the fonts still load at runtime.
|
|
135
|
+
const ASSET_REF_RE = /\.(woff2?|ttf|otf|eot|svg|png|jpe?g|gif|webp|avif|ico)(\?|#|$)/i;
|
|
136
|
+
function isAssetReference(specifier) {
|
|
137
|
+
return /^(data|https?|file):/i.test(specifier) || ASSET_REF_RE.test(specifier);
|
|
138
|
+
}
|
|
126
139
|
const cssBundleResolver = {
|
|
127
140
|
resolve(specifier, from) {
|
|
128
141
|
if (isAbsolute(specifier))
|
|
@@ -134,7 +147,19 @@ const cssBundleResolver = {
|
|
|
134
147
|
// `createRequire` takes a file URL or path; passing the importer
|
|
135
148
|
// lets it scope its node_modules walk to the right starting point.
|
|
136
149
|
const req = createRequire(pathToFileURL(from).href);
|
|
137
|
-
|
|
150
|
+
try {
|
|
151
|
+
return req.resolve(specifier);
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
// Not an installed module. If it's a `url()`/asset reference,
|
|
155
|
+
// leave it verbatim so lightningcss keeps the `@font-face` /
|
|
156
|
+
// `url()` rule intact (the consumer serves the asset) instead of
|
|
157
|
+
// crashing the build. A genuine unresolvable CSS `@import`
|
|
158
|
+
// re-throws so the missing dependency still surfaces clearly.
|
|
159
|
+
if (isAssetReference(specifier))
|
|
160
|
+
return specifier;
|
|
161
|
+
throw err;
|
|
162
|
+
}
|
|
138
163
|
},
|
|
139
164
|
};
|
|
140
165
|
function targetsToBrowserslist(targets) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/rolldown-plugin-gjsify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Rolldown / Rollup / Vite plugin orchestrator for GJS, Node, and Browser targets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -55,20 +55,20 @@
|
|
|
55
55
|
],
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@gjsify/console": "^0.
|
|
59
|
-
"@gjsify/resolve-npm": "^0.
|
|
60
|
-
"@gjsify/rolldown-plugin-deepkit": "^0.
|
|
61
|
-
"@gjsify/rolldown-plugin-pnp": "^0.
|
|
62
|
-
"@gjsify/vite-plugin-blueprint": "^0.
|
|
58
|
+
"@gjsify/console": "^0.16.1",
|
|
59
|
+
"@gjsify/resolve-npm": "^0.16.1",
|
|
60
|
+
"@gjsify/rolldown-plugin-deepkit": "^0.16.1",
|
|
61
|
+
"@gjsify/rolldown-plugin-pnp": "^0.16.1",
|
|
62
|
+
"@gjsify/vite-plugin-blueprint": "^0.16.1",
|
|
63
63
|
"@rollup/pluginutils": "^5.4.0",
|
|
64
|
-
"acorn": "^8.
|
|
64
|
+
"acorn": "^8.17.0",
|
|
65
65
|
"acorn-walk": "^8.3.5",
|
|
66
66
|
"fast-glob": "^3.3.3",
|
|
67
67
|
"lightningcss": "^1.32.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@gjsify/lightningcss-native": "^0.
|
|
71
|
-
"rolldown": "^1.1.
|
|
70
|
+
"@gjsify/lightningcss-native": "^0.16.1",
|
|
71
|
+
"rolldown": "^1.1.4"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
74
|
"@gjsify/lightningcss-native": {
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/node": "^25.9.2",
|
|
83
|
-
"rolldown": "^1.1.
|
|
83
|
+
"rolldown": "^1.1.4",
|
|
84
84
|
"typescript": "^6.0.3"
|
|
85
85
|
},
|
|
86
86
|
"gjsify": {
|