@prospective.co/procss 0.1.9 → 0.1.10
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/package.json
CHANGED
package/src/lib.rs
CHANGED
|
@@ -30,7 +30,12 @@ fn parse_url(input: &str) -> nom::IResult<&str, &str> {
|
|
|
30
30
|
fn into_data_uri<'a>(path: &Path) -> Cow<'a, str> {
|
|
31
31
|
let contents = fs::read_to_string(path).expect("Error reading file");
|
|
32
32
|
let encoded = base64::encode(contents);
|
|
33
|
-
|
|
33
|
+
let fff = path.extension().unwrap_or_default().to_string_lossy();
|
|
34
|
+
let fmt = match fff.as_ref() {
|
|
35
|
+
"png" => "png",
|
|
36
|
+
_ => "svg+xml",
|
|
37
|
+
};
|
|
38
|
+
format!("url(\"data:image/{};base64,{}\")", fmt, encoded).into()
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
fn inline_url_impl<'a>(newpath: &str, flat: &mut Css<'a>) {
|
|
@@ -40,7 +45,9 @@ fn inline_url_impl<'a>(newpath: &str, flat: &mut Css<'a>) {
|
|
|
40
45
|
.and_then(|x| x.0.is_empty().then_some(Path::new(newpath).join(x.1)));
|
|
41
46
|
|
|
42
47
|
if let Some(path) = &path {
|
|
43
|
-
|
|
48
|
+
if path.starts_with(".") || path.starts_with("/") {
|
|
49
|
+
rule.value = into_data_uri(path);
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
52
|
})
|
|
46
53
|
}
|
package/target/cjs/procss.js
CHANGED
|
@@ -210,11 +210,6 @@ module.exports.__wbg_new_0b9bfdd97583284e = function() {
|
|
|
210
210
|
return addHeapObject(ret);
|
|
211
211
|
};
|
|
212
212
|
|
|
213
|
-
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
214
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
215
|
-
return addHeapObject(ret);
|
|
216
|
-
};
|
|
217
|
-
|
|
218
213
|
module.exports.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
|
|
219
214
|
const ret = String(getObject(arg1));
|
|
220
215
|
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -223,6 +218,11 @@ module.exports.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
|
|
|
223
218
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
224
219
|
};
|
|
225
220
|
|
|
221
|
+
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
222
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
223
|
+
return addHeapObject(ret);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
226
|
module.exports.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
|
227
227
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
228
228
|
};
|
|
Binary file
|
package/target/esm/procss.js
CHANGED
|
@@ -234,10 +234,6 @@ function getImports() {
|
|
|
234
234
|
const ret = new Object();
|
|
235
235
|
return addHeapObject(ret);
|
|
236
236
|
};
|
|
237
|
-
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
238
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
239
|
-
return addHeapObject(ret);
|
|
240
|
-
};
|
|
241
237
|
imports.wbg.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
|
|
242
238
|
const ret = String(getObject(arg1));
|
|
243
239
|
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -245,6 +241,10 @@ function getImports() {
|
|
|
245
241
|
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
246
242
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
247
243
|
};
|
|
244
|
+
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
245
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
246
|
+
return addHeapObject(ret);
|
|
247
|
+
};
|
|
248
248
|
imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
|
249
249
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
250
250
|
};
|
|
Binary file
|