@prospective.co/procss 0.1.11 → 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/builder.rs +19 -19
- package/src/main.rs +1 -2
- package/src/transformers/apply_import.rs +9 -6
- package/src/transformers/inline_url.rs +28 -4
- package/src/utils.rs +3 -4
- 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
package/src/builder.rs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// └───────────────────────────────────────────────────────────────────────────┘
|
|
11
11
|
|
|
12
12
|
use std::collections::HashMap;
|
|
13
|
-
use std::path::PathBuf;
|
|
13
|
+
use std::path::{Path, PathBuf};
|
|
14
14
|
|
|
15
15
|
use anyhow::Context;
|
|
16
16
|
|
|
@@ -25,15 +25,15 @@ use crate::{ast, transformers, utils};
|
|
|
25
25
|
/// A CSS+ project build, comprising a collection of CSS+ files which may
|
|
26
26
|
/// reference eachother (via `@import`).
|
|
27
27
|
pub struct BuildCss<'a> {
|
|
28
|
-
paths: Vec<
|
|
29
|
-
contents: HashMap<&'a
|
|
30
|
-
trees: HashMap<&'a
|
|
31
|
-
css: HashMap<&'a
|
|
32
|
-
rootdir:
|
|
28
|
+
paths: Vec<PathBuf>,
|
|
29
|
+
contents: HashMap<&'a Path, String>,
|
|
30
|
+
trees: HashMap<&'a Path, ast::Tree<'a>>,
|
|
31
|
+
css: HashMap<&'a Path, ast::Css<'a>>,
|
|
32
|
+
rootdir: PathBuf,
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/// The compiled output of a [`BuildCss`] collection, obtained from
|
|
36
|
-
/// [`BuildCss::compile`].
|
|
36
|
+
/// [`BuildCss::compile`].
|
|
37
37
|
pub struct CompiledCss<'a>(&'a BuildCss<'a>);
|
|
38
38
|
|
|
39
39
|
/// An incremental build struct for compiling a project's CSS sources.
|
|
@@ -47,7 +47,7 @@ pub struct CompiledCss<'a>(&'a BuildCss<'a>);
|
|
|
47
47
|
/// ```
|
|
48
48
|
impl<'a> BuildCss<'a> {
|
|
49
49
|
/// Create a new [`BuildCss`] rooted at `rootdir`.
|
|
50
|
-
pub fn new<
|
|
50
|
+
pub fn new<P: Into<PathBuf>>(rootdir: P) -> Self {
|
|
51
51
|
Self {
|
|
52
52
|
paths: Default::default(),
|
|
53
53
|
contents: Default::default(),
|
|
@@ -59,17 +59,17 @@ impl<'a> BuildCss<'a> {
|
|
|
59
59
|
|
|
60
60
|
/// Add a file `path` to this build.
|
|
61
61
|
#[cfg(not(target_arch = "wasm32"))]
|
|
62
|
-
pub fn add_file(&mut self, path: &'a
|
|
63
|
-
self.paths.push(path.
|
|
64
|
-
let inpath =
|
|
65
|
-
let txt = fs::read_to_string(inpath
|
|
66
|
-
self.contents.insert(path, txt);
|
|
62
|
+
pub fn add_file<P: ?Sized + AsRef<Path>>(&mut self, path: &'a P) {
|
|
63
|
+
self.paths.push(path.as_ref().into());
|
|
64
|
+
let inpath = self.rootdir.join(path);
|
|
65
|
+
let txt = fs::read_to_string(&inpath).unwrap();
|
|
66
|
+
self.contents.insert(path.as_ref(), txt);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/// Add a file `path` to this build.
|
|
70
|
-
pub fn add_content(&mut self, path: &'a
|
|
71
|
-
self.paths.push(path.
|
|
72
|
-
self.contents.insert(path, scss);
|
|
70
|
+
pub fn add_content<P: ?Sized + AsRef<Path>>(&mut self, path: &'a P, scss: String) {
|
|
71
|
+
self.paths.push(path.as_ref().into());
|
|
72
|
+
self.contents.insert(path.as_ref(), scss);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/// Compile this [`BuildCss`] start-to-finish, applying all transforms along
|
|
@@ -104,9 +104,9 @@ impl<'a> CompiledCss<'a> {
|
|
|
104
104
|
/// subdirectory structure of the `input` sources passed to
|
|
105
105
|
/// [`BuildCss::add`], relative to `outdir`.
|
|
106
106
|
#[cfg(not(target_arch = "wasm32"))]
|
|
107
|
-
pub fn write(self, outdir:
|
|
107
|
+
pub fn write<P: AsRef<Path>>(self, outdir: P) -> anyhow::Result<()> {
|
|
108
108
|
for (outfile, css, path) in self.iter_files().flatten() {
|
|
109
|
-
let outdir = utils::join_paths(outdir, path);
|
|
109
|
+
let outdir = utils::join_paths(outdir.as_ref(), path);
|
|
110
110
|
fs::create_dir_all(outdir.clone()).unwrap_or_default();
|
|
111
111
|
fs::write(outdir.join(outfile), css)?;
|
|
112
112
|
}
|
|
@@ -126,7 +126,7 @@ impl<'a> CompiledCss<'a> {
|
|
|
126
126
|
Ok(results)
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
fn iter_files(&self) -> impl Iterator<Item = anyhow::Result<(String, String, &'_
|
|
129
|
+
fn iter_files(&self) -> impl Iterator<Item = anyhow::Result<(String, String, &'_ Path)>> {
|
|
130
130
|
self.0.css.iter().map(|(path, css)| {
|
|
131
131
|
let outpath = PathBuf::from(path);
|
|
132
132
|
let outfile = format!(
|
package/src/main.rs
CHANGED
|
@@ -15,14 +15,13 @@ use procss::*;
|
|
|
15
15
|
|
|
16
16
|
#[cfg(not(target_arch = "wasm32"))]
|
|
17
17
|
mod init {
|
|
18
|
-
use std::path::Path;
|
|
19
18
|
use std::{env, fs};
|
|
20
19
|
|
|
21
20
|
use procss::*;
|
|
22
21
|
|
|
23
22
|
pub fn init() -> anyhow::Result<String> {
|
|
24
23
|
let args: Vec<String> = env::args().collect();
|
|
25
|
-
let contents = fs::read_to_string(
|
|
24
|
+
let contents = fs::read_to_string(&args[1]);
|
|
26
25
|
let css = parse(&contents?)?.flatten_tree().as_css_string();
|
|
27
26
|
Ok(css)
|
|
28
27
|
}
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
// └───────────────────────────────────────────────────────────────────────────┘
|
|
11
11
|
|
|
12
12
|
use std::collections::HashMap;
|
|
13
|
+
use std::path::Path;
|
|
13
14
|
|
|
14
15
|
use super::filter_refs;
|
|
15
16
|
use crate::ast::Ruleset::{self};
|
|
16
17
|
use crate::ast::*;
|
|
17
18
|
|
|
18
|
-
pub fn apply_import<'a, 'b>(assets: &'b HashMap<&
|
|
19
|
+
pub fn apply_import<'a, 'b>(assets: &'b HashMap<&Path, Tree<'a>>) -> impl Fn(&mut Tree<'a>) + 'b {
|
|
19
20
|
|tree| {
|
|
20
21
|
tree.transform(|ruleset| {
|
|
21
22
|
let mut replace = None;
|
|
@@ -23,15 +24,17 @@ pub fn apply_import<'a, 'b>(assets: &'b HashMap<&str, Tree<'a>>) -> impl Fn(&mut
|
|
|
23
24
|
if *name == "import" {
|
|
24
25
|
if let Some(val) = val {
|
|
25
26
|
if val.starts_with('\"') {
|
|
26
|
-
replace = assets.get(&val[1..val.len() - 1]).cloned();
|
|
27
|
+
replace = assets.get(Path::new(&val[1..val.len() - 1])).cloned();
|
|
27
28
|
if replace.is_none() {
|
|
28
29
|
panic!("File not found: '{}'", &val[1..val.len() - 1])
|
|
29
30
|
}
|
|
30
31
|
} else if val.starts_with("url(\"ref://") {
|
|
31
|
-
replace = assets.get(&val[11..val.len() - 2]).cloned().map(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
replace = assets.get(Path::new(&val[11..val.len() - 2])).cloned().map(
|
|
33
|
+
|mut x| {
|
|
34
|
+
filter_refs(&mut x);
|
|
35
|
+
x
|
|
36
|
+
},
|
|
37
|
+
);
|
|
35
38
|
|
|
36
39
|
if replace.is_none() {
|
|
37
40
|
panic!("File not found: '{}'", &val[1..val.len() - 1])
|
|
@@ -21,21 +21,43 @@ 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("\")"));
|
|
27
44
|
alt((quoted, unquoted))(input)
|
|
28
45
|
}
|
|
29
46
|
|
|
30
|
-
fn into_data_uri<'a>(path: &Path) -> Cow<'a, str
|
|
31
|
-
|
|
47
|
+
fn into_data_uri<'a>(path: &Path) -> Option<Cow<'a, str>> {
|
|
48
|
+
if path.starts_with("data:") {
|
|
49
|
+
return None;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let contents = read_file_sync(path)?;
|
|
32
53
|
let encoded = base64::encode(contents);
|
|
33
54
|
let fff = path.extension().unwrap_or_default().to_string_lossy();
|
|
34
55
|
let fmt = match fff.as_ref() {
|
|
35
56
|
"png" => "png",
|
|
36
57
|
_ => "svg+xml",
|
|
37
58
|
};
|
|
38
|
-
|
|
59
|
+
|
|
60
|
+
Some(format!("url(\"data:image/{};base64,{}\")", fmt, encoded).into())
|
|
39
61
|
}
|
|
40
62
|
|
|
41
63
|
fn inline_url_impl<'a>(newpath: &str, flat: &mut Css<'a>) {
|
|
@@ -46,7 +68,9 @@ fn inline_url_impl<'a>(newpath: &str, flat: &mut Css<'a>) {
|
|
|
46
68
|
|
|
47
69
|
if let Some(path) = &path {
|
|
48
70
|
if path.starts_with(".") || path.starts_with("/") {
|
|
49
|
-
|
|
71
|
+
if let Some(value) = into_data_uri(path) {
|
|
72
|
+
rule.value = value;
|
|
73
|
+
}
|
|
50
74
|
}
|
|
51
75
|
}
|
|
52
76
|
})
|
package/src/utils.rs
CHANGED
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
// │ │
|
|
10
10
|
// └───────────────────────────────────────────────────────────────────────────┘
|
|
11
11
|
|
|
12
|
-
use std::path::PathBuf;
|
|
13
|
-
|
|
14
12
|
use crate::render::RenderCss;
|
|
15
13
|
|
|
16
14
|
/// A wrapper around [`Vec`] which guarantees at least `N` elements.
|
|
@@ -56,8 +54,8 @@ impl<T: RenderCss, const N: usize> RenderCss for MinVec<T, N> {
|
|
|
56
54
|
/// to the latter and join with the former. If the latter path is not relative,
|
|
57
55
|
/// return the former. Useful for moving directory trees while retaining their
|
|
58
56
|
/// relative structure to some root.
|
|
59
|
-
pub fn join_paths(outdir: &
|
|
60
|
-
if let Some(parent) =
|
|
57
|
+
pub fn join_paths(outdir: &Path, path: &Path) -> PathBuf {
|
|
58
|
+
if let Some(parent) = path.parent() {
|
|
61
59
|
PathBuf::from(outdir).join(parent)
|
|
62
60
|
} else {
|
|
63
61
|
PathBuf::from(outdir)
|
|
@@ -87,6 +85,7 @@ mod mock {
|
|
|
87
85
|
|
|
88
86
|
#[cfg(not(feature = "iotest"))]
|
|
89
87
|
pub use std::fs;
|
|
88
|
+
use std::path::{Path, PathBuf};
|
|
90
89
|
|
|
91
90
|
#[cfg(feature = "iotest")]
|
|
92
91
|
pub use mock::{IoTestFs, MockIoTestFs as fs};
|
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 =
|
|
223
|
+
module.exports.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
|
224
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
215
225
|
return addHeapObject(ret);
|
|
216
226
|
};
|
|
217
227
|
|
|
218
|
-
module.exports.
|
|
219
|
-
|
|
220
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
221
|
-
const len0 = WASM_VECTOR_LEN;
|
|
222
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
223
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
module.exports.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
|
227
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
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 =
|
|
249
|
+
imports.wbg.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
|
250
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
239
251
|
return addHeapObject(ret);
|
|
240
252
|
};
|
|
241
|
-
imports.wbg.
|
|
242
|
-
|
|
243
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
244
|
-
const len0 = WASM_VECTOR_LEN;
|
|
245
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
246
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
247
|
-
};
|
|
248
|
-
imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
|
249
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
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;
|