Move async and asyncReactive to sveltelib

- sveltelib is a lib for component-agnostic svelte utils
This commit is contained in:
Henrik Giesel 2021-03-22 03:06:53 +01:00
parent 3c5233297a
commit 10b8a1c3cb
6 changed files with 39 additions and 3 deletions

View File

@ -20,6 +20,7 @@ ts_library(
"GraphsPage",
"lib",
"//ts/lib",
"//ts/sveltelib",
"@npm//svelte",
"@npm//svelte2tsx",
],
@ -32,6 +33,7 @@ ts_library(
exclude = ["index.ts"],
),
deps = [
"//ts/sveltelib",
"//ts/lib",
"//ts/lib:backend_proto",
"@npm//@types/d3",
@ -59,6 +61,7 @@ esbuild(
output_css = True,
visibility = ["//visibility:public"],
deps = [
"//ts/sveltelib",
"//ts/lib",
"//ts/lib:backend_proto",
"//ts/lib:fluent_proto",

View File

@ -1,6 +1,6 @@
<script lang="typescript">
import useAsync from "./async";
import useAsyncReactive from "./asyncReactive";
import useAsync from "sveltelib/async";
import useAsyncReactive from "sveltelib/asyncReactive";
import { getGraphData, RevlogRange, daysToRevlogRange } from "./graph-helpers";
import { getPreferences } from "./preferences";

32
ts/sveltelib/BUILD.bazel Normal file
View File

@ -0,0 +1,32 @@
load("@npm//@bazel/typescript:index.bzl", "ts_library")
load("//ts:prettier.bzl", "prettier_test")
load("//ts:eslint.bzl", "eslint_test")
# Anki Library
################
ts_library(
name = "sveltelib",
srcs = glob(["**/*.ts"]),
data = [],
module_name = "sveltelib",
tsconfig = "//:tsconfig.json",
visibility = ["//visibility:public"],
deps = [
"@npm//svelte",
"@npm//tslib",
],
)
# Tests
################
prettier_test(
name = "format_check",
srcs = glob(["*.ts"]),
)
eslint_test(
name = "eslint",
srcs = glob(["*.ts"]),
)

View File

@ -6,7 +6,8 @@
"lib": ["es2017", "es2019.array", "es2018.promise", "dom", "dom.iterable"],
"baseUrl": ".",
"paths": {
"anki/*": ["../bazel-bin/ts/lib/*"]
"anki/*": ["../bazel-bin/ts/lib/*"],
"sveltelib/*": ["../bazel-bin/ts/sveltelib/*"]
},
"importsNotUsedAsValues": "error",
"outDir": "dist",