anki/ts/svelte
Damien Elmes 1f876cfe39 Svelte build improvements
1. All Svelte files in a package are compiled in one step now, which
ensures that properties that use types from a different Svelte file in the
same package are typed correctly. The single-file svelte() has been removed,
and compile_svelte() may be renamed to svelte() in the future.

2. The .ts files in the same package are included as part of the Svelte
compilation, so that types imported imported from .ts files in the
same package work.

3. Dependencies passed into the rule are now loaded into the TypeScript
compiler, so that properties referencing types from different packages
work. We'll need to update our compile_svelte() lines to list the
dependencies. For example, before this change:

% cat bazel-bin/ts/congrats/CongratsPage.svelte.d.ts
import { SvelteComponentTyped } from "svelte";
declare const __propDef: {
    props: {
        info: any;
    };
...

After adding //ts/lib to the deps of compile_svelte() in ts/congrats:

% cat bazel-bin/ts/congrats/CongratsPage.svelte.d.ts
import { SvelteComponentTyped } from "svelte";
import type { Scheduler } from "../lib/proto";
declare const __propDef: {
    props: {
        info: Scheduler.CongratsInfoResponse;
    };
...
2021-10-18 12:44:29 +10:00
..
BUILD.bazel update to latest rules_nodejs & switch to ts_project 2021-10-01 12:52:53 +10:00
README.md vendor Svelte rules 2021-03-20 15:04:19 +10:00
svelte.bzl Svelte build improvements 2021-10-18 12:44:29 +10:00
svelte.ts Svelte build improvements 2021-10-18 12:44:29 +10:00

Originally forked from https://github.com/thelgevold/rules_svelte (MIT) into https://github.com/ankitects/rules_svelte, and modified to generate TypeScript definitions in addition to mjs files. The parts we need are now integrated into this repo, so we can modify them more easily.