@canonical/summon-application 0.47.0 → 0.48.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 +38 -1
- package/dist/esm/application/svelte/index.js +191 -0
- package/dist/esm/application/svelte/index.js.map +1 -0
- package/dist/esm/application/svelte/templates/.storybook/main.ts.ejs +2 -0
- package/dist/esm/application/svelte/templates/.storybook/preview.ts.ejs +3 -0
- package/dist/esm/application/svelte/templates/README.md.ejs +45 -0
- package/dist/esm/application/svelte/templates/gitignore.ejs +8 -0
- package/dist/esm/application/svelte/templates/package.json.ejs +40 -0
- package/dist/esm/application/svelte/templates/scripts/copy-icons.js.ejs +9 -0
- package/dist/esm/application/svelte/templates/src/app.d.ts.ejs +6 -0
- package/dist/esm/application/svelte/templates/src/app.html.ejs +11 -0
- package/dist/esm/application/svelte/templates/src/hooks.server.ts.ejs +13 -0
- package/dist/esm/application/svelte/templates/src/lib/ContactExample.stories.svelte.ejs +11 -0
- package/dist/esm/application/svelte/templates/src/lib/ContactExample.svelte.ejs +19 -0
- package/dist/esm/application/svelte/templates/src/lib/DashboardNavigation.svelte.ejs +17 -0
- package/dist/esm/application/svelte/templates/src/lib/ProjectDanger.svelte.ejs +18 -0
- package/dist/esm/application/svelte/templates/src/lib/Welcome.stories.svelte.ejs +5 -0
- package/dist/esm/application/svelte/templates/src/lib/catalog.ts.ejs +5 -0
- package/dist/esm/application/svelte/templates/src/lib/contact.ts.ejs +19 -0
- package/dist/esm/application/svelte/templates/src/lib/i18n.ts.ejs +351 -0
- package/dist/esm/application/svelte/templates/src/lib/instances.ts.ejs +16 -0
- package/dist/esm/application/svelte/templates/src/lib/resolveReturnTo.ts.ejs +11 -0
- package/dist/esm/application/svelte/templates/src/lib/settings.ts.ejs +28 -0
- package/dist/esm/application/svelte/templates/src/routes/+error.svelte.ejs +9 -0
- package/dist/esm/application/svelte/templates/src/routes/+layout.server.ts.ejs +2 -0
- package/dist/esm/application/svelte/templates/src/routes/+layout.svelte.ejs +85 -0
- package/dist/esm/application/svelte/templates/src/routes/+layout.ts.ejs +1 -0
- package/dist/esm/application/svelte/templates/src/routes/+page.svelte.ejs +9 -0
- package/dist/esm/application/svelte/templates/src/routes/account/+page.server.ts.ejs +13 -0
- package/dist/esm/application/svelte/templates/src/routes/account/+page.svelte.ejs +20 -0
- package/dist/esm/application/svelte/templates/src/routes/catalog/+page.svelte.ejs +12 -0
- package/dist/esm/application/svelte/templates/src/routes/catalog/[id]/+page.server.ts.ejs +8 -0
- package/dist/esm/application/svelte/templates/src/routes/catalog/[id]/+page.svelte.ejs +13 -0
- package/dist/esm/application/svelte/templates/src/routes/catalog/[id]/+page.ts.ejs +8 -0
- package/dist/esm/application/svelte/templates/src/routes/contact/+page.server.ts.ejs +11 -0
- package/dist/esm/application/svelte/templates/src/routes/contact/+page.svelte.ejs +85 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/+layout.svelte.ejs +15 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/+page.server.ts.ejs +5 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/+page.svelte.ejs +33 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/instances/+page.server.ts.ejs +23 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/instances/+page.svelte.ejs +101 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/instances/remove/+page.server.ts.ejs +19 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/instances/remove/+page.svelte.ejs +11 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/settings/+page.server.ts.ejs +13 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/settings/+page.svelte.ejs +52 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/settings/confirm/+page.server.ts.ejs +2 -0
- package/dist/esm/application/svelte/templates/src/routes/dashboard/settings/confirm/+page.svelte.ejs +13 -0
- package/dist/esm/application/svelte/templates/src/routes/home/+server.ts.ejs +2 -0
- package/dist/esm/application/svelte/templates/src/routes/language/+server.ts.ejs +12 -0
- package/dist/esm/application/svelte/templates/src/routes/login/+page.server.ts.ejs +8 -0
- package/dist/esm/application/svelte/templates/src/routes/login/+page.svelte.ejs +11 -0
- package/dist/esm/application/svelte/templates/src/routes/preferences/+server.ts.ejs +10 -0
- package/dist/esm/application/svelte/templates/src/routes/sitemap.xml/+server.ts.ejs +7 -0
- package/dist/esm/application/svelte/templates/src/styles.css.ejs +28 -0
- package/dist/esm/application/svelte/templates/svelte.config.js.ejs +7 -0
- package/dist/esm/application/svelte/templates/test/app.test.js.ejs +142 -0
- package/dist/esm/application/svelte/templates/test/contact.browser.test.js.ejs +279 -0
- package/dist/esm/application/svelte/templates/tsconfig.json.ejs +15 -0
- package/dist/esm/application/svelte/templates/vite.config.ts.ejs +4 -0
- package/dist/esm/domain/index.js +39 -5
- package/dist/esm/domain/index.js.map +1 -1
- package/dist/esm/domain/templates/Page.svelte.ejs +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/page/index.js +44 -7
- package/dist/esm/page/index.js.map +1 -1
- package/dist/esm/page/templates/Page.svelte.ejs +2 -0
- package/dist/esm/wrapper/index.js +38 -5
- package/dist/esm/wrapper/index.js.map +1 -1
- package/dist/esm/wrapper/templates/Layout.svelte.ejs +5 -0
- package/dist/types/application/svelte/index.d.ts +12 -0
- package/dist/types/application/svelte/index.d.ts.map +1 -0
- package/dist/types/domain/index.d.ts +2 -1
- package/dist/types/domain/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/page/index.d.ts +1 -0
- package/dist/types/page/index.d.ts.map +1 -1
- package/dist/types/wrapper/index.d.ts +2 -1
- package/dist/types/wrapper/index.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
import { after, before, test } from "node:test";
|
|
6
|
+
|
|
7
|
+
<% if (!spa) { %>let server;
|
|
8
|
+
let base;
|
|
9
|
+
before(async () => {
|
|
10
|
+
const socket = createServer();
|
|
11
|
+
await new Promise((resolve) => socket.listen(0, "127.0.0.1", resolve));
|
|
12
|
+
const { port } = socket.address();
|
|
13
|
+
await new Promise((resolve, reject) => socket.close((error) => error ? reject(error) : resolve()));
|
|
14
|
+
base = `http://127.0.0.1:${port}`;
|
|
15
|
+
server = spawn(process.env.SERVER_RUNTIME === "bun" ? "bun" : process.execPath, ["build/index.js"], { env: { ...process.env, HOST: "127.0.0.1", PORT: String(port), ORIGIN: base }, stdio: "ignore" });
|
|
16
|
+
for (let attempt = 0; attempt < 100; attempt++) {
|
|
17
|
+
if (server.exitCode !== null) throw new Error("Server exited");
|
|
18
|
+
try { if ((await fetch(base)).ok) return; } catch { /* Await startup. */ }
|
|
19
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
20
|
+
}
|
|
21
|
+
throw new Error("Server did not start; run the build first");
|
|
22
|
+
});
|
|
23
|
+
after(() => server?.kill());
|
|
24
|
+
|
|
25
|
+
test("server renders routes, theme, assets and sitemap", async () => {
|
|
26
|
+
const request = (path, options = {}) => fetch(new URL(path, base), { redirect: "manual", ...options });
|
|
27
|
+
const dark = await request("/", { headers: { cookie: "theme=dark" } });
|
|
28
|
+
assert.match(await dark.text(), /class="app comfortable dark"/);
|
|
29
|
+
assert.equal(dark.headers.get("cache-control"), "private, no-store");
|
|
30
|
+
assert.equal((await request("/home")).status, 301);
|
|
31
|
+
assert.equal((await request("/missing")).status, 404);
|
|
32
|
+
assert.equal((await request("/catalog/missing")).status, 404);
|
|
33
|
+
assert.equal((await request("/icons/information.svg")).status, 200);
|
|
34
|
+
const product = await (await request("/catalog/compute")).text();
|
|
35
|
+
assert.match(product, /class="ds breadcrumbs"/);
|
|
36
|
+
assert.match(await (await request("/sitemap.xml")).text(), /\/catalog\/compute/);
|
|
37
|
+
const [alice, bob] = await Promise.all(["Alice", "Bob"].map((visitor) => request("/catalog/compute", { headers: { cookie: `visitor=${visitor}` } }).then((response) => response.text())));
|
|
38
|
+
assert.match(alice, /Viewing as Alice/); assert.doesNotMatch(alice, /Viewing as Bob/); assert.match(bob, /Viewing as Bob/);
|
|
39
|
+
<% if (intl) { %> assert.match(await (await request("/", { headers: { cookie: "locale=ar" } })).text(), /lang="ar" dir="rtl"/);
|
|
40
|
+
assert.match(await (await request("/catalog", { headers: { cookie: "locale=ar" } })).text(), /منتجان/);
|
|
41
|
+
assert.match(await (await request("/catalog", { headers: { cookie: "locale=fr" } })).text(), /2 produits/);
|
|
42
|
+
<% } %>});
|
|
43
|
+
|
|
44
|
+
test("preference redirects remain same-origin for hostile referrers", async () => {
|
|
45
|
+
const endpoints = ["preferences"<% if (intl) { %>, "language"<% } %>];
|
|
46
|
+
const referrers = [
|
|
47
|
+
[`${base}/catalog/compute?view=detail`, "/catalog/compute?view=detail"],
|
|
48
|
+
[`${base}//evil.test/path`, "//evil.test/path"],
|
|
49
|
+
[`${base}/\\evil.test/path`, "//evil.test/path"],
|
|
50
|
+
[`${base}/%2f%2fevil.test/path`, "/%2f%2fevil.test/path"],
|
|
51
|
+
[`${base}/%5cevil.test/path`, "/%5cevil.test/path"],
|
|
52
|
+
["https://evil.test/path", "/"],
|
|
53
|
+
["//evil.test/path", "/"],
|
|
54
|
+
["http://[invalid", "/"],
|
|
55
|
+
["", "/"],
|
|
56
|
+
];
|
|
57
|
+
for (const endpoint of endpoints) {
|
|
58
|
+
for (const [referer, expected] of referrers) {
|
|
59
|
+
const response = await fetch(`${base}/${endpoint}`, {
|
|
60
|
+
method: "POST", redirect: "manual",
|
|
61
|
+
headers: { origin: base, referer, "content-type": "application/x-www-form-urlencoded" },
|
|
62
|
+
body: endpoint === "language" ? "locale=fr" : "theme=dark",
|
|
63
|
+
});
|
|
64
|
+
assert.equal(response.status, 303, `${endpoint} ${referer}`);
|
|
65
|
+
const location = response.headers.get("location");
|
|
66
|
+
const resolved = new URL(location, base);
|
|
67
|
+
assert.equal(resolved.origin, base, `${endpoint} ${referer}: ${location}`);
|
|
68
|
+
assert.equal(resolved.pathname + resolved.search, expected, `${endpoint} ${referer}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
<% if (forms) { %>
|
|
73
|
+
test("contact action validates and preserves values", async () => {
|
|
74
|
+
const post = (body) => fetch(`${base}/contact`, { method: "POST", headers: { origin: base, accept: "text/html", "content-type": "application/x-www-form-urlencoded" }, body });
|
|
75
|
+
const invalid = await post("email=bad&message=Draft");
|
|
76
|
+
assert.equal(invalid.status, 400);
|
|
77
|
+
const html = await invalid.text(); assert.match(html, /email-error/); assert.match(html, /Draft/);
|
|
78
|
+
const both = await post("email=&message=");
|
|
79
|
+
assert.equal(both.status, 400);
|
|
80
|
+
const bothHtml = await both.text();
|
|
81
|
+
assert.match(bothHtml, /id="email-error"/); assert.match(bothHtml, /id="message-error"/);
|
|
82
|
+
for (const name of ["email", "message"]) {
|
|
83
|
+
const control = bothHtml.match(new RegExp(`<${name === "email" ? "input" : "textarea"}\\b[^>]*\\bid="${name}"[^>]*>`))?.[0];
|
|
84
|
+
assert.ok(control); assert.match(control, /aria-invalid="true"/); assert.match(control, new RegExp(`aria-describedby="${name}-error"`));
|
|
85
|
+
}
|
|
86
|
+
const valid = await post("email=a%40example.com&message=Draft");
|
|
87
|
+
assert.equal(valid.status, 200); assert.match(await valid.text(), /Your message was received/);
|
|
88
|
+
const oversized = await post(`email=a%40example.com&message=${"x".repeat(4001)}`);
|
|
89
|
+
assert.equal(oversized.status, 400);
|
|
90
|
+
});
|
|
91
|
+
<% } %><% if (appShell && forms) { %>
|
|
92
|
+
test("demo account routing, dashboard settings and instances", async () => {
|
|
93
|
+
const request = (path, options = {}) => fetch(new URL(path, base), { redirect: "manual", ...options });
|
|
94
|
+
assert.equal((await request("/dashboard")).status, 200);
|
|
95
|
+
const account = await request("/account");
|
|
96
|
+
assert.equal(account.status, 302); assert.equal(account.headers.get("location"), "/login?from=%2Faccount");
|
|
97
|
+
assert.equal((await request("/account", { method: "POST", headers: { origin: base, accept: "text/html", "content-type": "application/x-www-form-urlencoded" }, body: "" })).status, 302);
|
|
98
|
+
assert.equal((await request("/account", { method: "POST", headers: { origin: "https://evil.test", cookie: "demo-session=yes", "content-type": "application/x-www-form-urlencoded" }, body: "" })).status, 403);
|
|
99
|
+
const accountAction = await request("/account", { method: "POST", headers: { origin: base, accept: "text/html", cookie: "demo-session=yes", "content-type": "application/x-www-form-urlencoded" }, body: "" });
|
|
100
|
+
assert.equal(accountAction.status, 303); assert.equal(accountAction.headers.get("location"), "/dashboard");
|
|
101
|
+
assert.equal((await request("/login", { method: "POST", headers: { origin: "https://evil.test", accept: "text/html", "content-type": "application/x-www-form-urlencoded" }, body: "" })).status, 403);
|
|
102
|
+
const login = await request("/login", { method: "POST", headers: { origin: base, accept: "text/html", "content-type": "application/x-www-form-urlencoded" }, body: "" });
|
|
103
|
+
assert.equal(login.status, 303);
|
|
104
|
+
const cookie = login.headers.get("set-cookie").split(";")[0];
|
|
105
|
+
const settings = await request("/dashboard/settings", { method: "POST", headers: { origin: base, accept: "text/html", cookie, "content-type": "application/x-www-form-urlencoded" }, body: "name=Alex&bridge=lxdbr0&maxInstances=50&ipv6=on" });
|
|
106
|
+
assert.equal(settings.status, 200); assert.match(await settings.text(), /Settings saved/);
|
|
107
|
+
const badSettings = await request("/dashboard/settings", { method: "POST", headers: { origin: base, accept: "text/html", cookie, "content-type": "application/x-www-form-urlencoded" }, body: `name=${"x".repeat(61)}&bridge=invalid&maxInstances=101` });
|
|
108
|
+
assert.equal(badSettings.status, 400);
|
|
109
|
+
const postInstance = (action, body, session = cookie) => request(`/dashboard/instances?/${action}`, { method: "POST", headers: { origin: base, accept: "text/html", cookie: session, "content-type": "application/x-www-form-urlencoded" }, body });
|
|
110
|
+
assert.equal((await postInstance("create", "name=INVALID&release=noble")).status, 400);
|
|
111
|
+
const created = await postInstance("create", "name=one&release=noble&pro=on&cloudInit=hello");
|
|
112
|
+
assert.equal(created.status, 303);
|
|
113
|
+
const instanceCookie = created.headers.get("set-cookie").split(";")[0];
|
|
114
|
+
const session = `${cookie}; ${instanceCookie}`;
|
|
115
|
+
const overview = await request("/dashboard", { headers: { cookie: session } });
|
|
116
|
+
assert.match(await overview.text(), /<h3>Instances<\/h3>\s*<p>1<\/p>/);
|
|
117
|
+
const launched = await request("/dashboard/instances?create=1&release=focal");
|
|
118
|
+
const launchedHtml = await launched.text();
|
|
119
|
+
assert.match(launchedHtml, /<details[^>]*\bopen/); assert.match(launchedHtml, /value="focal"[^>]*selected/);
|
|
120
|
+
assert.equal((await postInstance("create", "name=one&release=noble", session)).status, 400);
|
|
121
|
+
const detail = await request("/dashboard/instances?selected=one", { headers: { cookie: session } });
|
|
122
|
+
const detailHtml = await detail.text(); assert.match(detailHtml, /one/); assert.match(detailHtml, /hello/);
|
|
123
|
+
const duplicateRecords = encodeURIComponent(JSON.stringify([{ name: "same", release: "noble", pro: false, cloudInit: "" }, { name: "same", release: "focal", pro: false, cloudInit: "" }]));
|
|
124
|
+
const duplicatePage = await request("/dashboard/instances", { headers: { cookie: `demo-instances=${duplicateRecords}` } });
|
|
125
|
+
assert.match(await duplicatePage.text(), /No demo instances yet/);
|
|
126
|
+
assert.equal((await postInstance("create", "name=legacy&release=focal")).status, 303);
|
|
127
|
+
assert.equal((await postInstance("create", `name=long&release=noble&cloudInit=${"x".repeat(1001)}`, session)).status, 400);
|
|
128
|
+
const confirmation = await request("/dashboard/instances/remove?name=one", { headers: { cookie: session } });
|
|
129
|
+
assert.equal(confirmation.status, 200); assert.match(await confirmation.text(), /Confirm removal/);
|
|
130
|
+
assert.equal((await request("/dashboard/instances/remove?name=missing", { headers: { cookie: session } })).status, 404);
|
|
131
|
+
const postRemoval = (body, origin = base) => request("/dashboard/instances/remove?name=one", { method: "POST", headers: { origin, accept: "text/html", cookie: session, "content-type": "application/x-www-form-urlencoded" }, body });
|
|
132
|
+
assert.equal((await postRemoval("name=one", "https://evil.test")).status, 403);
|
|
133
|
+
assert.equal((await postRemoval("name=one&name=one")).status, 404);
|
|
134
|
+
assert.equal((await postRemoval("name=one")).status, 303);
|
|
135
|
+
const confirmProject = await request("/dashboard/settings/confirm", { method: "POST", headers: { origin: base, accept: "text/html", "content-type": "application/x-www-form-urlencoded" }, body: "" });
|
|
136
|
+
assert.equal(confirmProject.status, 200); assert.match(await confirmProject.text(), /no project was deleted/);
|
|
137
|
+
});
|
|
138
|
+
<% } %><% } else { %>test("static build includes the SPA fallback and icons", async () => {
|
|
139
|
+
assert.match(await readFile("build/200.html", "utf8"), /<html/);
|
|
140
|
+
assert.match(await readFile("build/icons/information.svg", "utf8"), /<svg/);
|
|
141
|
+
});
|
|
142
|
+
<% } %>
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import { after, before, test } from "node:test";
|
|
5
|
+
import { chromium } from "playwright";
|
|
6
|
+
|
|
7
|
+
let server, browser, base;
|
|
8
|
+
before(async () => {
|
|
9
|
+
const socket = createServer();
|
|
10
|
+
await new Promise((resolve) => socket.listen(0, "127.0.0.1", resolve));
|
|
11
|
+
const { port } = socket.address();
|
|
12
|
+
await new Promise((resolve) => socket.close(resolve));
|
|
13
|
+
base = `http://127.0.0.1:${port}`;
|
|
14
|
+
<% if (spa) { %> server = spawn(process.execPath, ["node_modules/vite/bin/vite.js", "preview", "--host", "127.0.0.1", "--port", String(port), "--strictPort"], { stdio: "ignore" });
|
|
15
|
+
<% } else { %> server = spawn(process.execPath, ["build/index.js"], { env: { ...process.env, HOST: "127.0.0.1", PORT: String(port), ORIGIN: base }, stdio: "ignore" });
|
|
16
|
+
<% } %> for (let i = 0; i < 100; i++) {
|
|
17
|
+
if (server.exitCode !== null) throw new Error("Server exited; build the app before testing");
|
|
18
|
+
try { if ((await fetch(base)).ok) break; } catch { /* Await startup. */ }
|
|
19
|
+
if (i === 99) throw new Error("Server did not start");
|
|
20
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
21
|
+
}
|
|
22
|
+
browser = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH || undefined, headless: true });
|
|
23
|
+
});
|
|
24
|
+
after(async () => { await browser?.close(); server?.kill(); });
|
|
25
|
+
|
|
26
|
+
async function assertMessageError(page) {
|
|
27
|
+
assert.equal(await page.getByLabel("Email").getAttribute("aria-invalid"), null);
|
|
28
|
+
assert.equal(await page.getByLabel("Message").getAttribute("aria-invalid"), "true");
|
|
29
|
+
assert.match(await page.getByLabel("Message").getAttribute("aria-describedby"), /message-error/);
|
|
30
|
+
assert.match(await page.locator("#message-error").innerText(), /Enter a message/);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
test("editing email preserves the message error", async () => {
|
|
34
|
+
const context = await browser.newContext();
|
|
35
|
+
try {
|
|
36
|
+
const page = await context.newPage();
|
|
37
|
+
await page.goto(`${base}/contact`); await page.waitForLoadState("networkidle");
|
|
38
|
+
await page.getByRole("button", { name: "Send" }).click();
|
|
39
|
+
await page.getByText("Enter a valid email address.").waitFor();
|
|
40
|
+
await page.getByText("Enter a message.").waitFor();
|
|
41
|
+
await page.getByLabel("Email").fill("valid@example.com");
|
|
42
|
+
await assertMessageError(page);
|
|
43
|
+
await page.getByRole("button", { name: "Send" }).click();
|
|
44
|
+
await page.getByText("Enter a message.").waitFor();
|
|
45
|
+
await page.getByLabel("Message").fill("Hello");
|
|
46
|
+
await page.getByRole("button", { name: "Send" }).click();
|
|
47
|
+
await page.getByText(<%- spa ? '"The draft is valid. Nothing was sent."' : '"Your message was received."' %>).waitFor();
|
|
48
|
+
} finally { await context.close(); }
|
|
49
|
+
});
|
|
50
|
+
<% if (intl) { %>
|
|
51
|
+
test("error isolation follows the selected locale", async () => {
|
|
52
|
+
const context = await browser.newContext({ locale: "fr-FR", extraHTTPHeaders: { "accept-language": "fr" } });
|
|
53
|
+
try {
|
|
54
|
+
const page = await context.newPage();
|
|
55
|
+
await page.goto(`${base}/contact`); await page.waitForLoadState("networkidle");
|
|
56
|
+
await page.getByRole("button", { name: "Envoyer" }).click();
|
|
57
|
+
await page.getByText("Saisissez une adresse e-mail valide.").waitFor();
|
|
58
|
+
await page.getByText("Saisissez un message.").waitFor();
|
|
59
|
+
await page.getByLabel("Adresse e-mail").fill("valid@example.com");
|
|
60
|
+
assert.equal(await page.getByLabel("Adresse e-mail").getAttribute("aria-invalid"), null);
|
|
61
|
+
assert.equal(await page.getByLabel("Message").getAttribute("aria-invalid"), "true");
|
|
62
|
+
assert.match(await page.getByLabel("Message").getAttribute("aria-describedby"), /message-error/);
|
|
63
|
+
assert.match(await page.locator("#message-error").innerText(), /Saisissez un message/);
|
|
64
|
+
} finally { await context.close(); }
|
|
65
|
+
});
|
|
66
|
+
<% } %>
|
|
67
|
+
<% if (appShell && spa) { %>
|
|
68
|
+
test("query-only release launch updates the open creation form", async () => {
|
|
69
|
+
const context = await browser.newContext();
|
|
70
|
+
try {
|
|
71
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard/instances?create=1&release=noble`); await page.waitForLoadState("networkidle");
|
|
72
|
+
await page.evaluate(() => { const link = document.createElement("a"); link.href = "/dashboard/instances?create=1&release=focal"; link.textContent = "Choose focal"; document.querySelector("main").append(link); });
|
|
73
|
+
await page.getByRole("link", { name: "Choose focal" }).click();
|
|
74
|
+
await page.waitForURL(/release=focal/);
|
|
75
|
+
await page.waitForFunction(() => document.getElementById("instance-release")?.value === "focal");
|
|
76
|
+
} finally { await context.close(); }
|
|
77
|
+
});
|
|
78
|
+
test("SPA demo account redirects, signs in and stays in this session", async () => {
|
|
79
|
+
const context = await browser.newContext();
|
|
80
|
+
try {
|
|
81
|
+
const page = await context.newPage(); await page.goto(`${base}/account`);
|
|
82
|
+
await page.waitForURL(/\/login\?from=%2Faccount/i);
|
|
83
|
+
await page.getByRole("button", { name: "Enter demo account" }).click();
|
|
84
|
+
await page.getByRole("heading", { name: "Demo account" }).waitFor();
|
|
85
|
+
await page.waitForFunction(() => document.querySelector("main h1") === document.activeElement);
|
|
86
|
+
await page.reload(); await page.getByRole("heading", { name: "Demo account" }).waitFor();
|
|
87
|
+
await page.getByRole("link", { name: "Enter demo dashboard" }).click();
|
|
88
|
+
await page.getByRole("heading", { name: "Dashboard" }).waitFor();
|
|
89
|
+
} finally { await context.close(); }
|
|
90
|
+
});
|
|
91
|
+
test("SPA demo instances persist and removal needs confirmation", async () => {
|
|
92
|
+
const context = await browser.newContext();
|
|
93
|
+
try {
|
|
94
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard/instances`);
|
|
95
|
+
await page.locator("#instance-create-toggle").click();
|
|
96
|
+
await page.getByRole("button", { name: "Create demo instance" }).click();
|
|
97
|
+
await page.getByRole("alert").waitFor();
|
|
98
|
+
await page.getByLabel("Instance name").fill("spa-01");
|
|
99
|
+
await page.getByLabel("Release").selectOption("jammy");
|
|
100
|
+
await page.getByLabel("Enable Pro").check();
|
|
101
|
+
await page.getByLabel("Cloud-init").fill("sample cloud");
|
|
102
|
+
await page.getByRole("button", { name: "Create demo instance" }).click();
|
|
103
|
+
await page.locator("#instance-details").waitFor();
|
|
104
|
+
await page.goto(`${base}/dashboard`);
|
|
105
|
+
assert.equal(await page.locator(".instance-card").filter({ has: page.getByRole("heading", { name: "Instances" }) }).locator("p").innerText(), "1");
|
|
106
|
+
await page.goto(`${base}/dashboard/instances`);
|
|
107
|
+
await page.reload(); await page.getByRole("button", { name: "spa-01" }).click();
|
|
108
|
+
const remove = page.locator("section[aria-labelledby=instance-details]").getByRole("button", { name: "Remove demo instance" });
|
|
109
|
+
await remove.click(); const dialog = page.getByRole("dialog"); await dialog.waitFor(); await page.keyboard.press("Escape");
|
|
110
|
+
await dialog.waitFor({ state: "hidden" });
|
|
111
|
+
assert.equal(await remove.evaluate((element) => element === document.activeElement), true);
|
|
112
|
+
await remove.click(); await page.getByRole("dialog").getByRole("button", { name: "Remove demo instance" }).click();
|
|
113
|
+
await page.getByText("No demo instances yet.").waitFor();
|
|
114
|
+
await page.reload(); await page.getByText("No demo instances yet.").waitFor();
|
|
115
|
+
} finally { await context.close(); }
|
|
116
|
+
});
|
|
117
|
+
<% } %>
|
|
118
|
+
<% if (appShell) { %>
|
|
119
|
+
test("skip link and dashboard help work with keyboard", async () => {
|
|
120
|
+
const context = await browser.newContext();
|
|
121
|
+
try {
|
|
122
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard`); await page.waitForLoadState("networkidle");
|
|
123
|
+
await page.keyboard.press("Tab"); await page.keyboard.press("Enter");
|
|
124
|
+
await page.waitForFunction(() => document.getElementById("main") === document.activeElement);
|
|
125
|
+
const nav = page.getByRole("navigation", { name: "Dashboard navigation" });
|
|
126
|
+
assert.equal(await nav.getByText("Networks", { exact: false }).getAttribute("aria-disabled"), "true");
|
|
127
|
+
const help = nav.getByText("Help", { exact: true }); await help.focus(); await page.keyboard.press("Enter");
|
|
128
|
+
assert.equal(await nav.getByRole("link", { name: "Legal information" }).getAttribute("href"), "https://ubuntu.com/legal");
|
|
129
|
+
} finally { await context.close(); }
|
|
130
|
+
});
|
|
131
|
+
test("side sheet closes with Escape and settings confirmation is demo-only", async () => {
|
|
132
|
+
const context = await browser.newContext();
|
|
133
|
+
try {
|
|
134
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard/instances`); await page.waitForLoadState("networkidle");
|
|
135
|
+
const toggle = page.locator("#instance-create-toggle"); await toggle.click();
|
|
136
|
+
await page.getByLabel("Instance name").focus(); await page.keyboard.press("Escape");
|
|
137
|
+
assert.equal(await toggle.evaluate((element) => element === document.activeElement), true);
|
|
138
|
+
assert.equal(await toggle.locator("..").evaluate((element) => element.open), false);
|
|
139
|
+
await page.getByRole("link", { name: "Settings", exact: true }).first().click();
|
|
140
|
+
await page.getByRole("heading", { name: "Settings", exact: true }).waitFor();
|
|
141
|
+
await page.waitForFunction(() => document.querySelector("main h1") === document.activeElement);
|
|
142
|
+
const opener = page.getByRole("link", { name: "Delete demo project" }); await opener.click();
|
|
143
|
+
const dialog = page.getByRole("dialog"); await dialog.waitFor();
|
|
144
|
+
assert.equal(await dialog.evaluate((element) => element.matches(":modal")), true);
|
|
145
|
+
await page.keyboard.press("Escape"); await dialog.waitFor({ state: "hidden" });
|
|
146
|
+
assert.equal(await opener.evaluate((element) => element === document.activeElement), true);
|
|
147
|
+
await opener.click(); await dialog.waitFor();
|
|
148
|
+
await dialog.getByRole("button", { name: "Delete demo project" }).click();
|
|
149
|
+
await page.getByText("Demonstration confirmed; no project was deleted.").waitFor();
|
|
150
|
+
} finally { await context.close(); }
|
|
151
|
+
});
|
|
152
|
+
test("release launch preselects the creation form and keyboard focus follows disclosure", async () => {
|
|
153
|
+
const context = await browser.newContext({ viewport: { width: 375, height: 800 } });
|
|
154
|
+
try {
|
|
155
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard`); await page.waitForLoadState("networkidle");
|
|
156
|
+
await page.getByRole("article").filter({ has: page.getByRole("heading", { name: "Ubuntu 20.04 LTS" }) }).getByRole("link", { name: "Create an instance" }).click();
|
|
157
|
+
const toggle = page.locator("#instance-create-toggle"); await page.getByLabel("Release").waitFor();
|
|
158
|
+
assert.equal(await toggle.locator("..").evaluate((element) => element.open), true);
|
|
159
|
+
assert.equal(await page.getByLabel("Release").inputValue(), "focal");
|
|
160
|
+
await page.getByRole("button", { name: "Cancel", exact: true }).click();
|
|
161
|
+
await toggle.focus(); await page.keyboard.press("Enter");
|
|
162
|
+
await page.waitForFunction(() => document.getElementById("instance-name") === document.activeElement);
|
|
163
|
+
await page.keyboard.press("Escape");
|
|
164
|
+
assert.equal(await toggle.evaluate((element) => element === document.activeElement), true);
|
|
165
|
+
const nav = page.getByRole("navigation", { name: "Dashboard navigation" });
|
|
166
|
+
const navToggle = nav.getByText("Dashboard navigation", { exact: true }); await navToggle.focus(); await page.keyboard.press("Enter");
|
|
167
|
+
assert.equal(await navToggle.locator("..").evaluate((element) => element.open), false);
|
|
168
|
+
await page.keyboard.press("Enter"); assert.equal(await navToggle.locator("..").evaluate((element) => element.open), true);
|
|
169
|
+
} finally { await context.close(); }
|
|
170
|
+
});
|
|
171
|
+
<% } %>
|
|
172
|
+
<% if (!spa) { %>
|
|
173
|
+
<% if (appShell) { %>
|
|
174
|
+
test("settings confirmation works without JavaScript", async () => {
|
|
175
|
+
const context = await browser.newContext({ javaScriptEnabled: false });
|
|
176
|
+
try {
|
|
177
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard/settings`);
|
|
178
|
+
await page.getByRole("link", { name: "Delete demo project" }).click();
|
|
179
|
+
await page.getByRole("heading", { name: "Confirm project deletion" }).waitFor();
|
|
180
|
+
await page.getByRole("button", { name: "Delete demo project" }).click();
|
|
181
|
+
await page.getByText("Demonstration confirmed; no project was deleted.").waitFor();
|
|
182
|
+
} finally { await context.close(); }
|
|
183
|
+
});
|
|
184
|
+
test("release launch works without JavaScript", async () => {
|
|
185
|
+
const context = await browser.newContext({ javaScriptEnabled: false });
|
|
186
|
+
try {
|
|
187
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard`);
|
|
188
|
+
await page.getByRole("article").filter({ has: page.getByRole("heading", { name: "Ubuntu 22.04 LTS" }) }).getByRole("link", { name: "Create an instance" }).click();
|
|
189
|
+
assert.equal(await page.locator("#instance-create-toggle").locator("..").evaluate((element) => element.open), true);
|
|
190
|
+
assert.equal(await page.getByLabel("Release").inputValue(), "jammy");
|
|
191
|
+
} finally { await context.close(); }
|
|
192
|
+
});
|
|
193
|
+
test("SSR instance removal requires a confirmation page without JavaScript", async () => {
|
|
194
|
+
const context = await browser.newContext({ javaScriptEnabled: false });
|
|
195
|
+
try {
|
|
196
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard/instances`);
|
|
197
|
+
await page.locator("#instance-create-toggle").click();
|
|
198
|
+
await page.getByLabel("Instance name").fill("ssr-01");
|
|
199
|
+
await page.getByLabel("Release").selectOption("jammy");
|
|
200
|
+
await page.getByRole("button", { name: "Create demo instance" }).click();
|
|
201
|
+
await page.locator("#instance-details").waitFor();
|
|
202
|
+
await page.getByRole("link", { name: "Remove demo instance" }).click();
|
|
203
|
+
await page.getByRole("heading", { name: "Confirm removal" }).waitFor();
|
|
204
|
+
await page.getByRole("link", { name: "Cancel" }).click();
|
|
205
|
+
await page.locator("#instance-details").waitFor();
|
|
206
|
+
await page.getByRole("link", { name: "Remove demo instance" }).click();
|
|
207
|
+
await page.getByRole("button", { name: "Remove demo instance" }).click();
|
|
208
|
+
await page.getByText("No demo instances yet.").waitFor();
|
|
209
|
+
} finally { await context.close(); }
|
|
210
|
+
});
|
|
211
|
+
test("hydrated SSR removal uses a modal and restores focus", async () => {
|
|
212
|
+
const context = await browser.newContext();
|
|
213
|
+
try {
|
|
214
|
+
await context.addCookies([{ name: "demo-instances", value: encodeURIComponent(JSON.stringify([{ name: "modal-01", release: "noble", pro: false, cloudInit: "" }])), url: base }]);
|
|
215
|
+
const page = await context.newPage(); await page.goto(`${base}/dashboard/instances?selected=modal-01`); await page.waitForLoadState("networkidle");
|
|
216
|
+
const link = page.getByRole("link", { name: "Remove demo instance" });
|
|
217
|
+
await link.click(); const dialog = page.getByRole("dialog"); await dialog.waitFor();
|
|
218
|
+
assert.equal(await dialog.evaluate((element) => element.matches(":modal")), true);
|
|
219
|
+
await page.keyboard.press("Escape"); await dialog.waitFor({ state: "hidden" });
|
|
220
|
+
assert.equal(await link.evaluate((element) => element === document.activeElement), true);
|
|
221
|
+
await link.click(); await dialog.getByRole("button", { name: "Remove demo instance" }).click();
|
|
222
|
+
await page.getByText("No demo instances yet.").waitFor();
|
|
223
|
+
} finally { await context.close(); }
|
|
224
|
+
});
|
|
225
|
+
<% } %>
|
|
226
|
+
test("native validation errors survive hydration independently", async () => {
|
|
227
|
+
const context = await browser.newContext();
|
|
228
|
+
try {
|
|
229
|
+
const page = await context.newPage();
|
|
230
|
+
const response = await page.request.post(`${base}/contact`, { headers: { origin: base, accept: "text/html" }, form: { email: "", message: "" } });
|
|
231
|
+
assert.equal(response.status(), 400);
|
|
232
|
+
const body = await response.text();
|
|
233
|
+
await page.route("**/contact", (route) => route.fulfill({ status: 400, contentType: "text/html", body }), { times: 1 });
|
|
234
|
+
await page.goto(`${base}/contact`); await page.waitForLoadState("networkidle");
|
|
235
|
+
await page.getByLabel("Email").fill("valid@example.com"); await assertMessageError(page);
|
|
236
|
+
} finally { await context.close(); }
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test("native submission exposes both errors without JavaScript", async () => {
|
|
240
|
+
const context = await browser.newContext({ javaScriptEnabled: false });
|
|
241
|
+
try {
|
|
242
|
+
const page = await context.newPage(); await page.goto(`${base}/contact`);
|
|
243
|
+
const response = page.waitForResponse((response) => response.url().endsWith("/contact") && response.request().method() === "POST");
|
|
244
|
+
await page.getByRole("button", { name: "Send" }).click(); assert.equal((await response).status(), 400);
|
|
245
|
+
for (const name of ["Email", "Message"]) {
|
|
246
|
+
assert.equal(await page.getByLabel(name).getAttribute("aria-invalid"), "true");
|
|
247
|
+
assert.match(await page.getByLabel(name).getAttribute("aria-describedby"), new RegExp(`${name.toLowerCase()}-error`));
|
|
248
|
+
}
|
|
249
|
+
} finally { await context.close(); }
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
test("an obsolete failure does not replace newer edits", async () => {
|
|
253
|
+
const context = await browser.newContext();
|
|
254
|
+
try {
|
|
255
|
+
const page = await context.newPage(); await page.goto(`${base}/contact`); await page.waitForLoadState("networkidle");
|
|
256
|
+
let release; const blocked = new Promise((resolve) => { release = resolve; });
|
|
257
|
+
await page.route("**/contact", async (route) => { if (route.request().method() === "POST") await blocked; await route.continue(); });
|
|
258
|
+
await page.getByLabel("Email").fill("invalid"); await page.getByLabel("Message").fill("First");
|
|
259
|
+
await page.getByRole("button", { name: "Send" }).click();
|
|
260
|
+
await page.getByLabel("Email").fill("valid@example.com"); await page.getByLabel("Message").fill("New draft");
|
|
261
|
+
release(); await page.getByText(/earlier submission was invalid/).waitFor();
|
|
262
|
+
assert.equal(await page.getByLabel("Email").inputValue(), "valid@example.com");
|
|
263
|
+
assert.equal(await page.getByLabel("Message").inputValue(), "New draft");
|
|
264
|
+
} finally { await context.close(); }
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
test("an obsolete success does not replace newer edits", async () => {
|
|
268
|
+
const context = await browser.newContext();
|
|
269
|
+
try {
|
|
270
|
+
const page = await context.newPage(); await page.goto(`${base}/contact`); await page.waitForLoadState("networkidle");
|
|
271
|
+
let release; const blocked = new Promise((resolve) => { release = resolve; });
|
|
272
|
+
await page.route("**/contact", async (route) => { if (route.request().method() === "POST") await blocked; await route.continue(); });
|
|
273
|
+
await page.getByLabel("Email").fill("valid@example.com"); await page.getByLabel("Message").fill("First");
|
|
274
|
+
await page.getByRole("button", { name: "Send" }).click(); await page.getByLabel("Message").fill("New draft");
|
|
275
|
+
release(); await page.getByText(/earlier message was received/).waitFor();
|
|
276
|
+
assert.equal(await page.getByLabel("Message").inputValue(), "New draft");
|
|
277
|
+
} finally { await context.close(); }
|
|
278
|
+
});
|
|
279
|
+
<% } %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./.svelte-kit/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"checkJs": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"moduleResolution": "bundler"
|
|
13
|
+
},
|
|
14
|
+
"exclude": ["node_modules", "test", "build"]
|
|
15
|
+
}
|
package/dist/esm/domain/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { GENERATOR_INVALID_ANSWER, } from "@canonical/summon-core";
|
|
3
4
|
import { exists, fail, flatMap, info, mkdir, sequence_, writeFile, } from "@canonical/task";
|
|
4
5
|
import { toCamelCase, toTitleCase } from "@canonical/utils";
|
|
5
6
|
import { normalizeCommandPath } from "../shared/casing.js";
|
|
@@ -21,6 +22,17 @@ const prompts = [
|
|
|
21
22
|
}),
|
|
22
23
|
group: "Domain",
|
|
23
24
|
},
|
|
25
|
+
{
|
|
26
|
+
name: "framework",
|
|
27
|
+
type: "select",
|
|
28
|
+
message: "Application framework:",
|
|
29
|
+
choices: [
|
|
30
|
+
{ label: "React", value: "react" },
|
|
31
|
+
{ label: "SvelteKit", value: "svelte" },
|
|
32
|
+
],
|
|
33
|
+
default: "react",
|
|
34
|
+
group: "Domain",
|
|
35
|
+
},
|
|
24
36
|
];
|
|
25
37
|
/** The domain generator's own templates, copied next to it by the build. */
|
|
26
38
|
const templatesDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "templates");
|
|
@@ -30,10 +42,11 @@ export const generator = {
|
|
|
30
42
|
displayName: "@canonical/summon-application:domain",
|
|
31
43
|
description: "Create a domain folder with routes and a MainPage",
|
|
32
44
|
version: packageVersion(),
|
|
33
|
-
help: `
|
|
45
|
+
help: `For React, creates a domain directory under src/domains/ with:
|
|
34
46
|
- MainPage.tsx — example page component with <Head>
|
|
35
47
|
- routes.ts — route barrel exporting the domain's routes
|
|
36
48
|
|
|
49
|
+
With --framework svelte, creates src/routes/<domain>/+page.svelte.
|
|
37
50
|
Add more pages with: summon page <domain>/<name>`,
|
|
38
51
|
examples: [
|
|
39
52
|
"summon domain billing",
|
|
@@ -45,6 +58,14 @@ Add more pages with: summon page <domain>/<name>`,
|
|
|
45
58
|
generate: (answers) => {
|
|
46
59
|
const name = normalizeCommandPath(answers.domainName);
|
|
47
60
|
const domainDir = path.join("src", "domains", name);
|
|
61
|
+
const routeDir = path.join("src", "routes", name);
|
|
62
|
+
const svelteScaffold = sequence_([
|
|
63
|
+
mkdir(routeDir),
|
|
64
|
+
writeFile(path.join(routeDir, "+page.svelte"), renderTemplate(templatesDir, "Page.svelte.ejs", {
|
|
65
|
+
title: toTitleCase(name),
|
|
66
|
+
})),
|
|
67
|
+
info(`SvelteKit route created at /${name}.`),
|
|
68
|
+
]);
|
|
48
69
|
const scaffold = sequence_([
|
|
49
70
|
printVersions("domain"),
|
|
50
71
|
info(`Creating domain "${name}"...`),
|
|
@@ -62,12 +83,25 @@ Add more pages with: summon page <domain>/<name>`,
|
|
|
62
83
|
// Refuse to run when the domain already exists — mkdir/writeFile undos are
|
|
63
84
|
// destructive (DeleteDirectory / DeleteFile), so overwriting then `--undo`
|
|
64
85
|
// could delete a pre-existing domain.
|
|
65
|
-
|
|
86
|
+
if (answers.framework === "svelte") {
|
|
87
|
+
return flatMap(exists(routeDir), (present) => present
|
|
88
|
+
? fail({
|
|
89
|
+
code: "DOMAIN_EXISTS",
|
|
90
|
+
message: `Route "${routeDir}" already exists. Choose a different name.`,
|
|
91
|
+
})
|
|
92
|
+
: svelteScaffold);
|
|
93
|
+
}
|
|
94
|
+
return flatMap(exists("svelte.config.js"), (svelte) => svelte
|
|
66
95
|
? fail({
|
|
67
|
-
code:
|
|
68
|
-
message:
|
|
96
|
+
code: GENERATOR_INVALID_ANSWER,
|
|
97
|
+
message: "This is a SvelteKit application; run again with --framework svelte.",
|
|
69
98
|
})
|
|
70
|
-
:
|
|
99
|
+
: flatMap(exists(domainDir), (present) => present
|
|
100
|
+
? fail({
|
|
101
|
+
code: "DOMAIN_EXISTS",
|
|
102
|
+
message: `Domain "${domainDir}" already exists. Choose a different name or remove it first.`,
|
|
103
|
+
})
|
|
104
|
+
: scaffold));
|
|
71
105
|
},
|
|
72
106
|
};
|
|
73
107
|
export default generator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"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"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { generator as applicationReactGenerator } from "./application/react/index.js";
|
|
2
|
+
import { generator as applicationSvelteGenerator } from "./application/svelte/index.js";
|
|
2
3
|
import { generator as domainGenerator } from "./domain/index.js";
|
|
3
4
|
import { generator as pageGenerator } from "./page/index.js";
|
|
4
5
|
import { generator as wrapperGenerator } from "./wrapper/index.js";
|
|
5
6
|
export const generators = {
|
|
6
7
|
"application/react": applicationReactGenerator,
|
|
8
|
+
"application/svelte": applicationSvelteGenerator,
|
|
7
9
|
domain: domainGenerator,
|
|
8
10
|
page: pageGenerator,
|
|
9
11
|
wrapper: wrapperGenerator,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,IAAI,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEnE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,mBAAmB,EAAE,yBAAyB;IAC9C,MAAM,EAAE,eAAe;IACvB,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB;CACsB,CAAC;AAElD,eAAe,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,IAAI,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,SAAS,IAAI,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEnE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,mBAAmB,EAAE,yBAAyB;IAC9C,oBAAoB,EAAE,0BAA0B;IAChD,MAAM,EAAE,eAAe;IACvB,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB;CACsB,CAAC;AAElD,eAAe,UAAU,CAAC"}
|