drop ts_library() requirement in ts/svelte

This commit is contained in:
Damien Elmes 2021-10-18 13:00:55 +10:00
parent bb5053990b
commit fed5c3da0e
3 changed files with 20 additions and 10 deletions

View file

@ -1,28 +1,25 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("@npm//@bazel/typescript:index.bzl", "ts_library")
load("//ts:typescript.bzl", "typescript")
_deps = [
"@npm//@bazel/worker",
"@npm//@types/node",
"@npm//sass",
"@npm//svelte",
"@npm//svelte-preprocess",
"@npm//svelte2tsx",
"@npm//typescript",
"@npm//@types/node",
]
ts_library(
name = "svelte_bin_ts",
typescript(
name = "svelte_worker_ts",
srcs = ["svelte.ts"],
tsconfig = "//ts:tsconfig_bin",
deps = _deps,
)
nodejs_binary(
name = "svelte_bin",
data = ["svelte_bin_ts"] + _deps,
entry_point = ":svelte.ts",
# should fix .js files being not found on subsequent worker requests
templated_args = ["--bazel_patch_module_resolver"],
data = [":svelte_worker_ts"] + _deps,
entry_point = ":svelte.js",
visibility = ["//visibility:public"],
)

View file

@ -8,7 +8,7 @@ import { svelte2tsx } from "svelte2tsx";
import preprocess from "svelte-preprocess";
import { basename } from "path";
import * as ts from "typescript";
import * as svelte from "svelte/compiler.js";
import * as svelte from "svelte/compiler";
const parsedCommandLine: ts.ParsedCommandLine = {
fileNames: [],

13
ts/svelte/tsconfig.json Normal file
View file

@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"include": ["*"],
"references": [],
"compilerOptions": {
// ignore missing optional modules like postcss
"skipLibCheck": true,
// ensure node can run the resulting code
"noEmitHelpers": false,
"importHelpers": false,
"module": "commonjs",
}
}