sv 1.2.0 → 1.3.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/dist/{shared.json → addons/ai-tools.json} +18 -199
- package/dist/{addons-Ih-Pmrow.mjs → addons-BCioxI2r.mjs} +74 -9
- package/dist/bin.mjs +23 -25
- package/dist/{engine-0i6PA_0L.mjs → engine-S8UpCG24.mjs} +7 -61
- package/dist/playground/PlaygroundLayout.svelte +218 -0
- package/dist/src/index.d.mts +4 -4
- package/dist/src/index.mjs +2 -2
- package/dist/src/testing.mjs +1 -1
- package/dist/templates/addon/assets/CONTRIBUTING.md +48 -0
- package/dist/templates/addon/assets/README.md +29 -0
- package/dist/templates/addon/files.types=checkjs.json +10 -1
- package/dist/templates/addon/files.types=none.json +10 -1
- package/dist/templates/addon/files.types=typescript.json +10 -1
- package/dist/templates/addon/package.json +22 -16
- package/dist/templates/demo/assets/README.md +49 -0
- package/dist/templates/demo/files.types=checkjs.json +12 -0
- package/dist/templates/demo/files.types=none.json +12 -0
- package/dist/templates/demo/files.types=typescript.json +12 -0
- package/dist/templates/demo/package.json +10 -6
- package/dist/templates/library/assets/README.md +72 -0
- package/dist/templates/library/files.types=checkjs.json +12 -0
- package/dist/templates/library/files.types=none.json +12 -0
- package/dist/templates/library/files.types=typescript.json +12 -0
- package/dist/templates/library/package.json +28 -17
- package/dist/templates/minimal/assets/README.md +49 -0
- package/dist/templates/minimal/files.types=checkjs.json +12 -0
- package/dist/templates/minimal/files.types=none.json +12 -0
- package/dist/templates/minimal/files.types=typescript.json +12 -0
- package/dist/templates/minimal/package.json +10 -6
- package/package.json +1 -3
package/dist/bin.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
3
|
-
import { n as officialAddons$1, t as getAddonDetails } from "./addons-
|
|
2
|
+
import { $ as parse$1, A as cliOptions, B as runAndValidateVerifications, C as create$1, D as from, E as up$2, F as getPadding, G as UnsupportedError, H as updateAgent, I as helpConfig, J as array, K as name, L as isNodeError, M as filePaths, N as forwardExitCode, O as PackageJSONSchema, P as getHelpSections, Q as optional, R as normalizePosix, S as execSync, T as dist_dir, U as updateLibraryBuild, V as runCommand, W as updateReadme, X as literal, Y as boolean, Z as nonEmpty, _t as pe, a as setupAddons, at as string, b as NonZeroExitError, bt as R$1, c as AGENT_NAMES, ct as program, d as detectPackageManager, dt as Ce, et as picklist, f as installDependencies, ft as Ee, g as createLoadedAddon, gt as le, h as up$1, ht as ge, i as prepareSvApi, it as strictObject, j as errorAndExit, k as buildAndLogArgs, l as addAllowBuildsIfPnpm, lt as Command, m as packageManagerPrompt, mt as Re, n as applyAddons, nt as record, o as createWorkspace, ot as transform, p as installOption, pt as R, q as version, r as orderAddons, rt as safeParse, s as findWorkspaceRoot, st as union, tt as pipe, u as addEngineStrict, ut as Option, vt, w as templates, x as exec, y as getErrorHint, yt as we, z as parseAddonOptions } from "./engine-S8UpCG24.mjs";
|
|
3
|
+
import { n as officialAddons$1, t as getAddonDetails } from "./addons-BCioxI2r.mjs";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
@@ -2063,25 +2063,19 @@ function setupPlaygroundProject(url, playground, cwd, installDependencies) {
|
|
|
2063
2063
|
fs.writeFileSync(filePath, file.content, "utf8");
|
|
2064
2064
|
}
|
|
2065
2065
|
{
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
} else if (node.value === "$sv-url-$sv") {
|
|
2077
|
-
node.value = url;
|
|
2078
|
-
node.raw = void 0;
|
|
2079
|
-
}
|
|
2080
|
-
} });
|
|
2081
|
-
contentToWrite = generateCode();
|
|
2066
|
+
const layout = fs.readFileSync(path.join(dist_dir, "playground", "PlaygroundLayout.svelte"), "utf-8");
|
|
2067
|
+
const { ast, generateCode } = parse.svelte(layout);
|
|
2068
|
+
svelte.ensureScript(ast);
|
|
2069
|
+
Walker.walk(ast.instance.content, null, { Literal(node) {
|
|
2070
|
+
if (node.value === "$sv-title-$sv") {
|
|
2071
|
+
node.value = playground.name;
|
|
2072
|
+
node.raw = void 0;
|
|
2073
|
+
} else if (node.value === "$sv-url-$sv") {
|
|
2074
|
+
node.value = url;
|
|
2075
|
+
node.raw = void 0;
|
|
2082
2076
|
}
|
|
2083
|
-
|
|
2084
|
-
|
|
2077
|
+
} });
|
|
2078
|
+
fs.writeFileSync(path.join(cwd, "src/lib/PlaygroundLayout.svelte"), generateCode(), "utf-8");
|
|
2085
2079
|
}
|
|
2086
2080
|
const filePath = path.join(cwd, "src/routes/+page.svelte");
|
|
2087
2081
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
@@ -3852,7 +3846,8 @@ function libSubpathImports(libDir) {
|
|
|
3852
3846
|
var lib_alias_default = defineMigrationTask({
|
|
3853
3847
|
id: "lib-alias",
|
|
3854
3848
|
description: "Replace the $lib alias with #lib subpath imports",
|
|
3855
|
-
run: ({ sv, cwd, directory }) => {
|
|
3849
|
+
run: ({ sv, cwd, directory, dependencyVersion }) => {
|
|
3850
|
+
const isLibrary = Boolean(dependencyVersion("@sveltejs/package"));
|
|
3856
3851
|
sv.file("package.json", transforms.json(({ data }) => {
|
|
3857
3852
|
data.imports = {
|
|
3858
3853
|
...libSubpathImports(directory.lib),
|
|
@@ -3869,11 +3864,14 @@ var lib_alias_default = defineMigrationTask({
|
|
|
3869
3864
|
match = match.replace("$lib", "#lib");
|
|
3870
3865
|
if (import_path && !import_path.endsWith(".js") && !import_path.endsWith(".ts")) {
|
|
3871
3866
|
for (const ending of [
|
|
3872
|
-
".js",
|
|
3873
3867
|
".ts",
|
|
3874
|
-
"
|
|
3875
|
-
"/index.ts"
|
|
3876
|
-
|
|
3868
|
+
".js",
|
|
3869
|
+
"/index.ts",
|
|
3870
|
+
"/index.js"
|
|
3871
|
+
]) if (fs.existsSync(path.join(cwd, directory.lib, import_path + ending))) {
|
|
3872
|
+
const specifier = isLibrary ? ending.replace(".ts", ".js") : ending;
|
|
3873
|
+
return match.slice(0, -1) + specifier + match.slice(-1);
|
|
3874
|
+
}
|
|
3877
3875
|
}
|
|
3878
3876
|
return match;
|
|
3879
3877
|
});
|
|
@@ -5020,7 +5020,7 @@ function safeParse(schema, input, config$1) {
|
|
|
5020
5020
|
//#endregion
|
|
5021
5021
|
//#region package.json
|
|
5022
5022
|
var name = "sv";
|
|
5023
|
-
var version = "1.
|
|
5023
|
+
var version = "1.3.0";
|
|
5024
5024
|
//#endregion
|
|
5025
5025
|
//#region src/core/errors.ts
|
|
5026
5026
|
var UnsupportedError = class extends Error {
|
|
@@ -5046,7 +5046,8 @@ const PackageJSONSchema = /* @__PURE__ */ looseObject({
|
|
|
5046
5046
|
/* @__PURE__ */ string(),
|
|
5047
5047
|
/* @__PURE__ */ array(/* @__PURE__ */ string()),
|
|
5048
5048
|
/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ any$1())
|
|
5049
|
-
]))
|
|
5049
|
+
])),
|
|
5050
|
+
scripts: /* @__PURE__ */ optional(StringRecordSchema)
|
|
5050
5051
|
});
|
|
5051
5052
|
const cliOptions = {
|
|
5052
5053
|
noDownloadCheck: new Option("--no-download-check", "do not warn about downloads from community add-ons"),
|
|
@@ -5337,7 +5338,7 @@ function up$1(base, options) {
|
|
|
5337
5338
|
//#region src/create/utils.ts
|
|
5338
5339
|
/**
|
|
5339
5340
|
* @returns an absolute path to the `dist` directory
|
|
5340
|
-
* containing templates
|
|
5341
|
+
* containing templates and add-on content
|
|
5341
5342
|
*
|
|
5342
5343
|
* this function can be called during runtime or devtime
|
|
5343
5344
|
*/
|
|
@@ -5385,11 +5386,6 @@ function copy(from, to, rename = identity, kv = {}) {
|
|
|
5385
5386
|
else fs.copyFileSync(from, to);
|
|
5386
5387
|
}
|
|
5387
5388
|
}
|
|
5388
|
-
function getSharedFiles() {
|
|
5389
|
-
const shared = path.join(dist_dir, "shared.json");
|
|
5390
|
-
const { files } = JSON.parse(fs.readFileSync(shared, "utf-8"));
|
|
5391
|
-
return files;
|
|
5392
|
-
}
|
|
5393
5389
|
//#endregion
|
|
5394
5390
|
//#region src/create/index.ts
|
|
5395
5391
|
const publicTemplateTypes = [
|
|
@@ -5398,22 +5394,10 @@ const publicTemplateTypes = [
|
|
|
5398
5394
|
"library",
|
|
5399
5395
|
"addon"
|
|
5400
5396
|
];
|
|
5401
|
-
const templateTypes = [
|
|
5402
|
-
"minimal",
|
|
5403
|
-
"demo",
|
|
5404
|
-
"library",
|
|
5405
|
-
"addon",
|
|
5406
|
-
"svelte"
|
|
5407
|
-
];
|
|
5408
|
-
const languageTypes = [
|
|
5409
|
-
"typescript",
|
|
5410
|
-
"checkjs",
|
|
5411
|
-
"none"
|
|
5412
|
-
];
|
|
5413
5397
|
function create({ cwd, ...options }) {
|
|
5414
5398
|
mkdirp(cwd);
|
|
5415
5399
|
write_template_files(options.template, options.types, options.name, cwd);
|
|
5416
|
-
if (options.template !== "svelte")
|
|
5400
|
+
if (options.template !== "svelte") finalize_package_json(cwd, options.name);
|
|
5417
5401
|
if (options.template === "addon") for (const name of [
|
|
5418
5402
|
"svelte.config.js",
|
|
5419
5403
|
"svelte.config.ts",
|
|
@@ -5441,41 +5425,14 @@ function write_template_files(template, types, name, cwd) {
|
|
|
5441
5425
|
fs.writeFileSync(dest, replace(file.contents, kv(name)));
|
|
5442
5426
|
});
|
|
5443
5427
|
}
|
|
5444
|
-
function
|
|
5445
|
-
const files = getSharedFiles();
|
|
5428
|
+
function finalize_package_json(cwd, name) {
|
|
5446
5429
|
const pkg_file = path.join(cwd, filePaths.packageJson);
|
|
5447
5430
|
const pkg = JSON.parse(fs.readFileSync(pkg_file, "utf-8"));
|
|
5448
|
-
sort_files(files).forEach((file) => {
|
|
5449
|
-
const include = file.include.every((condition) => matches_condition(condition, options));
|
|
5450
|
-
if (file.exclude.some((condition) => matches_condition(condition, options)) || !include) return;
|
|
5451
|
-
if (file.name === filePaths.packageJson) {
|
|
5452
|
-
const new_pkg = JSON.parse(file.contents);
|
|
5453
|
-
merge(pkg, new_pkg);
|
|
5454
|
-
} else {
|
|
5455
|
-
const dest = path.join(cwd, file.name);
|
|
5456
|
-
mkdirp(path.dirname(dest));
|
|
5457
|
-
fs.writeFileSync(dest, replace(file.contents, kv(name)));
|
|
5458
|
-
}
|
|
5459
|
-
});
|
|
5460
5431
|
pkg.dependencies = sort_keys(pkg.dependencies);
|
|
5461
5432
|
pkg.devDependencies = sort_keys(pkg.devDependencies);
|
|
5462
5433
|
pkg.name = sanitizeName(name, "package");
|
|
5463
5434
|
fs.writeFileSync(pkg_file, JSON.stringify(pkg, null, " ") + "\n");
|
|
5464
5435
|
}
|
|
5465
|
-
function matches_condition(condition, options) {
|
|
5466
|
-
if (templateTypes.includes(condition)) return options.template === condition;
|
|
5467
|
-
if (languageTypes.includes(condition)) return options.types === condition;
|
|
5468
|
-
return Boolean(options[condition]);
|
|
5469
|
-
}
|
|
5470
|
-
function merge(target, source) {
|
|
5471
|
-
for (const key in source) if (key in target) {
|
|
5472
|
-
const target_value = target[key];
|
|
5473
|
-
const source_value = source[key];
|
|
5474
|
-
if (typeof source_value !== typeof target_value || Array.isArray(source_value) !== Array.isArray(target_value)) throw new Error("Mismatched values");
|
|
5475
|
-
if (typeof source_value === "object") merge(target_value, source_value);
|
|
5476
|
-
else target[key] = source_value;
|
|
5477
|
-
} else target[key] = source[key];
|
|
5478
|
-
}
|
|
5479
5436
|
function sort_keys(obj) {
|
|
5480
5437
|
if (!obj) return;
|
|
5481
5438
|
return Object.keys(obj).sort().reduce((sorted, key) => {
|
|
@@ -5483,17 +5440,6 @@ function sort_keys(obj) {
|
|
|
5483
5440
|
return sorted;
|
|
5484
5441
|
}, {});
|
|
5485
5442
|
}
|
|
5486
|
-
/**
|
|
5487
|
-
* Sort files so that those which apply more generically come first so they
|
|
5488
|
-
* can be overwritten by files for more precise cases later.
|
|
5489
|
-
*/
|
|
5490
|
-
function sort_files(files) {
|
|
5491
|
-
return files.sort((f1, f2) => {
|
|
5492
|
-
const f1_more_generic = f1.include.every((include) => f2.include.includes(include)) && f1.exclude.every((exclude) => f2.exclude.includes(exclude));
|
|
5493
|
-
const f2_more_generic = f2.include.every((include) => f1.include.includes(include)) && f2.exclude.every((exclude) => f1.exclude.includes(exclude));
|
|
5494
|
-
return f1_more_generic && f2_more_generic || !f1_more_generic && !f2_more_generic ? 0 : f1_more_generic ? -1 : 1;
|
|
5495
|
-
});
|
|
5496
|
-
}
|
|
5497
5443
|
//#endregion
|
|
5498
5444
|
//#region ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
|
|
5499
5445
|
const isPathLikePattern = /^path$/i;
|
|
@@ -6489,4 +6435,4 @@ function orderAddons(addons, setupResults) {
|
|
|
6489
6435
|
return ordered;
|
|
6490
6436
|
}
|
|
6491
6437
|
//#endregion
|
|
6492
|
-
export {
|
|
6438
|
+
export { parse$1 as $, cliOptions as A, runAndValidateVerifications as B, create as C, __toESM as Ct, from as D, up$1 as E, getPadding as F, UnsupportedError as G, updateAgent as H, helpConfig as I, array as J, name as K, isNodeError as L, filePaths as M, forwardExitCode as N, PackageJSONSchema as O, getHelpSections as P, optional as Q, normalizePosix as R, execSync as S, __require as St, dist_dir as T, updateLibraryBuild as U, runCommand as V, updateReadme as W, literal as X, boolean as Y, nonEmpty as Z, defineAddon as _, pe as _t, setupAddons as a, string as at, NonZeroExitError as b, R$1 as bt, AGENT_NAMES as c, program as ct, detectPackageManager as d, Ce as dt, picklist as et, installDependencies as f, Ee as ft, createLoadedAddon as g, le as gt, up as h, ge as ht, prepareSvApi as i, strictObject as it, errorAndExit as j, buildAndLogArgs as k, addAllowBuildsIfPnpm as l, Command as lt, packageManagerPrompt as m, Re as mt, applyAddons as n, record as nt, createWorkspace as o, transform as ot, installOption as p, R as pt, version as q, orderAddons as r, safeParse as rt, findWorkspaceRoot as s, union as st, add as t, pipe as tt, addEngineStrict as u, Option as ut, defineAddonOptions as v, vt, templates as w, exec as x, __commonJSMin as xt, getErrorHint as y, we as yt, parseAddonOptions as z };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import favicon from '#lib/assets/favicon.svg';
|
|
3
|
+
|
|
4
|
+
let { children } = $props();
|
|
5
|
+
|
|
6
|
+
const title = '$sv-title-$sv';
|
|
7
|
+
const href = '$sv-url-$sv';
|
|
8
|
+
|
|
9
|
+
let prefersDark = $state(true);
|
|
10
|
+
let isDark = $state(true);
|
|
11
|
+
|
|
12
|
+
function switchTheme() {
|
|
13
|
+
const value = isDark ? 'light' : 'dark';
|
|
14
|
+
|
|
15
|
+
isDark = value === 'dark';
|
|
16
|
+
localStorage.setItem('sv:theme', isDark === prefersDark ? 'system' : value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$effect(() => {
|
|
20
|
+
document.documentElement.classList.remove('light', 'dark');
|
|
21
|
+
prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
22
|
+
|
|
23
|
+
const theme = localStorage.getItem('sv:theme');
|
|
24
|
+
|
|
25
|
+
isDark = !theme ? prefersDark : theme === 'dark' || (theme === 'system' && prefersDark);
|
|
26
|
+
document.documentElement.classList.add(isDark ? 'dark' : 'light');
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<svelte:head>
|
|
31
|
+
<title>--from-playground {title}</title>
|
|
32
|
+
<script>
|
|
33
|
+
{
|
|
34
|
+
const theme = localStorage.getItem('sv:theme');
|
|
35
|
+
|
|
36
|
+
document.documentElement.classList.add(
|
|
37
|
+
!theme || theme === 'system'
|
|
38
|
+
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
39
|
+
? 'dark'
|
|
40
|
+
: 'light'
|
|
41
|
+
: theme
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
</svelte:head>
|
|
46
|
+
|
|
47
|
+
<div class="layout">
|
|
48
|
+
<nav class="navbar">
|
|
49
|
+
<div class="nav-left">
|
|
50
|
+
<a href="/" class="svelte-icon">
|
|
51
|
+
<img src={favicon} alt="Svelte" width="32" height="32" />
|
|
52
|
+
</a>
|
|
53
|
+
<p class="title">{title}</p>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="nav-right">
|
|
56
|
+
<a {href} class="raised" target="_blank" rel="noopener noreferrer">
|
|
57
|
+
--to-playground
|
|
58
|
+
<span aria-hidden="true" style="margin-left:0.25em;"> ↗</span>
|
|
59
|
+
</a>
|
|
60
|
+
<button class="raised theme-toggle" onclick={switchTheme} aria-label="Toggle theme">
|
|
61
|
+
<span class="icon"></span>
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
</nav>
|
|
65
|
+
|
|
66
|
+
<main class="content">
|
|
67
|
+
{@render children()}
|
|
68
|
+
</main>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
:global(body) {
|
|
73
|
+
margin: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:global(html) {
|
|
77
|
+
margin: 0;
|
|
78
|
+
--bg-1: hsl(0, 0%, 100%);
|
|
79
|
+
--bg-2: hsl(206, 20%, 90%);
|
|
80
|
+
--bg-3: hsl(206, 20%, 80%);
|
|
81
|
+
--navbar-bg: #fff;
|
|
82
|
+
--fg-1: hsl(0, 0%, 13%);
|
|
83
|
+
--fg-2: hsl(0, 0%, 50%);
|
|
84
|
+
--fg-3: hsl(0, 0%, 60%);
|
|
85
|
+
--link: hsl(208, 77%, 47%);
|
|
86
|
+
--border-radius: 4px;
|
|
87
|
+
--font:
|
|
88
|
+
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
89
|
+
'Helvetica Neue', sans-serif;
|
|
90
|
+
color-scheme: light;
|
|
91
|
+
background: var(--bg-1);
|
|
92
|
+
color: var(--fg-1);
|
|
93
|
+
font-family: var(--font);
|
|
94
|
+
line-height: 1.5;
|
|
95
|
+
height: calc(100vh - 2rem);
|
|
96
|
+
accent-color: var(--link) !important;
|
|
97
|
+
min-height: 100vh;
|
|
98
|
+
background-color: var(--bg-1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:global(html.dark) {
|
|
102
|
+
color-scheme: dark;
|
|
103
|
+
--bg-1: hsl(0, 0%, 18%);
|
|
104
|
+
--bg-2: hsl(0, 0%, 30%);
|
|
105
|
+
--bg-3: hsl(0, 0%, 40%);
|
|
106
|
+
--navbar-bg: hsl(220, 14%, 16%);
|
|
107
|
+
--fg-1: hsl(0, 0%, 75%);
|
|
108
|
+
--fg-2: hsl(0, 0%, 40%);
|
|
109
|
+
--fg-3: hsl(0, 0%, 30%);
|
|
110
|
+
--link: hsl(206, 96%, 72%);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.navbar {
|
|
114
|
+
color: var(--fg-1);
|
|
115
|
+
display: flex;
|
|
116
|
+
justify-content: space-between;
|
|
117
|
+
align-items: center;
|
|
118
|
+
padding: 0em 2.5rem;
|
|
119
|
+
height: 3.7rem;
|
|
120
|
+
background-color: var(--navbar-bg);
|
|
121
|
+
box-shadow:
|
|
122
|
+
0 2px 8px 0 rgba(0, 0, 0, 0.08),
|
|
123
|
+
0 1.5px 4px 0 rgba(0, 0, 0, 0.04);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.nav-left {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: 0.5rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.svelte-icon {
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
text-decoration: none;
|
|
136
|
+
transition: opacity 0.2s ease;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.svelte-icon:hover {
|
|
140
|
+
opacity: 0.8;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.title {
|
|
144
|
+
font-size: 1.5rem;
|
|
145
|
+
font-weight: 400;
|
|
146
|
+
margin: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.nav-right {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 1rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.raised {
|
|
156
|
+
background: var(--navbar-bg);
|
|
157
|
+
border-left: 0.5px solid var(--fg-3);
|
|
158
|
+
border-top: 0.5px solid var(--fg-3);
|
|
159
|
+
border-bottom: none;
|
|
160
|
+
border-right: none;
|
|
161
|
+
border-radius: var(--border-radius);
|
|
162
|
+
color: var(--fg-1);
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
transition: all 0.2s ease;
|
|
165
|
+
box-shadow:
|
|
166
|
+
0 2px 4px rgba(0, 0, 0, 0.1),
|
|
167
|
+
0 1px 2px rgba(0, 0, 0, 0.06);
|
|
168
|
+
text-decoration: none;
|
|
169
|
+
font-weight: 500;
|
|
170
|
+
padding: 0.25rem 0.75rem;
|
|
171
|
+
font-size: 0.8rem;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.raised:hover {
|
|
175
|
+
border-left-color: var(--fg-2);
|
|
176
|
+
border-top-color: var(--fg-2);
|
|
177
|
+
box-shadow:
|
|
178
|
+
0 4px 8px rgba(0, 0, 0, 0.15),
|
|
179
|
+
0 2px 4px rgba(0, 0, 0, 0.1);
|
|
180
|
+
transform: translate(-1px, -1px);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.content {
|
|
184
|
+
padding: 1rem;
|
|
185
|
+
color: var(--fg-1);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.theme-toggle {
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
width: 1.8rem;
|
|
193
|
+
height: 1.8rem;
|
|
194
|
+
padding: 0;
|
|
195
|
+
min-width: 2rem;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.icon {
|
|
199
|
+
display: inline-block;
|
|
200
|
+
width: 1.5rem;
|
|
201
|
+
height: 1.5rem;
|
|
202
|
+
-webkit-mask-size: 1.5rem;
|
|
203
|
+
mask-size: 1.5rem;
|
|
204
|
+
-webkit-mask-repeat: no-repeat;
|
|
205
|
+
mask-repeat: no-repeat;
|
|
206
|
+
-webkit-mask-position: center;
|
|
207
|
+
mask-position: center;
|
|
208
|
+
background-color: var(--fg-1);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.icon {
|
|
212
|
+
mask-image: url('data:image/svg+xml,%3csvg%20xmlns="http://www.w3.org/2000/svg"%20viewBox="0%200%2024%2024"%3e%3cpath%20fill="%23666"%20d="M12%2021q-3.775%200-6.388-2.613T3%2012q0-3.45%202.25-5.988T11%203.05q.625-.075.975.45t-.025%201.1q-.425.65-.638%201.375T11.1%207.5q0%202.25%201.575%203.825T16.5%2012.9q.775%200%201.538-.225t1.362-.625q.525-.35%201.075-.037t.475.987q-.35%203.45-2.937%205.725T12%2021Zm0-2q2.2%200%203.95-1.213t2.55-3.162q-.5.125-1%20.2t-1%20.075q-3.075%200-5.238-2.163T9.1%207.5q0-.5.075-1t.2-1q-1.95.8-3.163%202.55T5%2012q0%202.9%202.05%204.95T12%2019Zm-.25-6.75Z"/%3e%3c/svg%3e');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
:global(html.dark) .icon {
|
|
216
|
+
mask-image: url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23d4d4d4'%20d='M12%2019a1%201%200%200%201%20.993.883L13%2020v1a1%201%200%200%201-1.993.117L11%2021v-1a1%201%200%200%201%201-1zm6.313-2.09.094.083.7.7a1%201%200%200%201-1.32%201.497l-.094-.083-.7-.7a1%201%200%200%201%201.218-1.567l.102.07zm-11.306.083a1%201%200%200%201%20.083%201.32l-.083.094-.7.7a1%201%200%200%201-1.497-1.32l.083-.094.7-.7a1%201%200%200%201%201.414%200zM4%2011a1%201%200%200%201%20.117%201.993L4%2013H3a1%201%200%200%201-.117-1.993L3%2011h1zm17%200a1%201%200%200%201%20.117%201.993L21%2013h-1a1%201%200%200%201-.117-1.993L20%2011h1zM6.213%204.81l.094.083.7.7a1%201%200%200%201-1.32%201.497l-.094-.083-.7-.7A1%201%200%200%201%206.11%204.74l.102.07zm12.894.083a1%201%200%200%201%20.083%201.32l-.083.094-.7.7a1%201%200%200%201-1.497-1.32l.083-.094.7-.7a1%201%200%200%201%201.414%200zM12%202a1%201%200%200%201%20.993.883L13%203v1a1%201%200%200%201-1.993.117L11%204V3a1%201%200%200%201%201-1zm0%205a5%205%200%201%201-4.995%205.217L7%2012l.005-.217A5%205%200%200%201%2012%207z'/%3e%3c/svg%3e");
|
|
217
|
+
}
|
|
218
|
+
</style>
|
package/dist/src/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { A as SelectQuestion, C as BaseQuestion, D as OptionDefinition, E as NumberQuestion, M as ADDON_IDS, O as OptionValues, S as AddonOptions, T as MultiSelectQuestion, _ as SvApi, a as Addon, b as Workspace, c as AddonReference, d as ConditionDefinition, f as ConfiguredAddon, g as SetupResult, h as PreparedAddon, i as add, j as StringQuestion, k as Question, l as AddonResult, m as OptionBuilder, n as InstallOptions, o as AddonDefinition, p as LoadedAddon, r as OptionMap, s as AddonInput, t as AddonMap, u as AddonSource, v as defineAddon, w as BooleanQuestion, x as WorkspaceOptions, y as defineAddonOptions } from "../engine-fNvU_-IL.mjs";
|
|
2
2
|
//#region src/create/index.d.ts
|
|
3
|
-
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
declare const languageTypes: readonly ["typescript", "checkjs", "none"];
|
|
3
|
+
declare const publicTemplateTypes: readonly ["minimal", "demo", "library", "addon"];
|
|
4
|
+
type TemplateType = (typeof publicTemplateTypes)[number] | "svelte";
|
|
5
|
+
type LanguageType = "typescript" | "checkjs" | "none";
|
|
7
6
|
type Options = {
|
|
8
7
|
cwd: string;
|
|
9
8
|
name: string;
|
|
@@ -18,6 +17,7 @@ type AiToolsOptions = {
|
|
|
18
17
|
delivery: "plugin" | "tools";
|
|
19
18
|
tools: string[];
|
|
20
19
|
mcpSetup: "local" | "remote";
|
|
20
|
+
optInSkills: string[];
|
|
21
21
|
};
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/addons/better-auth.d.ts
|
package/dist/src/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as create, _ as defineAddon, t as add, v as defineAddonOptions } from "../engine-
|
|
2
|
-
import { n as officialAddons } from "../addons-
|
|
1
|
+
import { C as create, _ as defineAddon, t as add, v as defineAddonOptions } from "../engine-S8UpCG24.mjs";
|
|
2
|
+
import { n as officialAddons } from "../addons-BCioxI2r.mjs";
|
|
3
3
|
export { add, create, defineAddon, defineAddonOptions, officialAddons };
|
package/dist/src/testing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as create, Ct as
|
|
1
|
+
import { C as create, Ct as __toESM, S as execSync, St as __require, l as addAllowBuildsIfPnpm, t as add, x as exec, xt as __commonJSMin } from "../engine-S8UpCG24.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import V from "node:process";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Contributing Guide
|
|
2
|
+
|
|
3
|
+
Cheatsheet: [All official add-ons source code](https://github.com/sveltejs/cli/tree/main/packages/sv/src/addons)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Some convenient scripts are provided to help develop the add-on.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
## create a new minimal project in the `demo` directory
|
|
11
|
+
npm run demo-create
|
|
12
|
+
|
|
13
|
+
## add your current add-on to the demo project
|
|
14
|
+
npm run demo-add
|
|
15
|
+
|
|
16
|
+
## run the tests
|
|
17
|
+
npm run test
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Key things to note
|
|
21
|
+
|
|
22
|
+
Your `add-on` should:
|
|
23
|
+
|
|
24
|
+
- export a function that returns a `defineAddon` object.
|
|
25
|
+
- have a `package.json` with an `exports` field that points to the main entry point of the add-on.
|
|
26
|
+
|
|
27
|
+
## Building
|
|
28
|
+
|
|
29
|
+
Your add-on is bundled with [tsdown](https://tsdown.dev/) into a single file in `dist/`. This bundles everything except `sv` (which is a peer dependency provided at runtime).
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm run build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Publishing
|
|
36
|
+
|
|
37
|
+
When you're ready to publish your add-on to npm:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm login
|
|
41
|
+
npm publish
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> `prepublishOnly` will automatically run the build before publishing.
|
|
45
|
+
|
|
46
|
+
## Things to be aware of
|
|
47
|
+
|
|
48
|
+
Community add-ons must have `sv` as a `peerDependency`. Any `dependencies` declared in `package.json` will not be available at runtime. Everything else (including `@sveltejs/sv-utils`) is bundled at build time by tsdown.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# [sv](https://svelte.dev/docs/cli/overview) community add-on: [$SV-NAME-TODO$](https://github.com/$SV-NAME-TODO$)
|
|
2
|
+
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> Svelte maintainers have not reviewed community add-ons for malicious code! Use at your discretion.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
To install the add-on, run:
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
npx sv add $SV-PROTOCOL-NAME-TODO$
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What you get [TO BE FILLED...]
|
|
15
|
+
|
|
16
|
+
- A super cool stuff
|
|
17
|
+
- Another one!
|
|
18
|
+
|
|
19
|
+
## Options [TO BE FILLED...]
|
|
20
|
+
|
|
21
|
+
### `who`
|
|
22
|
+
|
|
23
|
+
The name of the person to say hello to.
|
|
24
|
+
|
|
25
|
+
Default: `you`
|
|
26
|
+
|
|
27
|
+
```shell
|
|
28
|
+
npx sv add $SV-PROTOCOL-NAME-TODO$="who:your-name"
|
|
29
|
+
```
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
[
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "jsconfig.json",
|
|
4
|
+
"contents": "{\n\t\"compilerOptions\": {\n\t\t\"strict\": true,\n\t\t\"skipLibCheck\": true,\n\t\t\"checkJs\": true,\n\t\t\"module\": \"NodeNext\",\n\t\t\"moduleResolution\": \"NodeNext\"\n\t}\n}\n"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"name": "package.json",
|
|
8
|
+
"contents": "{\n\t\"name\": \"$SV-NAME-TODO$\",\n\t\"version\": \"0.0.1\",\n\t\"description\": \"sv add-on for $SV-NAME-TODO$\",\n\t\"keywords\": [\n\t\t\"sv-add\",\n\t\t\"svelte\",\n\t\t\"sveltekit\"\n\t],\n\t\"license\": \"MIT\",\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"type\": \"module\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"default\": \"./dist/index.mjs\"\n\t\t}\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"scripts\": {\n\t\t\"demo-create\": \"sv create demo --types ts --template minimal --no-add-ons --no-install\",\n\t\t\"demo-add\": \"pnpm build && sv add file:../ --cwd demo --no-git-check --no-install\",\n\t\t\"demo-add:ci\": \"pnpm build && sv add file:../=who:you --cwd demo --no-git-check --no-download-check --no-install\",\n\t\t\"build\": \"tsdown\",\n\t\t\"prepublishOnly\": \"npm run build\",\n\t\t\"test\": \"vitest run\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"^1.60.0\",\n\t\t\"@sveltejs/sv-utils\": \"^1.1.0\",\n\t\t\"@types/node\": \"^25.9.1\",\n\t\t\"sv\": \"^1.3.0\",\n\t\t\"tsdown\": \"^0.22.1\",\n\t\t\"vitest\": \"^4.1.8\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"sv\": \"^1.3.0\"\n\t}\n}\n"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
[
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "jsconfig.json",
|
|
4
|
+
"contents": "{\n\t\"compilerOptions\": {\n\t\t\"strict\": true,\n\t\t\"skipLibCheck\": true,\n\t\t\"checkJs\": true,\n\t\t\"module\": \"NodeNext\",\n\t\t\"moduleResolution\": \"NodeNext\"\n\t}\n}\n"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"name": "package.json",
|
|
8
|
+
"contents": "{\n\t\"name\": \"$SV-NAME-TODO$\",\n\t\"version\": \"0.0.1\",\n\t\"description\": \"sv add-on for $SV-NAME-TODO$\",\n\t\"keywords\": [\n\t\t\"sv-add\",\n\t\t\"svelte\",\n\t\t\"sveltekit\"\n\t],\n\t\"license\": \"MIT\",\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"type\": \"module\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"default\": \"./dist/index.mjs\"\n\t\t}\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"scripts\": {\n\t\t\"demo-create\": \"sv create demo --types ts --template minimal --no-add-ons --no-install\",\n\t\t\"demo-add\": \"pnpm build && sv add file:../ --cwd demo --no-git-check --no-install\",\n\t\t\"demo-add:ci\": \"pnpm build && sv add file:../=who:you --cwd demo --no-git-check --no-download-check --no-install\",\n\t\t\"build\": \"tsdown\",\n\t\t\"prepublishOnly\": \"npm run build\",\n\t\t\"test\": \"vitest run\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"^1.60.0\",\n\t\t\"@sveltejs/sv-utils\": \"^1.1.0\",\n\t\t\"@types/node\": \"^25.9.1\",\n\t\t\"sv\": \"^1.3.0\",\n\t\t\"tsdown\": \"^0.22.1\",\n\t\t\"vitest\": \"^4.1.8\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"sv\": \"^1.3.0\"\n\t}\n}\n"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
[
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "tsconfig.json",
|
|
4
|
+
"contents": "{\n\t\"compilerOptions\": {\n\t\t\"strict\": true,\n\t\t\"skipLibCheck\": true,\n\t\t\"checkJs\": true,\n\t\t\"module\": \"NodeNext\",\n\t\t\"moduleResolution\": \"NodeNext\"\n\t}\n}\n"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"name": "package.json",
|
|
8
|
+
"contents": "{\n\t\"name\": \"$SV-NAME-TODO$\",\n\t\"version\": \"0.0.1\",\n\t\"description\": \"sv add-on for $SV-NAME-TODO$\",\n\t\"keywords\": [\n\t\t\"sv-add\",\n\t\t\"svelte\",\n\t\t\"sveltekit\"\n\t],\n\t\"license\": \"MIT\",\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"type\": \"module\",\n\t\"exports\": {\n\t\t\".\": {\n\t\t\t\"default\": \"./dist/index.mjs\"\n\t\t}\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"scripts\": {\n\t\t\"demo-create\": \"sv create demo --types ts --template minimal --no-add-ons --no-install\",\n\t\t\"demo-add\": \"pnpm build && sv add file:../ --cwd demo --no-git-check --no-install\",\n\t\t\"demo-add:ci\": \"pnpm build && sv add file:../=who:you --cwd demo --no-git-check --no-download-check --no-install\",\n\t\t\"build\": \"tsdown\",\n\t\t\"prepublishOnly\": \"npm run build\",\n\t\t\"test\": \"vitest run\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"^1.60.0\",\n\t\t\"@sveltejs/sv-utils\": \"^1.1.0\",\n\t\t\"@types/node\": \"^25.9.1\",\n\t\t\"sv\": \"^1.3.0\",\n\t\t\"tsdown\": \"^0.22.1\",\n\t\t\"vitest\": \"^4.1.8\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"sv\": \"^1.3.0\"\n\t}\n}\n"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "$SV-NAME-TODO$",
|
|
3
|
-
"description": "sv add-on for $SV-NAME-TODO$",
|
|
4
3
|
"version": "0.0.1",
|
|
5
|
-
"
|
|
4
|
+
"description": "sv add-on for $SV-NAME-TODO$",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sv-add",
|
|
7
|
+
"svelte",
|
|
8
|
+
"sveltekit"
|
|
9
|
+
],
|
|
6
10
|
"license": "MIT",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"build": "tsdown",
|
|
12
|
-
"prepublishOnly": "npm run build",
|
|
13
|
-
"test": "vitest run"
|
|
14
|
-
},
|
|
15
|
-
"files": ["dist"],
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
16
15
|
"exports": {
|
|
17
16
|
".": {
|
|
18
17
|
"default": "./dist/index.mjs"
|
|
@@ -21,16 +20,23 @@
|
|
|
21
20
|
"publishConfig": {
|
|
22
21
|
"access": "public"
|
|
23
22
|
},
|
|
24
|
-
"
|
|
25
|
-
"
|
|
23
|
+
"scripts": {
|
|
24
|
+
"demo-create": "sv create demo --types ts --template minimal --no-add-ons --no-install",
|
|
25
|
+
"demo-add": "pnpm build && sv add file:../ --cwd demo --no-git-check --no-install",
|
|
26
|
+
"demo-add:ci": "pnpm build && sv add file:../=who:you --cwd demo --no-git-check --no-download-check --no-install",
|
|
27
|
+
"build": "tsdown",
|
|
28
|
+
"prepublishOnly": "npm run build",
|
|
29
|
+
"test": "vitest run"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
28
|
-
"sv": "^1.2.0",
|
|
29
|
-
"@sveltejs/sv-utils": "^1.1.0",
|
|
30
32
|
"@playwright/test": "^1.60.0",
|
|
33
|
+
"@sveltejs/sv-utils": "^1.1.0",
|
|
31
34
|
"@types/node": "^25.9.1",
|
|
35
|
+
"sv": "^1.3.0",
|
|
32
36
|
"tsdown": "^0.22.1",
|
|
33
37
|
"vitest": "^4.1.8"
|
|
34
38
|
},
|
|
35
|
-
"
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"sv": "^1.3.0"
|
|
41
|
+
}
|
|
36
42
|
}
|