@prospective.co/procss 0.1.13 → 0.1.15
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/ast/ruleset/mod.rs +4 -4
- package/src/ast/ruleset/rule.rs +1 -1
- package/src/ast/token/space.rs +18 -14
- package/src/ast/tree_ruleset.rs +1 -1
- package/src/ast.rs +3 -3
- package/src/builder.rs +7 -3
- package/src/lib.rs +4 -2
- package/src/main.rs +3 -1
- package/src/transformers/apply_mixin.rs +8 -8
- package/src/transformers/apply_var.rs +0 -6
- package/src/transformers/deduplicate.rs +27 -0
- package/src/transformers/filter_refs.rs +2 -4
- package/src/transformers/{dedupe.rs → merge_siblings.rs} +5 -1
- package/src/transformers/mod.rs +8 -2
- package/src/transformers/remove_mixin.rs +29 -0
- package/src/transformers/remove_var.rs +27 -0
- package/target/cjs/procss.js +99 -57
- package/target/cjs/procss_bg.wasm +0 -0
- package/target/cjs/procss_bg.wasm.d.ts +3 -2
- package/target/esm/procss.d.ts +4 -3
- package/target/esm/procss.js +115 -76
- package/target/esm/procss_bg.wasm +0 -0
- package/target/esm/procss_bg.wasm.d.ts +3 -2
package/package.json
CHANGED
package/src/ast/ruleset/mod.rs
CHANGED
|
@@ -32,7 +32,7 @@ use crate::transform::TransformCss;
|
|
|
32
32
|
/// color: red;
|
|
33
33
|
/// }
|
|
34
34
|
/// ```
|
|
35
|
-
#[derive(Debug,
|
|
35
|
+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
36
36
|
pub struct SelectorRuleset<'a, T>(pub Selector<'a>, pub Vec<T>);
|
|
37
37
|
|
|
38
38
|
impl<'a, T: RenderCss> RenderCss for SelectorRuleset<'a, T> {
|
|
@@ -95,7 +95,7 @@ impl<'a> RenderCss for QualRule<'a> {
|
|
|
95
95
|
/// font-family: "My Font";
|
|
96
96
|
/// };
|
|
97
97
|
/// ```
|
|
98
|
-
#[derive(Debug,
|
|
98
|
+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
99
99
|
pub struct QualRuleset<'a, T>(pub QualRule<'a>, pub Vec<T>);
|
|
100
100
|
|
|
101
101
|
impl<'a, T: RenderCss> RenderCss for QualRuleset<'a, T> {
|
|
@@ -139,7 +139,7 @@ impl<'a, T: TransformCss<U>, U> TransformCss<U> for QualRuleset<'a, T> {
|
|
|
139
139
|
/// }
|
|
140
140
|
/// }
|
|
141
141
|
/// ```
|
|
142
|
-
#[derive(Debug,
|
|
142
|
+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
143
143
|
pub struct QualNestedRuleset<'a, T>(pub QualRule<'a>, pub Vec<Ruleset<'a, T>>);
|
|
144
144
|
|
|
145
145
|
impl<'a, T: RenderCss> RenderCss for QualNestedRuleset<'a, T> {
|
|
@@ -194,7 +194,7 @@ where
|
|
|
194
194
|
/// }
|
|
195
195
|
/// ```
|
|
196
196
|
#[allow(clippy::enum_variant_names)]
|
|
197
|
-
#[derive(Clone, Debug)]
|
|
197
|
+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
198
198
|
pub enum Ruleset<'a, T> {
|
|
199
199
|
SelectorRuleset(SelectorRuleset<'a, T>),
|
|
200
200
|
QualRule(QualRule<'a>),
|
package/src/ast/ruleset/rule.rs
CHANGED
|
@@ -24,7 +24,7 @@ use crate::render::RenderCss;
|
|
|
24
24
|
use crate::transform::TransformCss;
|
|
25
25
|
|
|
26
26
|
/// A CSS rule, of the form `xxx: yyy` (delimited by `;` in a ruleset).
|
|
27
|
-
#[derive(Clone, Debug)]
|
|
27
|
+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
28
28
|
pub struct Rule<'a> {
|
|
29
29
|
pub property: Cow<'a, str>,
|
|
30
30
|
pub value: Cow<'a, str>,
|
package/src/ast/token/space.rs
CHANGED
|
@@ -31,14 +31,30 @@ impl NeedsWhitespaceStringExt for str {
|
|
|
31
31
|
fn needs_pre_ws(&self) -> bool {
|
|
32
32
|
self.chars()
|
|
33
33
|
.next()
|
|
34
|
-
.map(|x|
|
|
34
|
+
.map(|x| {
|
|
35
|
+
x.is_ascii_alphanumeric()
|
|
36
|
+
|| x == '-'
|
|
37
|
+
|| x == '_'
|
|
38
|
+
|| x == '%'
|
|
39
|
+
|| x == '+'
|
|
40
|
+
|| x == '"'
|
|
41
|
+
|| x == '\''
|
|
42
|
+
})
|
|
35
43
|
.unwrap_or_default()
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
fn needs_post_ws(&self) -> bool {
|
|
39
47
|
self.chars()
|
|
40
48
|
.last()
|
|
41
|
-
.map(|x|
|
|
49
|
+
.map(|x| {
|
|
50
|
+
x.is_ascii_alphanumeric()
|
|
51
|
+
|| x == '"'
|
|
52
|
+
|| x == '\''
|
|
53
|
+
|| x == '-'
|
|
54
|
+
|| x == '_'
|
|
55
|
+
|| x == '%'
|
|
56
|
+
|| x == '+'
|
|
57
|
+
})
|
|
42
58
|
.unwrap_or_default()
|
|
43
59
|
}
|
|
44
60
|
}
|
|
@@ -57,18 +73,6 @@ pub fn trim_whitespace(s: &str, f: &mut std::fmt::Formatter<'_>) {
|
|
|
57
73
|
});
|
|
58
74
|
}
|
|
59
75
|
|
|
60
|
-
// pub fn trim_whitespace(s: &str, f: &mut std::fmt::Formatter<'_>) {
|
|
61
|
-
// let mut flag = false;
|
|
62
|
-
// s.split_whitespace().for_each(|w| {
|
|
63
|
-
// if flag {
|
|
64
|
-
// write!(f, " ").unwrap();
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
|
-
// flag = flag || !w.is_empty();
|
|
68
|
-
// write!(f, "{}", w).unwrap();
|
|
69
|
-
// });
|
|
70
|
-
// }
|
|
71
|
-
|
|
72
76
|
fn parse_comment<'a, E>(input: &'a str) -> IResult<&'a str, (), E>
|
|
73
77
|
where
|
|
74
78
|
E: ParseError<&'a str>,
|
package/src/ast/tree_ruleset.rs
CHANGED
|
@@ -28,7 +28,7 @@ use crate::transform::TransformCss;
|
|
|
28
28
|
/// A tree node which expresses a recursive `T` over `Ruleset<T>`. Using this
|
|
29
29
|
/// struct in place of `Rule` allows nested CSS selectors that can be later
|
|
30
30
|
/// flattened.
|
|
31
|
-
#[derive(Clone, Debug)]
|
|
31
|
+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
32
32
|
pub enum TreeRule<'a> {
|
|
33
33
|
Rule(Rule<'a>),
|
|
34
34
|
Ruleset(TreeRuleset<'a>),
|
package/src/ast.rs
CHANGED
|
@@ -41,7 +41,7 @@ use crate::transformers;
|
|
|
41
41
|
/// A non-nested "flat" CSS representation, suitable for browser output. The
|
|
42
42
|
/// [`Css`] AST is typically generated via the
|
|
43
43
|
/// [`crate::ast::Tree::flatten_tree`] method.
|
|
44
|
-
#[derive(Clone, Debug)]
|
|
44
|
+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
45
45
|
pub struct Css<'a>(pub Vec<FlatRuleset<'a>>);
|
|
46
46
|
|
|
47
47
|
impl<'a> Css<'a> {
|
|
@@ -67,7 +67,7 @@ impl<'a> Css<'a> {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/// Iterate over the immediate children of this Tree (non-recursive).
|
|
70
|
-
pub fn iter(&self) -> impl
|
|
70
|
+
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &'_ FlatRuleset<'a>> {
|
|
71
71
|
self.0.iter()
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -97,7 +97,7 @@ impl<'a> RenderCss for Css<'a> {
|
|
|
97
97
|
/// [`RenderCss`] if this is needed, though this output can't be read by
|
|
98
98
|
/// browsers and is not identical to the input since whitespace has been
|
|
99
99
|
/// discarded.
|
|
100
|
-
#[derive(Clone, Debug)]
|
|
100
|
+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
|
101
101
|
pub struct Tree<'a>(pub Vec<TreeRuleset<'a>>);
|
|
102
102
|
|
|
103
103
|
impl<'a> Tree<'a> {
|
package/src/builder.rs
CHANGED
|
@@ -81,8 +81,9 @@ impl<'a> BuildCss<'a> {
|
|
|
81
81
|
self.trees.insert(path, tree);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
for path in self.paths.iter() {
|
|
85
|
+
let dep_trees = self.trees.clone();
|
|
86
|
+
let tree = self.trees.get_mut(path.as_path()).unwrap();
|
|
86
87
|
transformers::apply_import(&dep_trees)(tree);
|
|
87
88
|
transformers::apply_mixin(tree);
|
|
88
89
|
transformers::apply_var(tree);
|
|
@@ -92,7 +93,10 @@ impl<'a> BuildCss<'a> {
|
|
|
92
93
|
for (path, css) in self.css.iter_mut() {
|
|
93
94
|
let srcdir = utils::join_paths(&self.rootdir, path);
|
|
94
95
|
transformers::inline_url(&srcdir.to_string_lossy())(css);
|
|
95
|
-
transformers::
|
|
96
|
+
transformers::merge_siblings(css);
|
|
97
|
+
transformers::remove_mixin(css);
|
|
98
|
+
transformers::remove_var(css);
|
|
99
|
+
transformers::deduplicate(css);
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
Ok(CompiledCss(self))
|
package/src/lib.rs
CHANGED
|
@@ -58,8 +58,10 @@
|
|
|
58
58
|
//!
|
|
59
59
|
//! let mut ast = procss::parse(test).unwrap();
|
|
60
60
|
//! transformers::apply_mixin(&mut ast);
|
|
61
|
-
//! let flat = ast.flatten_tree()
|
|
62
|
-
//!
|
|
61
|
+
//! let mut flat = ast.flatten_tree();
|
|
62
|
+
//! transformers::remove_mixin(&mut flat);
|
|
63
|
+
//! let css = flat.as_css_string();
|
|
64
|
+
//! assert_eq!(css, "div{color:red;}");
|
|
63
65
|
//! ```
|
|
64
66
|
//!
|
|
65
67
|
//! For coordinating large builds on a tree of CSS files, the [`BuildCss`]
|
package/src/main.rs
CHANGED
|
@@ -20,7 +20,7 @@ use crate::ast::*;
|
|
|
20
20
|
/// # Example
|
|
21
21
|
///
|
|
22
22
|
/// ```
|
|
23
|
-
/// # use procss::{parse, transformers::apply_mixin, RenderCss};
|
|
23
|
+
/// # use procss::{parse, transformers::apply_mixin, transformers::remove_mixin, RenderCss};
|
|
24
24
|
/// let css = "
|
|
25
25
|
/// @mixin test {
|
|
26
26
|
/// opacity: 0;
|
|
@@ -32,21 +32,21 @@ use crate::ast::*;
|
|
|
32
32
|
/// ";
|
|
33
33
|
/// let mut tree = parse(css).unwrap();
|
|
34
34
|
/// apply_mixin(&mut tree);
|
|
35
|
-
/// let
|
|
35
|
+
/// let mut flat = tree.flatten_tree();
|
|
36
|
+
/// remove_mixin(&mut flat);
|
|
37
|
+
/// let css = flat.as_css_string();
|
|
36
38
|
/// assert_eq!(css, "div.open{color:red;}div.open{opacity:0;}");
|
|
37
39
|
/// ```
|
|
38
40
|
pub fn apply_mixin<'a>(tree: &mut Tree<'a>) {
|
|
39
41
|
let mut mixins: HashMap<&'a str, Vec<TreeRule<'a>>> = HashMap::new();
|
|
40
42
|
tree.transform(|ruleset| {
|
|
41
|
-
if let Ruleset::QualRuleset(crate::ast::QualRuleset(QualRule(name, Some(val)), props)) =
|
|
42
|
-
|
|
43
|
+
if let Ruleset::QualRuleset(crate::ast::QualRuleset(QualRule(name, Some(val)), props)) =
|
|
44
|
+
ruleset
|
|
45
|
+
{
|
|
46
|
+
if *name == "mixin" {
|
|
43
47
|
mixins.insert(val.trim(), props.clone());
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
|
-
|
|
47
|
-
if matches!(ruleset, Ruleset::QualRuleset(QualRuleset(QualRule(name, _), _)) if *name == "mixin") {
|
|
48
|
-
*ruleset = Ruleset::SelectorRuleset(SelectorRuleset(Selector::default(), vec![]))
|
|
49
|
-
}
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
let mut count = 5;
|
|
@@ -17,17 +17,11 @@ use crate::ast::*;
|
|
|
17
17
|
pub fn apply_var<'a>(tree: &mut Tree<'a>) {
|
|
18
18
|
let mut mixins: HashMap<&'a str, &'a str> = HashMap::new();
|
|
19
19
|
tree.transform(|ruleset| {
|
|
20
|
-
let mut is_mixin = false;
|
|
21
20
|
if let Ruleset::QualRule(QualRule(name, Some(val))) = ruleset {
|
|
22
21
|
if let Some(val) = val.strip_prefix(':') {
|
|
23
22
|
mixins.insert(name, val);
|
|
24
|
-
is_mixin = true;
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
|
-
|
|
28
|
-
if is_mixin {
|
|
29
|
-
*ruleset = Ruleset::QualRuleset(QualRuleset(QualRule("", None), vec![]))
|
|
30
|
-
}
|
|
31
25
|
});
|
|
32
26
|
|
|
33
27
|
let mut mixins = mixins.iter().collect::<Vec<_>>();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// ┌───────────────────────────────────────────────────────────────────────────┐
|
|
2
|
+
// │ │
|
|
3
|
+
// │ ██████╗ ██████╗ ██████╗ Copyright (C) 2022, The Prospective Company │
|
|
4
|
+
// │ ██╔══██╗██╔══██╗██╔═══██╗ │
|
|
5
|
+
// │ ██████╔╝██████╔╝██║ ██║ This file is part of the Procss library, │
|
|
6
|
+
// │ ██╔═══╝ ██╔══██╗██║ ██║ distributed under the terms of the │
|
|
7
|
+
// │ ██║ ██║ ██║╚██████╔╝ Apache License 2.0. The full license can │
|
|
8
|
+
// │ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ be found in the LICENSE file. │
|
|
9
|
+
// │ │
|
|
10
|
+
// └───────────────────────────────────────────────────────────────────────────┘
|
|
11
|
+
|
|
12
|
+
use std::collections::HashSet;
|
|
13
|
+
|
|
14
|
+
use crate::ast::Ruleset::{self};
|
|
15
|
+
use crate::ast::*;
|
|
16
|
+
|
|
17
|
+
pub fn deduplicate(css: &mut Css) {
|
|
18
|
+
let mut seen: HashSet<&Ruleset<'_, Rule<'_>>> = HashSet::default();
|
|
19
|
+
let res = css
|
|
20
|
+
.iter()
|
|
21
|
+
.rev()
|
|
22
|
+
.filter(|x| seen.insert(*x))
|
|
23
|
+
.rev()
|
|
24
|
+
.cloned()
|
|
25
|
+
.collect();
|
|
26
|
+
*css = crate::ast::Css(res);
|
|
27
|
+
}
|
|
@@ -14,14 +14,12 @@ use crate::ast::*;
|
|
|
14
14
|
|
|
15
15
|
pub fn filter_refs(tree: &mut Tree) {
|
|
16
16
|
*tree = Tree(
|
|
17
|
-
tree.iter()
|
|
18
|
-
.cloned()
|
|
19
|
-
.filter(|y| match y {
|
|
17
|
+
tree.iter().filter(|&y| match y {
|
|
20
18
|
Ruleset::SelectorRuleset(_) => false,
|
|
21
19
|
Ruleset::QualRule(_) => true,
|
|
22
20
|
Ruleset::QualRuleset(_) => true,
|
|
23
21
|
Ruleset::QualNestedRuleset(_) => true,
|
|
24
|
-
})
|
|
22
|
+
}).cloned()
|
|
25
23
|
.collect(),
|
|
26
24
|
)
|
|
27
25
|
}
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
// │ │
|
|
10
10
|
// └───────────────────────────────────────────────────────────────────────────┘
|
|
11
11
|
|
|
12
|
+
use std::collections::HashSet;
|
|
13
|
+
|
|
12
14
|
use crate::ast::Ruleset::{self};
|
|
13
15
|
use crate::ast::*;
|
|
14
16
|
|
|
15
|
-
pub fn
|
|
17
|
+
pub fn merge_siblings(css: &mut Css) {
|
|
16
18
|
let mut res = vec![];
|
|
17
19
|
let reduced = css.iter().cloned().reduce(|x, y| match (x, y) {
|
|
18
20
|
(Ruleset::QualRule(x), Ruleset::QualRule(y)) if x == y => Ruleset::QualRule(x),
|
|
@@ -31,5 +33,7 @@ pub fn dedupe(css: &mut Css) {
|
|
|
31
33
|
res.push(reduced.clone());
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
let mut seen: HashSet<&Ruleset<'_, Rule<'_>>> = HashSet::default();
|
|
37
|
+
let res = res.iter().filter(|x| seen.insert(*x)).cloned().collect();
|
|
34
38
|
*css = crate::ast::Css(res)
|
|
35
39
|
}
|
package/src/transformers/mod.rs
CHANGED
|
@@ -29,15 +29,21 @@
|
|
|
29
29
|
mod apply_import;
|
|
30
30
|
mod apply_mixin;
|
|
31
31
|
mod apply_var;
|
|
32
|
-
mod
|
|
32
|
+
mod deduplicate;
|
|
33
33
|
mod filter_refs;
|
|
34
34
|
mod flat_self;
|
|
35
35
|
mod inline_url;
|
|
36
|
+
mod merge_siblings;
|
|
37
|
+
mod remove_mixin;
|
|
38
|
+
mod remove_var;
|
|
36
39
|
|
|
37
40
|
pub use self::apply_import::apply_import;
|
|
38
41
|
pub use self::apply_mixin::apply_mixin;
|
|
39
42
|
pub use self::apply_var::apply_var;
|
|
40
|
-
pub use self::
|
|
43
|
+
pub use self::deduplicate::deduplicate;
|
|
41
44
|
pub use self::filter_refs::filter_refs;
|
|
42
45
|
pub(crate) use self::flat_self::flat_self;
|
|
43
46
|
pub use self::inline_url::inline_url;
|
|
47
|
+
pub use self::merge_siblings::merge_siblings;
|
|
48
|
+
pub use self::remove_mixin::remove_mixin;
|
|
49
|
+
pub use self::remove_var::remove_var;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// ┌───────────────────────────────────────────────────────────────────────────┐
|
|
2
|
+
// │ │
|
|
3
|
+
// │ ██████╗ ██████╗ ██████╗ Copyright (C) 2022, The Prospective Company │
|
|
4
|
+
// │ ██╔══██╗██╔══██╗██╔═══██╗ │
|
|
5
|
+
// │ ██████╔╝██████╔╝██║ ██║ This file is part of the Procss library, │
|
|
6
|
+
// │ ██╔═══╝ ██╔══██╗██║ ██║ distributed under the terms of the │
|
|
7
|
+
// │ ██║ ██║ ██║╚██████╔╝ Apache License 2.0. The full license can │
|
|
8
|
+
// │ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ be found in the LICENSE file. │
|
|
9
|
+
// │ │
|
|
10
|
+
// └───────────────────────────────────────────────────────────────────────────┘
|
|
11
|
+
|
|
12
|
+
use crate::ast::Ruleset::{self};
|
|
13
|
+
use crate::ast::*;
|
|
14
|
+
|
|
15
|
+
pub fn remove_mixin(css: &mut Css) {
|
|
16
|
+
let reduced = css
|
|
17
|
+
.iter()
|
|
18
|
+
.filter(|&x| {
|
|
19
|
+
!matches!(
|
|
20
|
+
x,
|
|
21
|
+
Ruleset::QualRule(QualRule("mixin", _))
|
|
22
|
+
| Ruleset::QualNestedRuleset(QualNestedRuleset(QualRule("mixin", _), _))
|
|
23
|
+
| Ruleset::QualRuleset(QualRuleset(QualRule("mixin", _), _))
|
|
24
|
+
)
|
|
25
|
+
})
|
|
26
|
+
.cloned();
|
|
27
|
+
|
|
28
|
+
*css = crate::ast::Css(reduced.collect())
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// ┌───────────────────────────────────────────────────────────────────────────┐
|
|
2
|
+
// │ │
|
|
3
|
+
// │ ██████╗ ██████╗ ██████╗ Copyright (C) 2022, The Prospective Company │
|
|
4
|
+
// │ ██╔══██╗██╔══██╗██╔═══██╗ │
|
|
5
|
+
// │ ██████╔╝██████╔╝██║ ██║ This file is part of the Procss library, │
|
|
6
|
+
// │ ██╔═══╝ ██╔══██╗██║ ██║ distributed under the terms of the │
|
|
7
|
+
// │ ██║ ██║ ██║╚██████╔╝ Apache License 2.0. The full license can │
|
|
8
|
+
// │ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ be found in the LICENSE file. │
|
|
9
|
+
// │ │
|
|
10
|
+
// └───────────────────────────────────────────────────────────────────────────┘
|
|
11
|
+
|
|
12
|
+
use crate::ast::Ruleset::{self};
|
|
13
|
+
use crate::ast::*;
|
|
14
|
+
|
|
15
|
+
pub fn remove_var(css: &mut Css) {
|
|
16
|
+
let reduced = css
|
|
17
|
+
.iter()
|
|
18
|
+
.filter(|&ruleset| match ruleset {
|
|
19
|
+
Ruleset::QualRule(QualRule(name, Some(val))) if val.strip_prefix(':').is_some() => {
|
|
20
|
+
false
|
|
21
|
+
}
|
|
22
|
+
_ => true,
|
|
23
|
+
})
|
|
24
|
+
.cloned();
|
|
25
|
+
|
|
26
|
+
*css = crate::ast::Css(reduced.collect())
|
|
27
|
+
}
|
package/target/cjs/procss.js
CHANGED
|
@@ -4,43 +4,30 @@ let wasm;
|
|
|
4
4
|
const { readFileSync } = require(`fs`);
|
|
5
5
|
const { TextDecoder, TextEncoder } = require(`util`);
|
|
6
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
|
-
|
|
27
7
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
28
8
|
|
|
29
9
|
cachedTextDecoder.decode();
|
|
30
10
|
|
|
31
|
-
let cachedUint8Memory0 =
|
|
11
|
+
let cachedUint8Memory0 = null;
|
|
32
12
|
|
|
33
13
|
function getUint8Memory0() {
|
|
34
|
-
if (cachedUint8Memory0.byteLength === 0) {
|
|
14
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
35
15
|
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
36
16
|
}
|
|
37
17
|
return cachedUint8Memory0;
|
|
38
18
|
}
|
|
39
19
|
|
|
40
20
|
function getStringFromWasm0(ptr, len) {
|
|
21
|
+
ptr = ptr >>> 0;
|
|
41
22
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
42
23
|
}
|
|
43
24
|
|
|
25
|
+
const heap = new Array(128).fill(undefined);
|
|
26
|
+
|
|
27
|
+
heap.push(undefined, null, true, false);
|
|
28
|
+
|
|
29
|
+
let heap_next = heap.length;
|
|
30
|
+
|
|
44
31
|
function addHeapObject(obj) {
|
|
45
32
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
46
33
|
const idx = heap_next;
|
|
@@ -50,6 +37,20 @@ function addHeapObject(obj) {
|
|
|
50
37
|
return idx;
|
|
51
38
|
}
|
|
52
39
|
|
|
40
|
+
function getObject(idx) { return heap[idx]; }
|
|
41
|
+
|
|
42
|
+
function dropObject(idx) {
|
|
43
|
+
if (idx < 132) return;
|
|
44
|
+
heap[idx] = heap_next;
|
|
45
|
+
heap_next = idx;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function takeObject(idx) {
|
|
49
|
+
const ret = getObject(idx);
|
|
50
|
+
dropObject(idx);
|
|
51
|
+
return ret;
|
|
52
|
+
}
|
|
53
|
+
|
|
53
54
|
let WASM_VECTOR_LEN = 0;
|
|
54
55
|
|
|
55
56
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -71,14 +72,14 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
71
72
|
|
|
72
73
|
if (realloc === undefined) {
|
|
73
74
|
const buf = cachedTextEncoder.encode(arg);
|
|
74
|
-
const ptr = malloc(buf.length);
|
|
75
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
75
76
|
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
76
77
|
WASM_VECTOR_LEN = buf.length;
|
|
77
78
|
return ptr;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
let len = arg.length;
|
|
81
|
-
let ptr = malloc(len);
|
|
82
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
82
83
|
|
|
83
84
|
const mem = getUint8Memory0();
|
|
84
85
|
|
|
@@ -94,7 +95,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
94
95
|
if (offset !== 0) {
|
|
95
96
|
arg = arg.slice(offset);
|
|
96
97
|
}
|
|
97
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
98
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
98
99
|
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
99
100
|
const ret = encodeString(arg, view);
|
|
100
101
|
|
|
@@ -105,17 +106,17 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
105
106
|
return ptr;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
let cachedInt32Memory0 =
|
|
109
|
+
let cachedInt32Memory0 = null;
|
|
109
110
|
|
|
110
111
|
function getInt32Memory0() {
|
|
111
|
-
if (cachedInt32Memory0.byteLength === 0) {
|
|
112
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
112
113
|
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
113
114
|
}
|
|
114
115
|
return cachedInt32Memory0;
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
function passArray8ToWasm0(arg, malloc) {
|
|
118
|
-
const ptr = malloc(arg.length * 1);
|
|
119
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
119
120
|
getUint8Memory0().set(arg, ptr / 1);
|
|
120
121
|
WASM_VECTOR_LEN = arg.length;
|
|
121
122
|
return ptr;
|
|
@@ -134,16 +135,9 @@ function handleError(f, args) {
|
|
|
134
135
|
*/
|
|
135
136
|
class BuildCss {
|
|
136
137
|
|
|
137
|
-
static __wrap(ptr) {
|
|
138
|
-
const obj = Object.create(BuildCss.prototype);
|
|
139
|
-
obj.ptr = ptr;
|
|
140
|
-
|
|
141
|
-
return obj;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
138
|
__destroy_into_raw() {
|
|
145
|
-
const ptr = this.
|
|
146
|
-
this.
|
|
139
|
+
const ptr = this.__wbg_ptr;
|
|
140
|
+
this.__wbg_ptr = 0;
|
|
147
141
|
|
|
148
142
|
return ptr;
|
|
149
143
|
}
|
|
@@ -159,7 +153,8 @@ class BuildCss {
|
|
|
159
153
|
const ptr0 = passStringToWasm0(rootdir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
160
154
|
const len0 = WASM_VECTOR_LEN;
|
|
161
155
|
const ret = wasm.buildcss_new(ptr0, len0);
|
|
162
|
-
|
|
156
|
+
this.__wbg_ptr = ret >>> 0;
|
|
157
|
+
return this;
|
|
163
158
|
}
|
|
164
159
|
/**
|
|
165
160
|
* @param {string} path
|
|
@@ -170,7 +165,7 @@ class BuildCss {
|
|
|
170
165
|
const len0 = WASM_VECTOR_LEN;
|
|
171
166
|
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
172
167
|
const len1 = WASM_VECTOR_LEN;
|
|
173
|
-
wasm.buildcss_add(this.
|
|
168
|
+
wasm.buildcss_add(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
174
169
|
}
|
|
175
170
|
/**
|
|
176
171
|
* @returns {any}
|
|
@@ -178,7 +173,7 @@ class BuildCss {
|
|
|
178
173
|
compile() {
|
|
179
174
|
try {
|
|
180
175
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
181
|
-
wasm.buildcss_compile(retptr, this.
|
|
176
|
+
wasm.buildcss_compile(retptr, this.__wbg_ptr);
|
|
182
177
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
183
178
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
184
179
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -193,42 +188,89 @@ class BuildCss {
|
|
|
193
188
|
}
|
|
194
189
|
module.exports.BuildCss = BuildCss;
|
|
195
190
|
|
|
196
|
-
module.exports.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
191
|
+
module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
192
|
+
let deferred0_0;
|
|
193
|
+
let deferred0_1;
|
|
194
|
+
try {
|
|
195
|
+
deferred0_0 = arg0;
|
|
196
|
+
deferred0_1 = arg1;
|
|
197
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
198
|
+
} finally {
|
|
199
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
204
|
+
const ret = new Error();
|
|
205
|
+
return addHeapObject(ret);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
209
|
+
const ret = getObject(arg1).stack;
|
|
210
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
211
|
+
const len1 = WASM_VECTOR_LEN;
|
|
212
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
213
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
217
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
218
|
+
return addHeapObject(ret);
|
|
219
|
+
};
|
|
203
220
|
|
|
204
221
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
205
222
|
takeObject(arg0);
|
|
206
223
|
};
|
|
207
224
|
|
|
208
|
-
module.exports.
|
|
209
|
-
|
|
210
|
-
return addHeapObject(ret);
|
|
225
|
+
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
226
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
211
227
|
};
|
|
212
228
|
|
|
213
|
-
module.exports.
|
|
229
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
230
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
231
|
+
return ret;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
module.exports.__wbg_new_1b94180eeb48f2a2 = function() {
|
|
214
235
|
const ret = new Map();
|
|
215
236
|
return addHeapObject(ret);
|
|
216
237
|
};
|
|
217
238
|
|
|
218
|
-
module.exports.
|
|
219
|
-
const ret =
|
|
239
|
+
module.exports.__wbg_set_3355b9f2d3092e3b = function(arg0, arg1, arg2) {
|
|
240
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
220
241
|
return addHeapObject(ret);
|
|
221
242
|
};
|
|
222
243
|
|
|
223
|
-
module.exports.
|
|
224
|
-
const ret =
|
|
244
|
+
module.exports.__wbg_new_c728d68b8b34487e = function() {
|
|
245
|
+
const ret = new Object();
|
|
225
246
|
return addHeapObject(ret);
|
|
226
247
|
};
|
|
227
248
|
|
|
228
|
-
module.exports.
|
|
229
|
-
|
|
249
|
+
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
250
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
251
|
+
return addHeapObject(ret);
|
|
230
252
|
};
|
|
231
253
|
|
|
254
|
+
module.exports.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
|
|
255
|
+
const ret = String(getObject(arg1));
|
|
256
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
257
|
+
const len1 = WASM_VECTOR_LEN;
|
|
258
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
259
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
module.exports.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
|
263
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
module.exports.__wbg_readFileSync_8fc702e6693b9168 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
267
|
+
const ret = readFileSync(getStringFromWasm0(arg1, arg2));
|
|
268
|
+
const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
|
|
269
|
+
const len1 = WASM_VECTOR_LEN;
|
|
270
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
271
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
272
|
+
}, arguments) };
|
|
273
|
+
|
|
232
274
|
const path = require('path').join(__dirname, 'procss_bg.wasm');
|
|
233
275
|
const bytes = require('fs').readFileSync(path);
|
|
234
276
|
|
|
Binary file
|
|
@@ -6,8 +6,9 @@ export function __wbg_buildcss_free(a: number): void;
|
|
|
6
6
|
export function buildcss_new(a: number, b: number): number;
|
|
7
7
|
export function buildcss_add(a: number, b: number, c: number, d: number, e: number): void;
|
|
8
8
|
export function buildcss_compile(a: number, b: number): void;
|
|
9
|
-
export function
|
|
10
|
-
export function
|
|
9
|
+
export function __wbindgen_free(a: number, b: number, c: number): void;
|
|
10
|
+
export function __wbindgen_malloc(a: number, b: number): number;
|
|
11
|
+
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
|
|
11
12
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
12
13
|
export function __wbindgen_exn_store(a: number): void;
|
|
13
14
|
export function __wbindgen_start(): void;
|
package/target/esm/procss.d.ts
CHANGED
|
@@ -30,8 +30,9 @@ export interface InitOutput {
|
|
|
30
30
|
readonly buildcss_new: (a: number, b: number) => number;
|
|
31
31
|
readonly buildcss_add: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
32
32
|
readonly buildcss_compile: (a: number, b: number) => void;
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
33
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
34
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
35
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
35
36
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
36
37
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
37
38
|
readonly __wbindgen_start: () => void;
|
|
@@ -56,4 +57,4 @@ export function initSync(module: SyncInitInput): InitOutput;
|
|
|
56
57
|
*
|
|
57
58
|
* @returns {Promise<InitOutput>}
|
|
58
59
|
*/
|
|
59
|
-
export default function
|
|
60
|
+
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/target/esm/procss.js
CHANGED
|
@@ -2,43 +2,30 @@ import { readFileSync } from 'fs';
|
|
|
2
2
|
|
|
3
3
|
let wasm;
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
}
|
|
7
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
const ret = getObject(idx);
|
|
21
|
-
dropObject(idx);
|
|
22
|
-
return ret;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
26
|
-
|
|
27
|
-
cachedTextDecoder.decode();
|
|
28
|
-
|
|
29
|
-
let cachedUint8Memory0 = new Uint8Array();
|
|
9
|
+
let cachedUint8Memory0 = null;
|
|
30
10
|
|
|
31
11
|
function getUint8Memory0() {
|
|
32
|
-
if (cachedUint8Memory0.byteLength === 0) {
|
|
12
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
33
13
|
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
34
14
|
}
|
|
35
15
|
return cachedUint8Memory0;
|
|
36
16
|
}
|
|
37
17
|
|
|
38
18
|
function getStringFromWasm0(ptr, len) {
|
|
19
|
+
ptr = ptr >>> 0;
|
|
39
20
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
40
21
|
}
|
|
41
22
|
|
|
23
|
+
const heap = new Array(128).fill(undefined);
|
|
24
|
+
|
|
25
|
+
heap.push(undefined, null, true, false);
|
|
26
|
+
|
|
27
|
+
let heap_next = heap.length;
|
|
28
|
+
|
|
42
29
|
function addHeapObject(obj) {
|
|
43
30
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
44
31
|
const idx = heap_next;
|
|
@@ -48,9 +35,23 @@ function addHeapObject(obj) {
|
|
|
48
35
|
return idx;
|
|
49
36
|
}
|
|
50
37
|
|
|
38
|
+
function getObject(idx) { return heap[idx]; }
|
|
39
|
+
|
|
40
|
+
function dropObject(idx) {
|
|
41
|
+
if (idx < 132) 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
|
+
|
|
51
52
|
let WASM_VECTOR_LEN = 0;
|
|
52
53
|
|
|
53
|
-
const cachedTextEncoder = new TextEncoder('utf-8');
|
|
54
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
54
55
|
|
|
55
56
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
56
57
|
? function (arg, view) {
|
|
@@ -69,14 +70,14 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
69
70
|
|
|
70
71
|
if (realloc === undefined) {
|
|
71
72
|
const buf = cachedTextEncoder.encode(arg);
|
|
72
|
-
const ptr = malloc(buf.length);
|
|
73
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
73
74
|
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
74
75
|
WASM_VECTOR_LEN = buf.length;
|
|
75
76
|
return ptr;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
let len = arg.length;
|
|
79
|
-
let ptr = malloc(len);
|
|
80
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
80
81
|
|
|
81
82
|
const mem = getUint8Memory0();
|
|
82
83
|
|
|
@@ -92,7 +93,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
92
93
|
if (offset !== 0) {
|
|
93
94
|
arg = arg.slice(offset);
|
|
94
95
|
}
|
|
95
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
96
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
96
97
|
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
97
98
|
const ret = encodeString(arg, view);
|
|
98
99
|
|
|
@@ -103,17 +104,17 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
103
104
|
return ptr;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
let cachedInt32Memory0 =
|
|
107
|
+
let cachedInt32Memory0 = null;
|
|
107
108
|
|
|
108
109
|
function getInt32Memory0() {
|
|
109
|
-
if (cachedInt32Memory0.byteLength === 0) {
|
|
110
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
110
111
|
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
111
112
|
}
|
|
112
113
|
return cachedInt32Memory0;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
function passArray8ToWasm0(arg, malloc) {
|
|
116
|
-
const ptr = malloc(arg.length * 1);
|
|
117
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
117
118
|
getUint8Memory0().set(arg, ptr / 1);
|
|
118
119
|
WASM_VECTOR_LEN = arg.length;
|
|
119
120
|
return ptr;
|
|
@@ -132,16 +133,9 @@ function handleError(f, args) {
|
|
|
132
133
|
*/
|
|
133
134
|
export class BuildCss {
|
|
134
135
|
|
|
135
|
-
static __wrap(ptr) {
|
|
136
|
-
const obj = Object.create(BuildCss.prototype);
|
|
137
|
-
obj.ptr = ptr;
|
|
138
|
-
|
|
139
|
-
return obj;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
136
|
__destroy_into_raw() {
|
|
143
|
-
const ptr = this.
|
|
144
|
-
this.
|
|
137
|
+
const ptr = this.__wbg_ptr;
|
|
138
|
+
this.__wbg_ptr = 0;
|
|
145
139
|
|
|
146
140
|
return ptr;
|
|
147
141
|
}
|
|
@@ -157,7 +151,8 @@ export class BuildCss {
|
|
|
157
151
|
const ptr0 = passStringToWasm0(rootdir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
158
152
|
const len0 = WASM_VECTOR_LEN;
|
|
159
153
|
const ret = wasm.buildcss_new(ptr0, len0);
|
|
160
|
-
|
|
154
|
+
this.__wbg_ptr = ret >>> 0;
|
|
155
|
+
return this;
|
|
161
156
|
}
|
|
162
157
|
/**
|
|
163
158
|
* @param {string} path
|
|
@@ -168,7 +163,7 @@ export class BuildCss {
|
|
|
168
163
|
const len0 = WASM_VECTOR_LEN;
|
|
169
164
|
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
170
165
|
const len1 = WASM_VECTOR_LEN;
|
|
171
|
-
wasm.buildcss_add(this.
|
|
166
|
+
wasm.buildcss_add(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
172
167
|
}
|
|
173
168
|
/**
|
|
174
169
|
* @returns {any}
|
|
@@ -176,7 +171,7 @@ export class BuildCss {
|
|
|
176
171
|
compile() {
|
|
177
172
|
try {
|
|
178
173
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
179
|
-
wasm.buildcss_compile(retptr, this.
|
|
174
|
+
wasm.buildcss_compile(retptr, this.__wbg_ptr);
|
|
180
175
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
181
176
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
182
177
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -190,7 +185,7 @@ export class BuildCss {
|
|
|
190
185
|
}
|
|
191
186
|
}
|
|
192
187
|
|
|
193
|
-
async function
|
|
188
|
+
async function __wbg_load(module, imports) {
|
|
194
189
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
195
190
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
196
191
|
try {
|
|
@@ -221,60 +216,102 @@ async function load(module, imports) {
|
|
|
221
216
|
}
|
|
222
217
|
}
|
|
223
218
|
|
|
224
|
-
function
|
|
219
|
+
function __wbg_get_imports() {
|
|
225
220
|
const imports = {};
|
|
226
221
|
imports.wbg = {};
|
|
227
|
-
imports.wbg.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
222
|
+
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
223
|
+
let deferred0_0;
|
|
224
|
+
let deferred0_1;
|
|
225
|
+
try {
|
|
226
|
+
deferred0_0 = arg0;
|
|
227
|
+
deferred0_1 = arg1;
|
|
228
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
229
|
+
} finally {
|
|
230
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
231
|
+
}
|
|
236
232
|
};
|
|
237
|
-
imports.wbg.
|
|
238
|
-
const ret = new Error(
|
|
233
|
+
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
234
|
+
const ret = new Error();
|
|
239
235
|
return addHeapObject(ret);
|
|
240
236
|
};
|
|
241
|
-
imports.wbg.
|
|
242
|
-
const ret =
|
|
243
|
-
|
|
237
|
+
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
238
|
+
const ret = getObject(arg1).stack;
|
|
239
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
240
|
+
const len1 = WASM_VECTOR_LEN;
|
|
241
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
242
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
244
243
|
};
|
|
245
244
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
246
245
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
247
246
|
return addHeapObject(ret);
|
|
248
247
|
};
|
|
249
|
-
imports.wbg.
|
|
250
|
-
|
|
251
|
-
return addHeapObject(ret);
|
|
248
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
249
|
+
takeObject(arg0);
|
|
252
250
|
};
|
|
253
251
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
254
252
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
255
253
|
};
|
|
254
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
255
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
256
|
+
return ret;
|
|
257
|
+
};
|
|
258
|
+
imports.wbg.__wbg_new_1b94180eeb48f2a2 = function() {
|
|
259
|
+
const ret = new Map();
|
|
260
|
+
return addHeapObject(ret);
|
|
261
|
+
};
|
|
262
|
+
imports.wbg.__wbg_set_3355b9f2d3092e3b = function(arg0, arg1, arg2) {
|
|
263
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
264
|
+
return addHeapObject(ret);
|
|
265
|
+
};
|
|
266
|
+
imports.wbg.__wbg_new_c728d68b8b34487e = function() {
|
|
267
|
+
const ret = new Object();
|
|
268
|
+
return addHeapObject(ret);
|
|
269
|
+
};
|
|
270
|
+
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
271
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
272
|
+
return addHeapObject(ret);
|
|
273
|
+
};
|
|
274
|
+
imports.wbg.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
|
|
275
|
+
const ret = String(getObject(arg1));
|
|
276
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
277
|
+
const len1 = WASM_VECTOR_LEN;
|
|
278
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
279
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
280
|
+
};
|
|
281
|
+
imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
|
|
282
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
283
|
+
};
|
|
284
|
+
imports.wbg.__wbg_readFileSync_8fc702e6693b9168 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
285
|
+
const ret = readFileSync(getStringFromWasm0(arg1, arg2));
|
|
286
|
+
const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
|
|
287
|
+
const len1 = WASM_VECTOR_LEN;
|
|
288
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
289
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
290
|
+
}, arguments) };
|
|
256
291
|
|
|
257
292
|
return imports;
|
|
258
293
|
}
|
|
259
294
|
|
|
260
|
-
function
|
|
295
|
+
function __wbg_init_memory(imports, maybe_memory) {
|
|
261
296
|
|
|
262
297
|
}
|
|
263
298
|
|
|
264
|
-
function
|
|
299
|
+
function __wbg_finalize_init(instance, module) {
|
|
265
300
|
wasm = instance.exports;
|
|
266
|
-
|
|
267
|
-
cachedInt32Memory0 =
|
|
268
|
-
cachedUint8Memory0 =
|
|
301
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
302
|
+
cachedInt32Memory0 = null;
|
|
303
|
+
cachedUint8Memory0 = null;
|
|
269
304
|
|
|
270
305
|
wasm.__wbindgen_start();
|
|
271
306
|
return wasm;
|
|
272
307
|
}
|
|
273
308
|
|
|
274
309
|
function initSync(module) {
|
|
275
|
-
|
|
310
|
+
if (wasm !== undefined) return wasm;
|
|
276
311
|
|
|
277
|
-
|
|
312
|
+
const imports = __wbg_get_imports();
|
|
313
|
+
|
|
314
|
+
__wbg_init_memory(imports);
|
|
278
315
|
|
|
279
316
|
if (!(module instanceof WebAssembly.Module)) {
|
|
280
317
|
module = new WebAssembly.Module(module);
|
|
@@ -282,25 +319,27 @@ function initSync(module) {
|
|
|
282
319
|
|
|
283
320
|
const instance = new WebAssembly.Instance(module, imports);
|
|
284
321
|
|
|
285
|
-
return
|
|
322
|
+
return __wbg_finalize_init(instance, module);
|
|
286
323
|
}
|
|
287
324
|
|
|
288
|
-
async function
|
|
325
|
+
async function __wbg_init(input) {
|
|
326
|
+
if (wasm !== undefined) return wasm;
|
|
327
|
+
|
|
289
328
|
if (typeof input === 'undefined') {
|
|
290
329
|
input = new URL('procss_bg.wasm', import.meta.url);
|
|
291
330
|
}
|
|
292
|
-
const imports =
|
|
331
|
+
const imports = __wbg_get_imports();
|
|
293
332
|
|
|
294
333
|
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
295
334
|
input = fetch(input);
|
|
296
335
|
}
|
|
297
336
|
|
|
298
|
-
|
|
337
|
+
__wbg_init_memory(imports);
|
|
299
338
|
|
|
300
|
-
const { instance, module } = await
|
|
339
|
+
const { instance, module } = await __wbg_load(await input, imports);
|
|
301
340
|
|
|
302
|
-
return
|
|
341
|
+
return __wbg_finalize_init(instance, module);
|
|
303
342
|
}
|
|
304
343
|
|
|
305
344
|
export { initSync }
|
|
306
|
-
export default
|
|
345
|
+
export default __wbg_init;
|
|
Binary file
|
|
@@ -6,8 +6,9 @@ export function __wbg_buildcss_free(a: number): void;
|
|
|
6
6
|
export function buildcss_new(a: number, b: number): number;
|
|
7
7
|
export function buildcss_add(a: number, b: number, c: number, d: number, e: number): void;
|
|
8
8
|
export function buildcss_compile(a: number, b: number): void;
|
|
9
|
-
export function
|
|
10
|
-
export function
|
|
9
|
+
export function __wbindgen_free(a: number, b: number, c: number): void;
|
|
10
|
+
export function __wbindgen_malloc(a: number, b: number): number;
|
|
11
|
+
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
|
|
11
12
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
12
13
|
export function __wbindgen_exn_store(a: number): void;
|
|
13
14
|
export function __wbindgen_start(): void;
|