sv 0.15.2 → 0.15.4
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/bin.mjs +1 -1
- package/dist/{engine-DNw7p3EG.mjs → engine-Hqu9lWdb.mjs} +34 -23
- package/dist/src/index.mjs +1 -1
- package/dist/src/testing.d.mts +9 -2
- package/dist/src/testing.mjs +13 -5
- package/dist/templates/addon/assets/tests/addon.test.js +1 -1
- package/dist/templates/addon/package.json +4 -4
- package/package.json +2 -2
package/dist/bin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as name, a as detectPackageManager, d as program, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as Command, v as version } from "./engine-
|
|
2
|
+
import { _ as name, a as detectPackageManager, d as program, g as helpConfig, h as forwardExitCode, l as from, n as add, r as create, u as Command, v as version } from "./engine-Hqu9lWdb.mjs";
|
|
3
3
|
import { color, resolveCommandArray } from "@sveltejs/sv-utils";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
@@ -1394,7 +1394,7 @@ ${r ? import_picocolors.default.cyan(x$1) : ""}
|
|
|
1394
1394
|
//#endregion
|
|
1395
1395
|
//#region package.json
|
|
1396
1396
|
var name = "sv";
|
|
1397
|
-
var version = "0.15.
|
|
1397
|
+
var version = "0.15.4";
|
|
1398
1398
|
//#endregion
|
|
1399
1399
|
//#region src/core/errors.ts
|
|
1400
1400
|
var UnsupportedError = class extends Error {
|
|
@@ -6097,7 +6097,7 @@ function createOptionBuilder(options) {
|
|
|
6097
6097
|
}
|
|
6098
6098
|
//#endregion
|
|
6099
6099
|
//#region src/addons/common.ts
|
|
6100
|
-
const ESLINT_VERSION = "^10.
|
|
6100
|
+
const ESLINT_VERSION = "^10.4.0";
|
|
6101
6101
|
const addEslintConfigPrettier = transforms.script(({ ast, js }) => {
|
|
6102
6102
|
const sveltePluginImport = ast.body.filter((n) => n.type === "ImportDeclaration").find((n) => n.type === "ImportDeclaration" && n.source.value === "eslint-plugin-svelte" && n.specifiers?.some((n) => n.type === "ImportDefaultSpecifier"));
|
|
6103
6103
|
let svelteImportName;
|
|
@@ -6314,7 +6314,7 @@ var better_auth_default = defineAddon({
|
|
|
6314
6314
|
});
|
|
6315
6315
|
js.imports.addNamed(ast, {
|
|
6316
6316
|
imports: ["User", "Session"],
|
|
6317
|
-
from: "better-auth
|
|
6317
|
+
from: "better-auth",
|
|
6318
6318
|
isType: true
|
|
6319
6319
|
});
|
|
6320
6320
|
const locals = js.kit.addGlobalAppInterface(ast, { name: "Locals" });
|
|
@@ -7053,7 +7053,6 @@ var eslint_default = defineAddon({
|
|
|
7053
7053
|
const typescript = language === "ts";
|
|
7054
7054
|
const prettierInstalled = Boolean(dependencyVersion("prettier"));
|
|
7055
7055
|
sv.devDependency("eslint", ESLINT_VERSION);
|
|
7056
|
-
sv.devDependency("@eslint/compat", "^2.0.4");
|
|
7057
7056
|
sv.devDependency("eslint-plugin-svelte", "^3.17.0");
|
|
7058
7057
|
sv.devDependency("globals", "^17.4.0");
|
|
7059
7058
|
sv.devDependency("@eslint/js", "^10.0.1");
|
|
@@ -7169,7 +7168,7 @@ var eslint_default = defineAddon({
|
|
|
7169
7168
|
as: "js"
|
|
7170
7169
|
});
|
|
7171
7170
|
js.imports.addNamed(ast, {
|
|
7172
|
-
from: "
|
|
7171
|
+
from: "eslint/config",
|
|
7173
7172
|
imports: ["includeIgnoreFile"]
|
|
7174
7173
|
});
|
|
7175
7174
|
js.imports.addDefault(ast, {
|
|
@@ -7556,7 +7555,7 @@ var playwright_default = defineAddon({
|
|
|
7556
7555
|
homepage: "https://playwright.dev",
|
|
7557
7556
|
options: {},
|
|
7558
7557
|
run: ({ sv, language, file, isKit, directory }) => {
|
|
7559
|
-
sv.devDependency("@playwright/test", "^1.
|
|
7558
|
+
sv.devDependency("@playwright/test", "^1.60.0");
|
|
7560
7559
|
sv.file(file.package, transforms.json(({ data, json }) => {
|
|
7561
7560
|
json.packageScriptsUpsert(data, "test:e2e", "playwright test");
|
|
7562
7561
|
json.packageScriptsUpsert(data, "test:e2e", "playwright install", { mode: "prepend" });
|
|
@@ -7776,7 +7775,7 @@ var sveltekit_adapter_default = defineAddon({
|
|
|
7776
7775
|
setup: ({ isKit, unsupported }) => {
|
|
7777
7776
|
if (!isKit) unsupported("Requires SvelteKit");
|
|
7778
7777
|
},
|
|
7779
|
-
run: ({ sv, options, file, cwd }) => {
|
|
7778
|
+
run: ({ sv, options, packageManager, file, cwd }) => {
|
|
7780
7779
|
const adapter = adapters.find((a) => a.id === options.adapter);
|
|
7781
7780
|
sv.file(file.package, transforms.json(({ data }) => {
|
|
7782
7781
|
const devDeps = data["devDependencies"];
|
|
@@ -7815,6 +7814,7 @@ var sveltekit_adapter_default = defineAddon({
|
|
|
7815
7814
|
}));
|
|
7816
7815
|
if (adapter.package === "@sveltejs/adapter-cloudflare") {
|
|
7817
7816
|
sv.devDependency("wrangler", "^4.81.0");
|
|
7817
|
+
if (packageManager === "pnpm") sv.file(file.findUp("pnpm-workspace.yaml"), pnpm.allowBuilds("workerd", "sharp"));
|
|
7818
7818
|
const ext = fileExists(cwd, "wrangler.toml") ? "toml" : "jsonc";
|
|
7819
7819
|
const applyWranglerConfig = (data) => {
|
|
7820
7820
|
if (ext === "jsonc") data.$schema ??= "./node_modules/wrangler/config-schema.json";
|
|
@@ -7999,7 +7999,7 @@ const officialAddons$1 = {
|
|
|
7999
7999
|
if (componentTesting) {
|
|
8000
8000
|
sv.devDependency("@vitest/browser-playwright", "^4.1.3");
|
|
8001
8001
|
sv.devDependency("vitest-browser-svelte", "^2.1.0");
|
|
8002
|
-
sv.devDependency("playwright", "^1.
|
|
8002
|
+
sv.devDependency("playwright", "^1.60.0");
|
|
8003
8003
|
}
|
|
8004
8004
|
sv.file(file.package, transforms.json(({ data, json }) => {
|
|
8005
8005
|
json.packageScriptsUpsert(data, "test:unit", "vitest");
|
|
@@ -10962,22 +10962,33 @@ async function installDependencies(agent, cwd) {
|
|
|
10962
10962
|
spacing: 0,
|
|
10963
10963
|
retainLog: true
|
|
10964
10964
|
});
|
|
10965
|
+
const { command, args } = constructCommand(COMMANDS[agent].install, []);
|
|
10966
|
+
const proc = z(command, args, {
|
|
10967
|
+
nodeOptions: {
|
|
10968
|
+
cwd,
|
|
10969
|
+
stdio: "pipe"
|
|
10970
|
+
},
|
|
10971
|
+
throwOnError: false
|
|
10972
|
+
});
|
|
10973
|
+
const output = [];
|
|
10965
10974
|
try {
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
throwOnError: true
|
|
10973
|
-
});
|
|
10974
|
-
for await (const line of proc) task.message(line);
|
|
10975
|
+
for await (const line of proc) {
|
|
10976
|
+
output.push(line);
|
|
10977
|
+
task.message(line);
|
|
10978
|
+
}
|
|
10979
|
+
} catch {}
|
|
10980
|
+
if ((proc.exitCode ?? 0) === 0) {
|
|
10975
10981
|
task.success(`Successfully installed dependencies with ${color.command(agent)}`);
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
10982
|
+
return;
|
|
10983
|
+
}
|
|
10984
|
+
if (agent === "pnpm" && output.join("\n").includes("ERR_PNPM_IGNORED_BUILDS")) {
|
|
10985
|
+
task.success(`Installed dependencies with ${color.command(agent)}`);
|
|
10986
|
+
R$1.warn(`Some build scripts were skipped. Run ${color.command(`${agent} approve-builds`)} to approve them.`);
|
|
10987
|
+
return;
|
|
10980
10988
|
}
|
|
10989
|
+
task.error("Failed to install dependencies");
|
|
10990
|
+
Pt("Operation failed.");
|
|
10991
|
+
process$1.exit(2);
|
|
10981
10992
|
}
|
|
10982
10993
|
async function detectPackageManager(cwd) {
|
|
10983
10994
|
return (await detect({ cwd }))?.name ?? getUserAgent() ?? "npm";
|
|
@@ -11564,6 +11575,8 @@ async function createProject(cwd, options) {
|
|
|
11564
11575
|
});
|
|
11565
11576
|
if (options.fromPlayground) await createProjectFromPlayground(options.fromPlayground, projectPath);
|
|
11566
11577
|
R$1.success("Project created");
|
|
11578
|
+
const packageManager = options.install === false ? null : options.install === true ? await packageManagerPrompt(projectPath) : options.install;
|
|
11579
|
+
if (packageManager) workspace.packageManager = packageManager;
|
|
11567
11580
|
let argsFormattedAddons = [];
|
|
11568
11581
|
let addOnFilesToFormat = [];
|
|
11569
11582
|
let addOnSuccessfulAddons = [];
|
|
@@ -11588,7 +11601,6 @@ async function createProject(cwd, options) {
|
|
|
11588
11601
|
addOnSuccessfulAddons = successfulAddons;
|
|
11589
11602
|
addonSetupResults = setupResults;
|
|
11590
11603
|
}
|
|
11591
|
-
const packageManager = options.install === false ? null : options.install === true ? await packageManagerPrompt(projectPath) : options.install;
|
|
11592
11604
|
const argsFormatted = [];
|
|
11593
11605
|
argsFormatted.push("--template", template);
|
|
11594
11606
|
if (language === "typescript") argsFormatted.push("--types", "ts");
|
|
@@ -11597,7 +11609,6 @@ async function createProject(cwd, options) {
|
|
|
11597
11609
|
if (argsFormattedAddons.length > 0) argsFormatted.push("--add", ...argsFormattedAddons);
|
|
11598
11610
|
updateReadme(directory, buildAndLogArgs(packageManager, "create", argsFormatted, [directory]));
|
|
11599
11611
|
updateAgent(directory, language, packageManager ?? "npm", loadedAddons);
|
|
11600
|
-
if (packageManager) workspace.packageManager = packageManager;
|
|
11601
11612
|
const addOnNextSteps = getNextSteps(addOnSuccessfulAddons, workspace, answers, addonSetupResults);
|
|
11602
11613
|
addPnpmAllowBuilds(projectPath, packageManager, "esbuild");
|
|
11603
11614
|
if (packageManager) {
|
package/dist/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-
|
|
1
|
+
import { c as defineAddonOptions, m as create$1, o as officialAddons, s as defineAddon, t as add, y as svDeprecated } from "../engine-Hqu9lWdb.mjs";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
function create(cwdOrOptions, legacyOptions) {
|
|
4
4
|
if (typeof cwdOrOptions === "string") {
|
package/dist/src/testing.d.mts
CHANGED
|
@@ -55,6 +55,12 @@ type PrepareServerOptions = {
|
|
|
55
55
|
page: Page;
|
|
56
56
|
buildCommand?: string;
|
|
57
57
|
previewCommand?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Vitest's `expect`, injected by `createSetupTest`. Used to make a Vitest-counted
|
|
60
|
+
* assertion that the preview loaded, which also satisfies `requireAssertions` for
|
|
61
|
+
* tests that otherwise only assert through Playwright's (untracked) `expect`.
|
|
62
|
+
*/
|
|
63
|
+
expect?: VitestContext["expect"];
|
|
58
64
|
};
|
|
59
65
|
type PrepareServerReturn = {
|
|
60
66
|
url: string;
|
|
@@ -64,10 +70,11 @@ declare function prepareServer({
|
|
|
64
70
|
cwd,
|
|
65
71
|
page,
|
|
66
72
|
buildCommand,
|
|
67
|
-
previewCommand
|
|
73
|
+
previewCommand,
|
|
74
|
+
expect
|
|
68
75
|
}: PrepareServerOptions): Promise<PrepareServerReturn>;
|
|
69
76
|
type PlaywrightContext = Pick<typeof _$_playwright_test0, "chromium">;
|
|
70
|
-
type VitestContext = Pick<typeof _$vitest, "inject" | "test" | "beforeAll" | "beforeEach">;
|
|
77
|
+
type VitestContext = Pick<typeof _$vitest, "inject" | "test" | "beforeAll" | "beforeEach" | "expect">;
|
|
71
78
|
declare function createSetupTest(vitest: VitestContext, playwright?: PlaywrightContext): <Addons extends AddonMap>(addons: Addons, options?: SetupTestOptions<Addons>) => {
|
|
72
79
|
test: _$vitest.TestAPI<Fixtures>;
|
|
73
80
|
testCases: Array<AddonTestCase<AddonMap>>;
|
package/dist/src/testing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-
|
|
1
|
+
import { S as __toESM, b as __commonJSMin, f as R, i as addPnpmAllowBuilds, m as create, p as z, t as add, x as __require } from "../engine-Hqu9lWdb.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process$1 from "node:process";
|
|
@@ -736,7 +736,7 @@ function setupGlobal({ TEST_DIR, pre, post }) {
|
|
|
736
736
|
};
|
|
737
737
|
};
|
|
738
738
|
}
|
|
739
|
-
async function prepareServer({ cwd, page, buildCommand = "pnpm build", previewCommand = "pnpm preview" }) {
|
|
739
|
+
async function prepareServer({ cwd, page, buildCommand = "pnpm build", previewCommand = "pnpm preview", expect }) {
|
|
740
740
|
if (buildCommand) execSync(buildCommand, {
|
|
741
741
|
cwd,
|
|
742
742
|
stdio: "pipe"
|
|
@@ -746,8 +746,13 @@ async function prepareServer({ cwd, page, buildCommand = "pnpm build", previewCo
|
|
|
746
746
|
command: previewCommand
|
|
747
747
|
});
|
|
748
748
|
page.setDefaultNavigationTimeout(62e3);
|
|
749
|
+
await page.route("**/.well-known/appspecific/com.chrome.devtools.json", (route) => route.fulfill({
|
|
750
|
+
status: 404,
|
|
751
|
+
body: ""
|
|
752
|
+
}));
|
|
749
753
|
try {
|
|
750
|
-
await page.goto(url);
|
|
754
|
+
const response = await page.goto(url);
|
|
755
|
+
expect?.(response?.ok(), `preview server did not serve ${url}`)?.toBe(true);
|
|
751
756
|
} catch (e) {
|
|
752
757
|
await close();
|
|
753
758
|
throw e;
|
|
@@ -759,7 +764,7 @@ async function prepareServer({ cwd, page, buildCommand = "pnpm build", previewCo
|
|
|
759
764
|
}
|
|
760
765
|
function createSetupTest(vitest, playwright) {
|
|
761
766
|
return function setupTest(addons, options) {
|
|
762
|
-
const { inject, test: vitestTest, beforeAll, beforeEach } = vitest;
|
|
767
|
+
const { inject, test: vitestTest, beforeAll, beforeEach, expect } = vitest;
|
|
763
768
|
const test = vitestTest.extend({});
|
|
764
769
|
const cwd = inject("testDir");
|
|
765
770
|
const templatesDir = inject("templatesDir");
|
|
@@ -845,7 +850,10 @@ function createSetupTest(vitest, playwright) {
|
|
|
845
850
|
return {
|
|
846
851
|
test,
|
|
847
852
|
testCases,
|
|
848
|
-
prepareServer
|
|
853
|
+
prepareServer: (options) => prepareServer({
|
|
854
|
+
expect,
|
|
855
|
+
...options
|
|
856
|
+
})
|
|
849
857
|
};
|
|
850
858
|
};
|
|
851
859
|
}
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"sv": "
|
|
25
|
+
"sv": "^0.15.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"sv": "
|
|
29
|
-
"@sveltejs/sv-utils": "
|
|
30
|
-
"@playwright/test": "^1.
|
|
28
|
+
"sv": "^0.15.4",
|
|
29
|
+
"@sveltejs/sv-utils": "^0.2.2",
|
|
30
|
+
"@playwright/test": "^1.60.0",
|
|
31
31
|
"@types/node": "^25.5.2",
|
|
32
32
|
"tsdown": "^0.21.7",
|
|
33
33
|
"vitest": "^4.1.3"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sv",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A command line interface (CLI) for creating and maintaining Svelte applications",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sveltejs/sv-utils": "0.2.
|
|
28
|
+
"@sveltejs/sv-utils": "0.2.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.0.0",
|