Updating examples to use Rollup
This commit is contained in:
parent
833a3c4ec0
commit
5083e7bdea
11
Cargo.toml
11
Cargo.toml
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "dominator"
|
name = "dominator"
|
||||||
version = "0.5.7"
|
version = "0.5.7"
|
||||||
authors = ["Pauan <pcxunlimited@gmail.com>"]
|
authors = ["Pauan <pauanyu+github@pm.me>"]
|
||||||
description = "Zero cost declarative DOM library using FRP signals"
|
description = "Zero cost declarative DOM library using FRP signals"
|
||||||
repository = "https://github.com/Pauan/rust-dominator"
|
repository = "https://github.com/Pauan/rust-dominator"
|
||||||
homepage = "https://github.com/Pauan/rust-dominator"
|
homepage = "https://github.com/Pauan/rust-dominator"
|
||||||
|
@ -19,15 +19,12 @@ default = ["wasm-bindgen/enable-interning"]
|
||||||
lazy_static = "1.3.0"
|
lazy_static = "1.3.0"
|
||||||
discard = "1.0.3"
|
discard = "1.0.3"
|
||||||
pin-utils = "0.1.0-alpha.4"
|
pin-utils = "0.1.0-alpha.4"
|
||||||
futures-channel-preview = "0.3.0-alpha.16"
|
futures-channel = "0.3.0"
|
||||||
futures-util-preview = "0.3.0-alpha.16"
|
futures-util = "0.3.0"
|
||||||
futures-signals = "0.3.5"
|
futures-signals = "0.3.5"
|
||||||
wasm-bindgen = "0.2.48"
|
wasm-bindgen = "0.2.48"
|
||||||
js-sys = "0.3.22"
|
js-sys = "0.3.22"
|
||||||
|
wasm-bindgen-futures = "0.4.9"
|
||||||
[dependencies.wasm-bindgen-futures]
|
|
||||||
version = "0.3.22"
|
|
||||||
features = ["futures_0_3"]
|
|
||||||
|
|
||||||
[dependencies.web-sys]
|
[dependencies.web-sys]
|
||||||
version = "0.3.22"
|
version = "0.3.22"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist/js
|
||||||
/target
|
/target
|
||||||
/pkg
|
|
||||||
/wasm-pack.log
|
/wasm-pack.log
|
||||||
/yarn-error.log
|
/yarn-error.log
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "animation"
|
name = "animation"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Animation demo using dominator"
|
description = "Animation demo using dominator"
|
||||||
authors = ["Pauan <pcxunlimited@gmail.com>"]
|
authors = ["Pauan <pauanyu+github@pm.me>"]
|
||||||
categories = ["wasm"]
|
categories = ["wasm"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -15,16 +15,14 @@ lto = true
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dominator = { path = "../.." }
|
console_error_panic_hook = "0.1.5"
|
||||||
|
dominator = "0.5.0"
|
||||||
wasm-bindgen = "0.2.45"
|
wasm-bindgen = "0.2.45"
|
||||||
futures-signals = "0.3.0"
|
futures-signals = "0.3.0"
|
||||||
futures-preview = "0.3.0-alpha.16"
|
futures = "0.3.0"
|
||||||
|
|
||||||
[dependencies.web-sys]
|
[dependencies.web-sys]
|
||||||
version = "0.3.22"
|
version = "0.3.22"
|
||||||
features = [
|
features = [
|
||||||
"console",
|
"console",
|
||||||
]
|
]
|
||||||
|
|
||||||
[target."cfg(debug_assertions)".dependencies]
|
|
||||||
console_error_panic_hook = "0.1.5"
|
|
||||||
|
|
|
@ -4,14 +4,7 @@
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to run in debug mode
|
## How to build
|
||||||
|
|
||||||
```sh
|
|
||||||
# Builds the project and opens it in a new browser tab. Auto-reloads when the project changes.
|
|
||||||
yarn start
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to build in release mode
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Builds the project and places it into the `dist` folder.
|
# Builds the project and places it into the `dist` folder.
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
<title>rust-dominator • Animation</title>
|
<title>rust-dominator • Animation</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1 +0,0 @@
|
||||||
import("../pkg/index.js").catch(console.error);
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{
|
||||||
"author": "Pauan <pcxunlimited@gmail.com>",
|
"private": true,
|
||||||
|
"author": "Pauan <pauanyu+github@pm.me>",
|
||||||
"name": "animation",
|
"name": "animation",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rimraf dist pkg && webpack",
|
"build": "rimraf dist/js && rollup --config"
|
||||||
"start": "rimraf dist pkg && webpack-dev-server -d"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@wasm-tool/wasm-pack-plugin": "^0.4.2",
|
"@wasm-tool/rollup-plugin-rust": "^1.0.0",
|
||||||
"copy-webpack-plugin": "^5.0.3",
|
"rimraf": "^3.0.2",
|
||||||
"webpack": "^4.33.0",
|
"rollup": "^1.31.0"
|
||||||
"webpack-cli": "^3.3.3",
|
|
||||||
"webpack-dev-server": "^3.7.1",
|
|
||||||
"rimraf": "^2.6.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import rust from "@wasm-tool/rollup-plugin-rust";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: {
|
||||||
|
index: "./Cargo.toml",
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
dir: "dist/js",
|
||||||
|
format: "iife",
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
rust({
|
||||||
|
serverPath: "js/",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
|
@ -1,33 +0,0 @@
|
||||||
const path = require("path");
|
|
||||||
const CopyPlugin = require("copy-webpack-plugin");
|
|
||||||
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|
||||||
|
|
||||||
const dist = path.resolve(__dirname, "dist");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
mode: "production",
|
|
||||||
stats: "errors-warnings",
|
|
||||||
entry: {
|
|
||||||
index: "./js/index.js"
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
path: dist,
|
|
||||||
filename: "[name].js"
|
|
||||||
},
|
|
||||||
devServer: {
|
|
||||||
liveReload: true,
|
|
||||||
open: true,
|
|
||||||
noInfo: true,
|
|
||||||
overlay: true
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new CopyPlugin([
|
|
||||||
path.resolve(__dirname, "static")
|
|
||||||
]),
|
|
||||||
|
|
||||||
new WasmPackPlugin({
|
|
||||||
crateDirectory: __dirname,
|
|
||||||
extraArgs: "--out-name index"
|
|
||||||
})
|
|
||||||
]
|
|
||||||
};
|
|
|
@ -1,6 +1,5 @@
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist/js
|
||||||
/target
|
/target
|
||||||
/pkg
|
|
||||||
/wasm-pack.log
|
/wasm-pack.log
|
||||||
/yarn-error.log
|
/yarn-error.log
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "counter"
|
name = "counter"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Counter demo using dominator"
|
description = "Counter demo using dominator"
|
||||||
authors = ["Pauan <pcxunlimited@gmail.com>"]
|
authors = ["Pauan <pauanyu+github@pm.me>"]
|
||||||
categories = ["wasm"]
|
categories = ["wasm"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -15,10 +15,8 @@ lto = true
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dominator = { path = "../.." }
|
console_error_panic_hook = "0.1.5"
|
||||||
|
dominator = "0.5.0"
|
||||||
wasm-bindgen = "0.2.48"
|
wasm-bindgen = "0.2.48"
|
||||||
futures-signals = "0.3.0"
|
futures-signals = "0.3.0"
|
||||||
lazy_static = "1.0.0"
|
lazy_static = "1.0.0"
|
||||||
|
|
||||||
[target."cfg(debug_assertions)".dependencies]
|
|
||||||
console_error_panic_hook = "0.1.5"
|
|
||||||
|
|
|
@ -4,14 +4,7 @@
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to run in debug mode
|
## How to build
|
||||||
|
|
||||||
```sh
|
|
||||||
# Builds the project and opens it in a new browser tab. Auto-reloads when the project changes.
|
|
||||||
yarn start
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to build in release mode
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Builds the project and places it into the `dist` folder.
|
# Builds the project and places it into the `dist` folder.
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
<title>rust-dominator • Counter</title>
|
<title>rust-dominator • Counter</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1 +0,0 @@
|
||||||
import("../pkg/index.js").catch(console.error);
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{
|
||||||
"author": "Pauan <pcxunlimited@gmail.com>",
|
"private": true,
|
||||||
|
"author": "Pauan <pauanyu+github@pm.me>",
|
||||||
"name": "counter",
|
"name": "counter",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rimraf dist pkg && webpack",
|
"build": "rimraf dist/js && rollup --config"
|
||||||
"start": "rimraf dist pkg && webpack-dev-server -d"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@wasm-tool/wasm-pack-plugin": "^0.4.2",
|
"@wasm-tool/rollup-plugin-rust": "^1.0.0",
|
||||||
"copy-webpack-plugin": "^5.0.3",
|
"rimraf": "^3.0.2",
|
||||||
"rimraf": "^2.6.3",
|
"rollup": "^1.31.0"
|
||||||
"webpack": "^4.33.0",
|
|
||||||
"webpack-cli": "^3.3.3",
|
|
||||||
"webpack-dev-server": "^3.7.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import rust from "@wasm-tool/rollup-plugin-rust";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: {
|
||||||
|
index: "./Cargo.toml",
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
dir: "dist/js",
|
||||||
|
format: "iife",
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
rust({
|
||||||
|
serverPath: "js/",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
|
@ -1,33 +0,0 @@
|
||||||
const path = require("path");
|
|
||||||
const CopyPlugin = require("copy-webpack-plugin");
|
|
||||||
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|
||||||
|
|
||||||
const dist = path.resolve(__dirname, "dist");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
mode: "production",
|
|
||||||
stats: "errors-warnings",
|
|
||||||
entry: {
|
|
||||||
index: "./js/index.js"
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
path: dist,
|
|
||||||
filename: "[name].js"
|
|
||||||
},
|
|
||||||
devServer: {
|
|
||||||
liveReload: true,
|
|
||||||
open: true,
|
|
||||||
noInfo: true,
|
|
||||||
overlay: true
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new CopyPlugin([
|
|
||||||
path.resolve(__dirname, "static")
|
|
||||||
]),
|
|
||||||
|
|
||||||
new WasmPackPlugin({
|
|
||||||
crateDirectory: __dirname,
|
|
||||||
extraArgs: "--out-name index"
|
|
||||||
})
|
|
||||||
]
|
|
||||||
};
|
|
|
@ -1,6 +1,5 @@
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist/js
|
||||||
/target
|
/target
|
||||||
/pkg
|
|
||||||
/wasm-pack.log
|
/wasm-pack.log
|
||||||
/yarn-error.log
|
/yarn-error.log
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "todomvc"
|
name = "todomvc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "TodoMVC using dominator"
|
description = "TodoMVC using dominator"
|
||||||
authors = ["Pauan <pcxunlimited@gmail.com>"]
|
authors = ["Pauan <pauanyu+github@pm.me>"]
|
||||||
categories = ["wasm"]
|
categories = ["wasm"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -15,7 +15,8 @@ lto = true
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dominator = { path = "../.." }
|
console_error_panic_hook = "0.1.5"
|
||||||
|
dominator = "0.5.0"
|
||||||
futures-signals = "0.3.0"
|
futures-signals = "0.3.0"
|
||||||
wasm-bindgen = "0.2.48"
|
wasm-bindgen = "0.2.48"
|
||||||
serde_json = "1.0.10"
|
serde_json = "1.0.10"
|
||||||
|
@ -31,6 +32,3 @@ features = [
|
||||||
"Storage",
|
"Storage",
|
||||||
"Url",
|
"Url",
|
||||||
]
|
]
|
||||||
|
|
||||||
[target."cfg(debug_assertions)".dependencies]
|
|
||||||
console_error_panic_hook = "0.1.5"
|
|
||||||
|
|
|
@ -4,14 +4,7 @@
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to run in debug mode
|
## How to build
|
||||||
|
|
||||||
```sh
|
|
||||||
# Builds the project and opens it in a new browser tab. Auto-reloads when the project changes.
|
|
||||||
yarn start
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to build in release mode
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Builds the project and places it into the `dist` folder.
|
# Builds the project and places it into the `dist` folder.
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
|
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="lib/todomvc-common/base.js"></script>
|
<script src="lib/todomvc-common/base.js"></script>
|
||||||
<script src="index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1 +0,0 @@
|
||||||
import("../pkg/index.js").catch(console.error);
|
|
|
@ -1,17 +1,14 @@
|
||||||
{
|
{
|
||||||
"author": "Pauan <pcxunlimited@gmail.com>",
|
"private": true,
|
||||||
|
"author": "Pauan <pauanyu+github@pm.me>",
|
||||||
"name": "todomvc",
|
"name": "todomvc",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rimraf dist pkg && webpack",
|
"build": "rimraf dist/js && rollup --config"
|
||||||
"start": "rimraf dist pkg && webpack-dev-server -d"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@wasm-tool/wasm-pack-plugin": "^0.4.2",
|
"@wasm-tool/rollup-plugin-rust": "^1.0.0",
|
||||||
"copy-webpack-plugin": "^5.0.3",
|
"rimraf": "^3.0.2",
|
||||||
"rimraf": "^2.6.3",
|
"rollup": "^1.31.0"
|
||||||
"webpack": "^4.33.0",
|
|
||||||
"webpack-cli": "^3.3.3",
|
|
||||||
"webpack-dev-server": "^3.7.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import rust from "@wasm-tool/rollup-plugin-rust";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: {
|
||||||
|
index: "./Cargo.toml",
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
dir: "dist/js",
|
||||||
|
format: "iife",
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
rust({
|
||||||
|
serverPath: "js/",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
|
@ -1,33 +0,0 @@
|
||||||
const path = require("path");
|
|
||||||
const CopyPlugin = require("copy-webpack-plugin");
|
|
||||||
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|
||||||
|
|
||||||
const dist = path.resolve(__dirname, "dist");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
mode: "production",
|
|
||||||
stats: "errors-warnings",
|
|
||||||
entry: {
|
|
||||||
index: "./js/index.js"
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
path: dist,
|
|
||||||
filename: "[name].js"
|
|
||||||
},
|
|
||||||
devServer: {
|
|
||||||
liveReload: true,
|
|
||||||
open: true,
|
|
||||||
noInfo: true,
|
|
||||||
overlay: true
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new CopyPlugin([
|
|
||||||
path.resolve(__dirname, "static")
|
|
||||||
]),
|
|
||||||
|
|
||||||
new WasmPackPlugin({
|
|
||||||
crateDirectory: __dirname,
|
|
||||||
extraArgs: "--out-name index"
|
|
||||||
})
|
|
||||||
]
|
|
||||||
};
|
|
|
@ -10,7 +10,7 @@ use futures_signals::signal::{Signal, SignalExt};
|
||||||
use futures_signals::signal_vec::{VecDiff, SignalVec, SignalVecExt};
|
use futures_signals::signal_vec::{VecDiff, SignalVec, SignalVecExt};
|
||||||
use web_sys::Node;
|
use web_sys::Node;
|
||||||
use wasm_bindgen::UnwrapThrowExt;
|
use wasm_bindgen::UnwrapThrowExt;
|
||||||
use wasm_bindgen_futures::futures_0_3::spawn_local;
|
use wasm_bindgen_futures::spawn_local;
|
||||||
|
|
||||||
use crate::bindings;
|
use crate::bindings;
|
||||||
use crate::dom::Dom;
|
use crate::dom::Dom;
|
||||||
|
|
Loading…
Reference in New Issue