@prospective.co/procss 0.1.12 → 0.1.13
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 +1 -1
- package/src/transformers/inline_url.rs +18 -1
- package/target/cjs/procss.js +53 -51
- package/target/cjs/procss_bg.wasm +0 -0
- package/target/cjs/procss_bg.wasm.d.ts +1 -0
- package/target/esm/procss.d.ts +1 -0
- package/target/esm/procss.js +53 -48
- package/target/esm/procss_bg.wasm +0 -0
- package/target/esm/procss_bg.wasm.d.ts +1 -0
package/package.json
CHANGED
|
@@ -21,6 +21,23 @@ use crate::utils::fs;
|
|
|
21
21
|
#[cfg(feature = "iotest")]
|
|
22
22
|
use crate::utils::IoTestFs;
|
|
23
23
|
|
|
24
|
+
#[cfg(not(target_arch = "wasm32"))]
|
|
25
|
+
fn read_file_sync(path: &Path) -> Option<Vec<u8>> {
|
|
26
|
+
fs::read(path).ok()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#[cfg(target_arch = "wasm32")]
|
|
30
|
+
fn read_file_sync(path: &Path) -> Option<Vec<u8>> {
|
|
31
|
+
use wasm_bindgen::prelude::*;
|
|
32
|
+
#[wasm_bindgen(module = "fs")]
|
|
33
|
+
extern "C" {
|
|
34
|
+
#[wasm_bindgen(catch)]
|
|
35
|
+
fn readFileSync(path: &str) -> Result<Vec<u8>, JsValue>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
readFileSync(&*path.to_string_lossy()).ok()
|
|
39
|
+
}
|
|
40
|
+
|
|
24
41
|
fn parse_url(input: &str) -> nom::IResult<&str, &str> {
|
|
25
42
|
let unquoted = delimited(tag("url("), is_not(")"), tag(")"));
|
|
26
43
|
let quoted = delimited(tag("url(\""), is_not("\""), tag("\")"));
|
|
@@ -32,7 +49,7 @@ fn into_data_uri<'a>(path: &Path) -> Option<Cow<'a, str>> {
|
|
|
32
49
|
return None;
|
|
33
50
|
}
|
|
34
51
|
|
|
35
|
-
let contents =
|
|
52
|
+
let contents = read_file_sync(path)?;
|
|
36
53
|
let encoded = base64::encode(contents);
|
|
37
54
|
let fff = path.extension().unwrap_or_default().to_string_lossy();
|
|
38
55
|
let fmt = match fff.as_ref() {
|
package/target/cjs/procss.js
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
let imports = {};
|
|
2
2
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
3
|
let wasm;
|
|
4
|
+
const { readFileSync } = require(`fs`);
|
|
4
5
|
const { TextDecoder, TextEncoder } = require(`util`);
|
|
5
6
|
|
|
7
|
+
const heap = new Array(32).fill(undefined);
|
|
8
|
+
|
|
9
|
+
heap.push(undefined, null, true, false);
|
|
10
|
+
|
|
11
|
+
function getObject(idx) { return heap[idx]; }
|
|
12
|
+
|
|
13
|
+
let heap_next = heap.length;
|
|
14
|
+
|
|
15
|
+
function dropObject(idx) {
|
|
16
|
+
if (idx < 36) return;
|
|
17
|
+
heap[idx] = heap_next;
|
|
18
|
+
heap_next = idx;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function takeObject(idx) {
|
|
22
|
+
const ret = getObject(idx);
|
|
23
|
+
dropObject(idx);
|
|
24
|
+
return ret;
|
|
25
|
+
}
|
|
26
|
+
|
|
6
27
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
7
28
|
|
|
8
29
|
cachedTextDecoder.decode();
|
|
@@ -20,12 +41,6 @@ function getStringFromWasm0(ptr, len) {
|
|
|
20
41
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
21
42
|
}
|
|
22
43
|
|
|
23
|
-
const heap = new Array(32).fill(undefined);
|
|
24
|
-
|
|
25
|
-
heap.push(undefined, null, true, false);
|
|
26
|
-
|
|
27
|
-
let heap_next = heap.length;
|
|
28
|
-
|
|
29
44
|
function addHeapObject(obj) {
|
|
30
45
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
31
46
|
const idx = heap_next;
|
|
@@ -35,20 +50,6 @@ function addHeapObject(obj) {
|
|
|
35
50
|
return idx;
|
|
36
51
|
}
|
|
37
52
|
|
|
38
|
-
function getObject(idx) { return heap[idx]; }
|
|
39
|
-
|
|
40
|
-
function dropObject(idx) {
|
|
41
|
-
if (idx < 36) return;
|
|
42
|
-
heap[idx] = heap_next;
|
|
43
|
-
heap_next = idx;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function takeObject(idx) {
|
|
47
|
-
const ret = getObject(idx);
|
|
48
|
-
dropObject(idx);
|
|
49
|
-
return ret;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
53
|
let WASM_VECTOR_LEN = 0;
|
|
53
54
|
|
|
54
55
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -112,6 +113,21 @@ function getInt32Memory0() {
|
|
|
112
113
|
}
|
|
113
114
|
return cachedInt32Memory0;
|
|
114
115
|
}
|
|
116
|
+
|
|
117
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
118
|
+
const ptr = malloc(arg.length * 1);
|
|
119
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
120
|
+
WASM_VECTOR_LEN = arg.length;
|
|
121
|
+
return ptr;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function handleError(f, args) {
|
|
125
|
+
try {
|
|
126
|
+
return f.apply(this, args);
|
|
127
|
+
} catch (e) {
|
|
128
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
115
131
|
/**
|
|
116
132
|
* An implementation of `BuildCss` which owns its data, suitable for use as an
|
|
117
133
|
* exported type in JavaScript.
|
|
@@ -177,54 +193,40 @@ class BuildCss {
|
|
|
177
193
|
}
|
|
178
194
|
module.exports.BuildCss = BuildCss;
|
|
179
195
|
|
|
180
|
-
module.exports.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
190
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
191
|
-
return ret;
|
|
192
|
-
};
|
|
196
|
+
module.exports.__wbg_readFileSync_05b78d1dec4f3f83 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
197
|
+
const ret = readFileSync(getStringFromWasm0(arg1, arg2));
|
|
198
|
+
const ptr0 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
|
|
199
|
+
const len0 = WASM_VECTOR_LEN;
|
|
200
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
201
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
202
|
+
}, arguments) };
|
|
193
203
|
|
|
194
204
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
195
205
|
takeObject(arg0);
|
|
196
206
|
};
|
|
197
207
|
|
|
198
|
-
module.exports.
|
|
199
|
-
const ret = new
|
|
208
|
+
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
209
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
200
210
|
return addHeapObject(ret);
|
|
201
211
|
};
|
|
202
212
|
|
|
203
|
-
module.exports.
|
|
204
|
-
const ret =
|
|
213
|
+
module.exports.__wbg_new_268f7b7dd3430798 = function() {
|
|
214
|
+
const ret = new Map();
|
|
205
215
|
return addHeapObject(ret);
|
|
206
216
|
};
|
|
207
217
|
|
|
208
|
-
module.exports.
|
|
209
|
-
const ret =
|
|
218
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
219
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
210
220
|
return addHeapObject(ret);
|
|
211
221
|
};
|
|
212
222
|
|
|
213
|
-
module.exports.
|
|
214
|
-
const ret =
|
|
215
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
216
|
-
const len0 = WASM_VECTOR_LEN;
|
|
217
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
218
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
222
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
223
|
+
module.exports.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
|
224
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
223
225
|
return addHeapObject(ret);
|
|
224
226
|
};
|
|
225
227
|
|
|
226
|
-
module.exports.
|
|
227
|
-
|
|
228
|
+
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
229
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
228
230
|
};
|
|
229
231
|
|
|
230
232
|
const path = require('path').join(__dirname, 'procss_bg.wasm');
|
|
Binary file
|
|
@@ -9,4 +9,5 @@ export function buildcss_compile(a: number, b: number): void;
|
|
|
9
9
|
export function __wbindgen_malloc(a: number): number;
|
|
10
10
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
11
11
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
12
|
+
export function __wbindgen_exn_store(a: number): void;
|
|
12
13
|
export function __wbindgen_start(): void;
|
package/target/esm/procss.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface InitOutput {
|
|
|
33
33
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
34
34
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
35
35
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
36
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
36
37
|
readonly __wbindgen_start: () => void;
|
|
37
38
|
}
|
|
38
39
|
|
package/target/esm/procss.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
1
2
|
|
|
2
3
|
let wasm;
|
|
3
4
|
|
|
5
|
+
const heap = new Array(32).fill(undefined);
|
|
6
|
+
|
|
7
|
+
heap.push(undefined, null, true, false);
|
|
8
|
+
|
|
9
|
+
function getObject(idx) { return heap[idx]; }
|
|
10
|
+
|
|
11
|
+
let heap_next = heap.length;
|
|
12
|
+
|
|
13
|
+
function dropObject(idx) {
|
|
14
|
+
if (idx < 36) return;
|
|
15
|
+
heap[idx] = heap_next;
|
|
16
|
+
heap_next = idx;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function takeObject(idx) {
|
|
20
|
+
const ret = getObject(idx);
|
|
21
|
+
dropObject(idx);
|
|
22
|
+
return ret;
|
|
23
|
+
}
|
|
24
|
+
|
|
4
25
|
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
5
26
|
|
|
6
27
|
cachedTextDecoder.decode();
|
|
@@ -18,12 +39,6 @@ function getStringFromWasm0(ptr, len) {
|
|
|
18
39
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
19
40
|
}
|
|
20
41
|
|
|
21
|
-
const heap = new Array(32).fill(undefined);
|
|
22
|
-
|
|
23
|
-
heap.push(undefined, null, true, false);
|
|
24
|
-
|
|
25
|
-
let heap_next = heap.length;
|
|
26
|
-
|
|
27
42
|
function addHeapObject(obj) {
|
|
28
43
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
29
44
|
const idx = heap_next;
|
|
@@ -33,20 +48,6 @@ function addHeapObject(obj) {
|
|
|
33
48
|
return idx;
|
|
34
49
|
}
|
|
35
50
|
|
|
36
|
-
function getObject(idx) { return heap[idx]; }
|
|
37
|
-
|
|
38
|
-
function dropObject(idx) {
|
|
39
|
-
if (idx < 36) return;
|
|
40
|
-
heap[idx] = heap_next;
|
|
41
|
-
heap_next = idx;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function takeObject(idx) {
|
|
45
|
-
const ret = getObject(idx);
|
|
46
|
-
dropObject(idx);
|
|
47
|
-
return ret;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
51
|
let WASM_VECTOR_LEN = 0;
|
|
51
52
|
|
|
52
53
|
const cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -110,6 +111,21 @@ function getInt32Memory0() {
|
|
|
110
111
|
}
|
|
111
112
|
return cachedInt32Memory0;
|
|
112
113
|
}
|
|
114
|
+
|
|
115
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
116
|
+
const ptr = malloc(arg.length * 1);
|
|
117
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
118
|
+
WASM_VECTOR_LEN = arg.length;
|
|
119
|
+
return ptr;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function handleError(f, args) {
|
|
123
|
+
try {
|
|
124
|
+
return f.apply(this, args);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
113
129
|
/**
|
|
114
130
|
* An implementation of `BuildCss` which owns its data, suitable for use as an
|
|
115
131
|
* exported type in JavaScript.
|
|
@@ -208,45 +224,34 @@ async function load(module, imports) {
|
|
|
208
224
|
function getImports() {
|
|
209
225
|
const imports = {};
|
|
210
226
|
imports.wbg = {};
|
|
211
|
-
imports.wbg.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
};
|
|
218
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
219
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
220
|
-
return ret;
|
|
221
|
-
};
|
|
227
|
+
imports.wbg.__wbg_readFileSync_05b78d1dec4f3f83 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
228
|
+
const ret = readFileSync(getStringFromWasm0(arg1, arg2));
|
|
229
|
+
const ptr0 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
|
|
230
|
+
const len0 = WASM_VECTOR_LEN;
|
|
231
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
232
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
233
|
+
}, arguments) };
|
|
222
234
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
223
235
|
takeObject(arg0);
|
|
224
236
|
};
|
|
225
|
-
imports.wbg.
|
|
226
|
-
const ret = new
|
|
237
|
+
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
238
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
227
239
|
return addHeapObject(ret);
|
|
228
240
|
};
|
|
229
|
-
imports.wbg.
|
|
230
|
-
const ret =
|
|
241
|
+
imports.wbg.__wbg_new_268f7b7dd3430798 = function() {
|
|
242
|
+
const ret = new Map();
|
|
231
243
|
return addHeapObject(ret);
|
|
232
244
|
};
|
|
233
|
-
imports.wbg.
|
|
234
|
-
const ret =
|
|
245
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
246
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
235
247
|
return addHeapObject(ret);
|
|
236
248
|
};
|
|
237
|
-
imports.wbg.
|
|
238
|
-
const ret =
|
|
239
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
240
|
-
const len0 = WASM_VECTOR_LEN;
|
|
241
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
242
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
243
|
-
};
|
|
244
|
-
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
245
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
249
|
+
imports.wbg.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
|
250
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
246
251
|
return addHeapObject(ret);
|
|
247
252
|
};
|
|
248
|
-
imports.wbg.
|
|
249
|
-
|
|
253
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
254
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
250
255
|
};
|
|
251
256
|
|
|
252
257
|
return imports;
|
|
Binary file
|
|
@@ -9,4 +9,5 @@ export function buildcss_compile(a: number, b: number): void;
|
|
|
9
9
|
export function __wbindgen_malloc(a: number): number;
|
|
10
10
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
11
11
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
12
|
+
export function __wbindgen_exn_store(a: number): void;
|
|
12
13
|
export function __wbindgen_start(): void;
|