sepal 0.1.0-alpha.2 → 0.3.0-alpha.0
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/README.md +16 -9
- package/cli.js +127 -10
- package/package.json +48 -21
- package/src/abort.js +129 -0
- package/src/app.js +13 -0
- package/src/dom.js +173 -60
- package/src/fetch.js +347 -80
- package/src/form-data.js +141 -0
- package/src/host-call.js +57 -0
- package/src/index.js +14 -12
- package/src/lru.js +45 -0
- package/src/native.js +32 -0
- package/src/notifications.js +60 -0
- package/src/os.js +35 -0
- package/src/process.js +164 -0
- package/src/protocol.js +3 -4
- package/src/renderer.js +140 -10
- package/src/secrets.js +42 -0
- package/src/settings.js +52 -0
- package/src/shims.js +111 -11
- package/src/stem.js +125 -0
- package/src/updater.js +3 -2
- package/src/url.js +65 -20
- package/src/web.js +86 -0
- package/src/window.js +6 -2
- package/types/abort.d.ts +46 -0
- package/types/app.d.ts +7 -0
- package/types/fetch.d.ts +118 -28
- package/types/form-data.d.ts +19 -0
- package/types/host-call.d.ts +18 -0
- package/types/index.d.ts +5 -2
- package/types/lru.d.ts +18 -0
- package/types/native.d.ts +22 -0
- package/types/notifications.d.ts +53 -0
- package/types/os.d.ts +53 -0
- package/types/process.d.ts +90 -0
- package/types/protocol.d.ts +0 -2
- package/types/renderer.d.ts +16 -1
- package/types/secrets.d.ts +22 -0
- package/types/settings.d.ts +29 -0
- package/types/shims.d.ts +13 -0
- package/types/stem.d.ts +21 -0
- package/types/updater.d.ts +6 -4
- package/types/url.d.ts +1 -1
- package/types/vite/adapter.d.ts +22 -0
- package/types/vite/add.d.ts +77 -0
- package/types/vite/app.d.ts +52 -1
- package/types/vite/licenses.d.ts +11 -0
- package/types/vite/native.d.ts +135 -0
- package/types/vite/page.d.ts +20 -0
- package/types/vite/permissions.d.ts +56 -0
- package/types/vite/sveltekit.d.ts +5 -34
- package/types/vite/vite.d.ts +86 -53
- package/types/web.d.ts +17 -0
- package/types/window.d.ts +5 -1
- package/vite/adapter.js +118 -0
- package/vite/add.js +254 -0
- package/vite/app.js +195 -27
- package/vite/head.js +2 -2
- package/vite/licenses.js +115 -0
- package/vite/native.js +535 -0
- package/vite/page.js +95 -0
- package/vite/permissions.d.ts +56 -0
- package/vite/sveltekit.js +11 -224
- package/vite/vite.js +377 -147
- package/ambient.d.ts +0 -20
- package/types/vite/navigation.d.ts +0 -1
- package/types/vite/router-entry.d.ts +0 -1
- package/types/vite/router.d.ts +0 -21
- package/types/vite/routes.d.ts +0 -41
- package/types/vite/routing.svelte.d.ts +0 -131
- package/types/vite/state.d.ts +0 -1
- package/vite/Router.svelte +0 -32
- package/vite/RouterError.svelte +0 -11
- package/vite/navigation.js +0 -3
- package/vite/router-entry.js +0 -12
- package/vite/router.js +0 -17
- package/vite/routes.js +0 -219
- package/vite/routing.svelte.js +0 -378
- package/vite/state.js +0 -2
- package/vite/virtual.d.ts +0 -9
package/types/shims.d.ts
CHANGED
|
@@ -20,10 +20,23 @@ export function run_timers(): boolean;
|
|
|
20
20
|
* @returns {number} the earliest deadline on the host clock, or -1 if no timer is pending
|
|
21
21
|
*/
|
|
22
22
|
export function next_timer(): number;
|
|
23
|
+
/**
|
|
24
|
+
* Run one callback of this frame, and say whether there was one. As with
|
|
25
|
+
* timers, the host calls this until the answer is no, and runs microtasks
|
|
26
|
+
* after every call. Every callback of a frame gets the same `time`; one
|
|
27
|
+
* queued during the frame runs in the next.
|
|
28
|
+
*
|
|
29
|
+
* @param {number} time the frame's timestamp, on the host clock
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
export function run_frame(time: number): boolean;
|
|
23
33
|
export function rejection_count(): number;
|
|
34
|
+
export function frame_pending(): boolean;
|
|
24
35
|
export type Timer = {
|
|
25
36
|
fn: Function;
|
|
26
37
|
args: any[];
|
|
27
38
|
at: number;
|
|
28
39
|
every: number;
|
|
40
|
+
level: number;
|
|
41
|
+
context: unknown;
|
|
29
42
|
};
|
package/types/stem.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Answer the page's requests to the app's origin with `next`. Call it once,
|
|
3
|
+
* from the server code's entry module; a later call replaces the handler.
|
|
4
|
+
* A request that arrives before it is answered with a 500.
|
|
5
|
+
*
|
|
6
|
+
* Experimental: what puts an app's code on the stem is not decided yet
|
|
7
|
+
* (SvelteKit's own server, or functions of Sepal's own), and this may
|
|
8
|
+
* change shape with it.
|
|
9
|
+
* @experimental
|
|
10
|
+
* @param {Handler} next
|
|
11
|
+
*/
|
|
12
|
+
export function serve(next: Handler): void;
|
|
13
|
+
/**
|
|
14
|
+
* What `serve()` takes: a function from a `Request` to its `Response` (or a
|
|
15
|
+
* promise of one), or an object with one as `fetch`, as servers on the web
|
|
16
|
+
* platform take them. Typed loosely: the app's code knows these classes by
|
|
17
|
+
* its own (DOM) types, and this package has none to name.
|
|
18
|
+
*/
|
|
19
|
+
export type Handler = ((request: any) => unknown) | {
|
|
20
|
+
fetch(request: any): unknown;
|
|
21
|
+
};
|
package/types/updater.d.ts
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
*
|
|
13
13
|
* `download()` fetches the update and verifies its signature; nothing on disk
|
|
14
14
|
* changes. `install()` downloads if that has not happened yet, replaces the
|
|
15
|
-
* app and
|
|
16
|
-
*
|
|
15
|
+
* app and ends it; the new version starts once it has ended. Code after a
|
|
16
|
+
* successful `install()` may not run. It rejects when the app is not running
|
|
17
|
+
* from a bundle (in dev, for instance).
|
|
17
18
|
*/
|
|
18
19
|
/**
|
|
19
20
|
* Ask the update feed whether there is a newer version for this platform.
|
|
@@ -25,8 +26,9 @@ export function check(): Promise<Update | null>;
|
|
|
25
26
|
/**
|
|
26
27
|
* `download()` fetches the update and verifies its signature; nothing on disk
|
|
27
28
|
* changes. `install()` downloads if that has not happened yet, replaces the
|
|
28
|
-
* app and
|
|
29
|
-
*
|
|
29
|
+
* app and ends it; the new version starts once it has ended. Code after a
|
|
30
|
+
* successful `install()` may not run. It rejects when the app is not running
|
|
31
|
+
* from a bundle (in dev, for instance).
|
|
30
32
|
*/
|
|
31
33
|
export type Update = {
|
|
32
34
|
version: string;
|
package/types/url.d.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files under `src` that SvelteKit would run on a server. An app has a
|
|
3
|
+
* thread for server code (the stem), but how an app's server code gets
|
|
4
|
+
* there is not decided (HANDOVER.md, "The stem's API: open"), so these
|
|
5
|
+
* would build and then never run. Relative to `src`.
|
|
6
|
+
* @param {string} src
|
|
7
|
+
*/
|
|
8
|
+
export function server_files(src: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* What is missing from the setup, as messages saying what to add.
|
|
11
|
+
* @param {import('@sveltejs/kit').Builder['config']} config
|
|
12
|
+
* @param {string} root the project
|
|
13
|
+
* @returns {string[]}
|
|
14
|
+
*/
|
|
15
|
+
export function problems(config: import("@sveltejs/kit").Builder["config"], root: string): string[];
|
|
16
|
+
/**
|
|
17
|
+
* @param {{ out?: string }} [options] `out` is where the app is written (default `dist`).
|
|
18
|
+
* @returns {import('@sveltejs/kit').Adapter}
|
|
19
|
+
*/
|
|
20
|
+
export default function adapter({ out }?: {
|
|
21
|
+
out?: string;
|
|
22
|
+
}): import("@sveltejs/kit").Adapter;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** @typedef {{ crate: string, init: string, permission: { key: string, default?: unknown } }} PluginInfo */
|
|
2
|
+
/** @param {string} root */
|
|
3
|
+
export function package_manager(root: string): "bun" | "pnpm" | "yarn" | "npm";
|
|
4
|
+
/**
|
|
5
|
+
* The plugin an installed package is, or null. `sepal` is its peer range
|
|
6
|
+
* on sepal, which is its crate's requirement too.
|
|
7
|
+
* @param {string} root @param {string} name
|
|
8
|
+
* @returns {{ info: PluginInfo, version: string, dir: string, sepal: string | undefined } | null}
|
|
9
|
+
*/
|
|
10
|
+
export function installed_plugin(root: string, name: string): {
|
|
11
|
+
info: PluginInfo;
|
|
12
|
+
version: string;
|
|
13
|
+
dir: string;
|
|
14
|
+
sepal: string | undefined;
|
|
15
|
+
} | null;
|
|
16
|
+
/** Every plugin the project depends on, in name order. @param {string} root */
|
|
17
|
+
export function plugins(root: string): {
|
|
18
|
+
info: PluginInfo;
|
|
19
|
+
version: string;
|
|
20
|
+
dir: string;
|
|
21
|
+
sepal: string | undefined;
|
|
22
|
+
}[];
|
|
23
|
+
/** `native/src/plugins.rs` for these plugins. @param {PluginInfo[]} infos */
|
|
24
|
+
export function plugins_rs(infos: PluginInfo[]): string;
|
|
25
|
+
/**
|
|
26
|
+
* Add `key: value` to `permissions` in a `sepal.config.ts`, in place: the
|
|
27
|
+
* file is parsed (acorn with TypeScript) and the text inserted where it
|
|
28
|
+
* goes, nothing reprinted. Null when the file is not `export default
|
|
29
|
+
* defineConfig({ … })` with an object literal, which then needs the line
|
|
30
|
+
* by hand.
|
|
31
|
+
* @param {string} code @param {string} key @param {unknown} value
|
|
32
|
+
* @returns {{ code: string, changed: boolean } | null}
|
|
33
|
+
*/
|
|
34
|
+
export function add_permission(code: string, key: string, value: unknown): {
|
|
35
|
+
code: string;
|
|
36
|
+
changed: boolean;
|
|
37
|
+
} | null;
|
|
38
|
+
/**
|
|
39
|
+
* `sepal add <names…>`.
|
|
40
|
+
* @param {string} root the project
|
|
41
|
+
* @param {string[]} names
|
|
42
|
+
* @param {{ run?: Run, view?: (name: string) => boolean, crate_name: string, log?: (line: string) => void }} options
|
|
43
|
+
* `view` says whether a package that is not one of ours is a plugin (by default, the registry's word)
|
|
44
|
+
*/
|
|
45
|
+
export function add(root: string, names: string[], { run, view, crate_name, log }: {
|
|
46
|
+
run?: Run;
|
|
47
|
+
view?: (name: string) => boolean;
|
|
48
|
+
crate_name: string;
|
|
49
|
+
log?: (line: string) => void;
|
|
50
|
+
}): void;
|
|
51
|
+
/** Write native/src/plugins.rs again from the plugins the project has. @param {string} root */
|
|
52
|
+
export function write_plugins_rs(root: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* `sepal check`'s own part: what has to agree between the npm packages,
|
|
55
|
+
* native/ and the config. svelte-check runs beside it.
|
|
56
|
+
* @param {string} root @param {Record<string, unknown> | undefined} permissions the config's
|
|
57
|
+
* @param {string} [version] this sepal's
|
|
58
|
+
* @returns {string[]} the problems
|
|
59
|
+
*/
|
|
60
|
+
export function check(root: string, permissions: Record<string, unknown> | undefined, version?: string): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Sepal's own plugins, by short name. `sepal add watch` means these and
|
|
63
|
+
* nothing else: never whatever `sepal-<name>` someone published, which would
|
|
64
|
+
* then be installed as if it were ours, crate and all.
|
|
65
|
+
*/
|
|
66
|
+
export const FIRST_PARTY: Record<string, string>;
|
|
67
|
+
export type PluginInfo = {
|
|
68
|
+
crate: string;
|
|
69
|
+
init: string;
|
|
70
|
+
permission: {
|
|
71
|
+
key: string;
|
|
72
|
+
default?: unknown;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export type Run = (command: string, args: string[], cwd: string) => {
|
|
76
|
+
status: number | null;
|
|
77
|
+
};
|
package/types/vite/app.d.ts
CHANGED
|
@@ -16,15 +16,40 @@ export function load_config(project: string, env: import("vite").ConfigEnv): Pro
|
|
|
16
16
|
* @param {import('./vite.js').Config} options
|
|
17
17
|
* @param {string} root the project
|
|
18
18
|
* @param {string} static_dir where the icon is looked for; empty when there is none
|
|
19
|
-
* @returns {{ json: string, icon: string | null } | null}
|
|
19
|
+
* @returns {{ json: string, icon: string | null, warnings: string[] } | null}
|
|
20
20
|
*/
|
|
21
21
|
export function manifest(options: import("./vite.js").Config, root: string, static_dir: string): {
|
|
22
22
|
json: string;
|
|
23
23
|
icon: string | null;
|
|
24
|
+
warnings: string[];
|
|
24
25
|
} | null;
|
|
26
|
+
/**
|
|
27
|
+
* What to say about `permissions.process` when it allows running anything:
|
|
28
|
+
* `true`, or a list that names a shell or a script runner. A warning, not
|
|
29
|
+
* an error: some apps are for exactly that.
|
|
30
|
+
* @param {{ process?: unknown } | undefined} permissions
|
|
31
|
+
* @returns {string[]}
|
|
32
|
+
*/
|
|
33
|
+
export function process_warnings(permissions: {
|
|
34
|
+
process?: unknown;
|
|
35
|
+
} | undefined): string[];
|
|
36
|
+
/**
|
|
37
|
+
* The flags for dev's throwaway bundle: `--dev`, which leaves the page out
|
|
38
|
+
* of it and signs it for this Mac, with the app's identity when
|
|
39
|
+
* `SEPAL_SIGN` names one. Its signature is then the same from one build
|
|
40
|
+
* of the app to the next, and so is the program the keychain and the
|
|
41
|
+
* notification settings know.
|
|
42
|
+
*/
|
|
43
|
+
export function dev_bundle_flags(): string[];
|
|
25
44
|
/**
|
|
26
45
|
* The app's window in dev. The first call opens it; every later one reloads
|
|
27
46
|
* it in place. Returns a function to call after each successful build.
|
|
47
|
+
*
|
|
48
|
+
* An app with `native/` runs its own host: built first (the window opens
|
|
49
|
+
* when it is), built again on every change to it or to a crate it has by
|
|
50
|
+
* path, and restarted when that changes the binary. A build that fails keeps
|
|
51
|
+
* the last good host running; one that never succeeded opens nothing. Both
|
|
52
|
+
* keep dev going until the next change.
|
|
28
53
|
* @param {() => { root: string, out_dir: string, name: string | undefined }} project read at the first call
|
|
29
54
|
*/
|
|
30
55
|
export function dev_window(project: () => {
|
|
@@ -32,5 +57,31 @@ export function dev_window(project: () => {
|
|
|
32
57
|
out_dir: string;
|
|
33
58
|
name: string | undefined;
|
|
34
59
|
}): () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Compile the app's modules to bytecode with this machine's calyx (`calyx
|
|
62
|
+
* --compile`), which writes `x.js.qbc` next to each `x.js`: the host then
|
|
63
|
+
* loads them without parsing them. The app folder is a new build, so every
|
|
64
|
+
* module is compiled. Without a calyx that can, the app loads its
|
|
65
|
+
* JavaScript, as it always could: the build says so, and goes on.
|
|
66
|
+
* @param {string} dir the app folder
|
|
67
|
+
* @param {(message: string) => void} warn
|
|
68
|
+
* @returns {string | null} calyx's summary, or null when nothing was compiled
|
|
69
|
+
*/
|
|
70
|
+
export function compile_bytecode(dir: string, warn: (message: string) => void): string | null;
|
|
71
|
+
/**
|
|
72
|
+
* What `sepal()` tells the SvelteKit adapter (`sepal/adapter`), which runs
|
|
73
|
+
* inside SvelteKit's build and has no other way to reach it: the project,
|
|
74
|
+
* the settings from `sepal.config.ts`, and what to do once the app is
|
|
75
|
+
* written to a directory (open or reload the dev window). `null` until
|
|
76
|
+
* `sepal()` has run.
|
|
77
|
+
* @type {{ session: { root: string, options: import('./vite.js').Config, written: (out_dir: string) => void } | null }}
|
|
78
|
+
*/
|
|
79
|
+
export const kit: {
|
|
80
|
+
session: {
|
|
81
|
+
root: string;
|
|
82
|
+
options: import("./vite.js").Config;
|
|
83
|
+
written: (out_dir: string) => void;
|
|
84
|
+
} | null;
|
|
85
|
+
};
|
|
35
86
|
/** The Sepal app icon, for an app that has none of its own. A byte copy of assets/brand/sepal-app-icon-1024.png. */
|
|
36
87
|
export const SEPAL_ICON: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The notices for the binary `manifest` builds.
|
|
3
|
+
* @param {string} manifest the Cargo.toml the binary is built from
|
|
4
|
+
* @param {string[]} [features] the features it is built with; a superset is fine for a list of notices
|
|
5
|
+
* @returns {{ text: string, crates: number, texts: number }}
|
|
6
|
+
*/
|
|
7
|
+
export function third_party_licenses(manifest: string, features?: string[]): {
|
|
8
|
+
text: string;
|
|
9
|
+
crates: number;
|
|
10
|
+
texts: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `version` is in the caret range `^base`, as Cargo and npm both
|
|
3
|
+
* read one: at `base` or after it, in its 0.x line (its major from 1.0 on),
|
|
4
|
+
* and a pre-release only of `base`'s own major.minor.patch. This is how a
|
|
5
|
+
* plugin names sepal, in its crate and in its package's peer range.
|
|
6
|
+
* @param {string} base @param {string} version
|
|
7
|
+
*/
|
|
8
|
+
export function caret_accepts(base: string, version: string): boolean;
|
|
9
|
+
/** @param {string} root the project @returns {string | null} `native/Cargo.toml`, if the app has one */
|
|
10
|
+
export function native_manifest(root: string): string | null;
|
|
11
|
+
/** The build directory every app on this machine shares: one subdirectory per compiler. */
|
|
12
|
+
export function cargo_dir(env?: NodeJS.ProcessEnv): string;
|
|
13
|
+
/**
|
|
14
|
+
* The crate's name, from the app's id (`app.sepal.tracker` is
|
|
15
|
+
* `app-sepal-tracker`) or else its package name.
|
|
16
|
+
* @param {string | undefined} id @param {string | undefined} package_name
|
|
17
|
+
*/
|
|
18
|
+
export function crate_name(id: string | undefined, package_name: string | undefined): string;
|
|
19
|
+
/**
|
|
20
|
+
* What `sepal native init` writes, by path under the project.
|
|
21
|
+
* @param {{ name: string, version: string, native: string, crates?: string }} options
|
|
22
|
+
* @returns {Record<string, string>}
|
|
23
|
+
*/
|
|
24
|
+
export function init_files({ name, version, native, crates }: {
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
native: string;
|
|
28
|
+
crates?: string;
|
|
29
|
+
}): Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Why `native/` cannot be built with this sepal, or null: its lines name
|
|
32
|
+
* another release's tag. The host and the JavaScript are released together.
|
|
33
|
+
* @param {string} manifest @param {string} version
|
|
34
|
+
*/
|
|
35
|
+
export function tag_problem(manifest: string, version: string): string | null;
|
|
36
|
+
/** Point the lines that name a release at this one. @param {string} manifest @param {string} version @returns {number} the lines changed */
|
|
37
|
+
export function update_tag(manifest: string, version: string): number;
|
|
38
|
+
/**
|
|
39
|
+
* The subdirectory for a compiler, from `rustc -vV`: `rustc-1.95.0-59807616e`.
|
|
40
|
+
* The commit tells nightlies of one release apart.
|
|
41
|
+
* @param {string} verbose
|
|
42
|
+
*/
|
|
43
|
+
export function compiler_dir(verbose: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* The build directory for `native/`: the shared one's subdirectory for the
|
|
46
|
+
* compiler cargo uses there (rustup picks it from the directory, with its
|
|
47
|
+
* rust-toolchain file).
|
|
48
|
+
* @param {string} manifest @param {NodeJS.ProcessEnv} [env]
|
|
49
|
+
*/
|
|
50
|
+
export function build_dir(manifest: string, env?: NodeJS.ProcessEnv): string;
|
|
51
|
+
/**
|
|
52
|
+
* Remove the other compilers' build directories that no build has used for
|
|
53
|
+
* 30 days. Only `rustc-*` directories: nothing else in `base` is ours.
|
|
54
|
+
* @param {string} base @param {string} keep the one in use @param {number} [now]
|
|
55
|
+
* @returns {string[]} what was removed
|
|
56
|
+
*/
|
|
57
|
+
export function prune(base: string, keep: string, now?: number): string[];
|
|
58
|
+
/** `sepal native clean`: the whole shared directory, every compiler's. @returns {string} what was removed */
|
|
59
|
+
export function clean(env?: NodeJS.ProcessEnv): string;
|
|
60
|
+
/**
|
|
61
|
+
* What this machine is missing to build `native/`, as the message to print,
|
|
62
|
+
* or null.
|
|
63
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
64
|
+
*/
|
|
65
|
+
export function toolchain_problem(env?: NodeJS.ProcessEnv): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Build `native/` with cargo, its progress on this terminal. Resolves to the
|
|
68
|
+
* binary, or to the error when cargo fails.
|
|
69
|
+
* @param {string} manifest `native/Cargo.toml`
|
|
70
|
+
* @param {'dev' | 'dist'} profile
|
|
71
|
+
* @returns {Promise<{ binary: string } | { error: string }>}
|
|
72
|
+
*/
|
|
73
|
+
export function build(manifest: string, profile: "dev" | "dist"): Promise<{
|
|
74
|
+
binary: string;
|
|
75
|
+
} | {
|
|
76
|
+
error: string;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Sign dev's host with the app's signing identity (`SEPAL_SIGN`), on macOS.
|
|
80
|
+
*
|
|
81
|
+
* The keychain knows a program by its code signature, and the linker signs
|
|
82
|
+
* each build ad hoc, as a hash of the binary: to the keychain every rebuild
|
|
83
|
+
* is another program, asked before it reads a secret the last one stored.
|
|
84
|
+
* Signed with one identity under one identifier, the builds are one
|
|
85
|
+
* program. Only a binary cargo just linked is signed (its signature is the
|
|
86
|
+
* linker's again), so an unchanged host is not touched and dev does not
|
|
87
|
+
* restart it.
|
|
88
|
+
* @param {string} binary @param {string | undefined} identity
|
|
89
|
+
* @param {typeof spawnSync} [run]
|
|
90
|
+
* @returns {boolean} whether it signed it
|
|
91
|
+
*/
|
|
92
|
+
export function sign_dev_host(binary: string, identity: string | undefined, run?: typeof spawnSync): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* The directories of every crate `native/` has by path, itself included:
|
|
95
|
+
* what a rebuild in dev watches.
|
|
96
|
+
* @param {string} manifest
|
|
97
|
+
* @returns {Promise<string[]>}
|
|
98
|
+
*/
|
|
99
|
+
export function path_crates(manifest: string): Promise<string[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Watch `dirs` (told by the OS: FSEvents, inotify; nothing polls) and call
|
|
102
|
+
* `changed` once for every burst of changes, a burst being changes less than
|
|
103
|
+
* 100 ms apart. What is under a `target/` directory does not count.
|
|
104
|
+
* @param {string[]} dirs @param {(file: string) => void} changed
|
|
105
|
+
* @returns {() => void} stops watching
|
|
106
|
+
*/
|
|
107
|
+
export function watch_crates(dirs: string[], changed: (file: string) => void): () => void;
|
|
108
|
+
/** When the binary was last written, to tell a rebuild that changed it from one that did not. @param {string} binary */
|
|
109
|
+
export function written(binary: string): number;
|
|
110
|
+
/**
|
|
111
|
+
* Check, build and hand over: everything `sepal run`, `screenshot` and
|
|
112
|
+
* `bundle` need before they start the host. Exits with the message when the
|
|
113
|
+
* app cannot be built. Sets `SEPAL_HOST` to the binary.
|
|
114
|
+
* @param {string} manifest @param {'dev' | 'dist'} profile
|
|
115
|
+
* @returns {Promise<string>} the binary
|
|
116
|
+
*/
|
|
117
|
+
export function build_or_exit(manifest: string, profile: "dev" | "dist"): Promise<string>;
|
|
118
|
+
/** The line before a build, and what a first one costs. @param {string} manifest @param {'dev' | 'dist'} profile */
|
|
119
|
+
export function announce(manifest: string, profile: "dev" | "dist"): void;
|
|
120
|
+
/**
|
|
121
|
+
* Write `native/` for the project at `root`. Refuses if it exists.
|
|
122
|
+
* @param {string} root @param {string} name the crate's name
|
|
123
|
+
* @returns {string[]} the files written
|
|
124
|
+
*/
|
|
125
|
+
export function init(root: string, name: string): string[];
|
|
126
|
+
export const REPOSITORY: "https://github.com/etherCorps/sepal";
|
|
127
|
+
/** Sepal's patched crates, in the order `[patch.crates-io]` lists them. */
|
|
128
|
+
export const PATCHED: string[];
|
|
129
|
+
/** The version of this sepal, which `native/` has to build its host from. */
|
|
130
|
+
export const VERSION: any;
|
|
131
|
+
export type Version = {
|
|
132
|
+
numbers: number[];
|
|
133
|
+
pre: string[] | undefined;
|
|
134
|
+
};
|
|
135
|
+
import { spawnSync } from 'node:child_process';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What in a stylesheet would load from the network: `@import` of a remote
|
|
3
|
+
* stylesheet, and fonts in `@font-face`. Images are not checked: they are
|
|
4
|
+
* refused when they load, as today.
|
|
5
|
+
* @param {string} css
|
|
6
|
+
* @param {string} where the file, for the message
|
|
7
|
+
* @returns {string[]}
|
|
8
|
+
*/
|
|
9
|
+
export function check_css(css: string, where: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Check a page. `errors` stop the build: something would load from the
|
|
12
|
+
* network. `warnings` are what the host leaves out.
|
|
13
|
+
* @param {string} html
|
|
14
|
+
* @param {string} where the file, for the messages
|
|
15
|
+
* @returns {{ errors: string[], warnings: string[] }}
|
|
16
|
+
*/
|
|
17
|
+
export function check_page(html: string, where?: string): {
|
|
18
|
+
errors: string[];
|
|
19
|
+
warnings: string[];
|
|
20
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the app may do, beyond its own page: `permissions` in
|
|
3
|
+
* `sepal.config.ts`. Each key is default-deny.
|
|
4
|
+
*
|
|
5
|
+
* A plugin's package adds its own key, which its commands need:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* declare module 'sepal/permissions' {
|
|
9
|
+
* interface Permissions { watch?: boolean | string[] }
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* (`sepal/vite`'s `Permissions` is this one; augment it here, where it is
|
|
14
|
+
* declared.) A key no installed package declares is an error here, as the
|
|
15
|
+
* host's own check is at launch.
|
|
16
|
+
*/
|
|
17
|
+
export interface Permissions {
|
|
18
|
+
/** Which URLs `fetch` may reach: origins, optionally with a path prefix, or a host with a wildcard. `true` allows any. */
|
|
19
|
+
http?: boolean | string[];
|
|
20
|
+
/** Which directories the file APIs may touch: `data`, `documents`, `downloads`, `desktop`, `home`, or absolute paths. `true` allows any. */
|
|
21
|
+
fs?: boolean | string[];
|
|
22
|
+
/** Open, save and message dialogs. */
|
|
23
|
+
dialog?: boolean;
|
|
24
|
+
/** Reading and writing the clipboard. */
|
|
25
|
+
clipboard?: boolean;
|
|
26
|
+
/** Opening web and mail links, and allowed files, in their default app. */
|
|
27
|
+
open?: boolean;
|
|
28
|
+
/** Changing the window: minimise, maximise, decorations, close, drag. */
|
|
29
|
+
window?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The system's details (`info()` in `sepal/os`): platform, version, locale,
|
|
32
|
+
* host name, dark mode. Environment variables only by name, listed in
|
|
33
|
+
* `env`, which gives `info()` too.
|
|
34
|
+
*/
|
|
35
|
+
os?: boolean | { env?: string[] };
|
|
36
|
+
/** The app's settings (`sepal/settings`), shared with the app's Rust. */
|
|
37
|
+
settings?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The programs `sepal/process` may run: names (`'git'`, found in the
|
|
40
|
+
* app's `PATH` and the usual install folders) and absolute paths. `true`
|
|
41
|
+
* allows any. The list limits which programs start, not what they do:
|
|
42
|
+
* `git` runs hooks and aliases, and a shell or `node` runs anything.
|
|
43
|
+
*/
|
|
44
|
+
process?: boolean | string[];
|
|
45
|
+
/**
|
|
46
|
+
* The OS's keychain (`sepal/secrets`): the login keychain on macOS, the
|
|
47
|
+
* Secret Service or the Secret portal on Linux. Kept under the app's id;
|
|
48
|
+
* on Linux other programs of the user's can read an unlocked keyring.
|
|
49
|
+
*/
|
|
50
|
+
secrets?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The system's notifications (`sepal/notifications`). On macOS the user
|
|
53
|
+
* is asked as well, the first time.
|
|
54
|
+
*/
|
|
55
|
+
notifications?: boolean;
|
|
56
|
+
}
|
|
@@ -1,36 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @param {string
|
|
5
|
-
* @
|
|
2
|
+
* @deprecated Use SvelteKit's `sveltekit(withSepal({ adapter: adapter() }))`,
|
|
3
|
+
* with `adapter` from `sepal/adapter`, and `sepal()` from `sepal/vite`.
|
|
4
|
+
* @param {Record<string, unknown>} [_options]
|
|
5
|
+
* @returns {never}
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
8
|
-
/**
|
|
9
|
-
* A stylesheet moved from `dir` (relative to the build, `/`-separated) to
|
|
10
|
-
* app.css at its root. Its relative `url()`s, such as a font next to it in
|
|
11
|
-
* `_app/immutable/assets`, have to say where they now are from there.
|
|
12
|
-
* @param {string} css
|
|
13
|
-
* @param {string} dir
|
|
14
|
-
*/
|
|
15
|
-
export function rebase_css(css: string, dir: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {import('./vite.js').Config & {
|
|
18
|
-
* kit?: import('@sveltejs/kit/vite').Config,
|
|
19
|
-
* out?: string
|
|
20
|
-
* }} KitOptions
|
|
21
|
-
* `app` and `permissions` override `sepal.config.ts`, key by key. `kit` is
|
|
22
|
-
* passed on to SvelteKit. `out` is where the app is written (default `dist`).
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* @param {KitOptions} [inline]
|
|
26
|
-
* @returns {Promise<import('vite').PluginOption[]>}
|
|
27
|
-
*/
|
|
28
|
-
export function sepalKit(inline?: KitOptions): Promise<import("vite").PluginOption[]>;
|
|
29
|
-
/**
|
|
30
|
-
* `app` and `permissions` override `sepal.config.ts`, key by key. `kit` is
|
|
31
|
-
* passed on to SvelteKit. `out` is where the app is written (default `dist`).
|
|
32
|
-
*/
|
|
33
|
-
export type KitOptions = import("./vite.js").Config & {
|
|
34
|
-
kit?: import("@sveltejs/kit/vite").Config;
|
|
35
|
-
out?: string;
|
|
36
|
-
};
|
|
7
|
+
export function sepalKit(_options?: Record<string, unknown>): never;
|