sv 0.8.21 → 0.9.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/{addons-DrsfA5uM.js → addons-ZFgzq16L.js} +7 -7
- package/dist/bin.js +67 -65
- package/dist/index.js +1 -1
- package/dist/shared.json +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Element, T, Tag, __commonJS, __export, __toESM as __toESM$1, __toESM$1 as __toESM, be, detect, esm_exports, getUserAgent, parseCss$1, parseHtml, parseHtml$1, parseJson$1, parseScript, parseScript$1, parseSvelte, require_picocolors
|
|
1
|
+
import { Element, T, Tag, __commonJS, __export, __toESM as __toESM$1, __toESM$1 as __toESM, be, detect, esm_exports, getUserAgent, parseCss$1, parseHtml, parseHtml$1, parseJson$1, parseScript, parseScript$1, parseSvelte, require_picocolors, require_picocolors$1, resolveCommand, serializeScript, stripAst, up, walk, walk_exports } from "./package-manager-DO5R9a6p.js";
|
|
2
2
|
import fs, { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
3
3
|
import path, { dirname, join } from "node:path";
|
|
4
4
|
import process$1, { stdin, stdout } from "node:process";
|
|
@@ -889,7 +889,7 @@ const addPlugin = (ast, options$6) => {
|
|
|
889
889
|
|
|
890
890
|
//#endregion
|
|
891
891
|
//#region packages/cli/commands/add/utils.ts
|
|
892
|
-
var import_picocolors$5 = __toESM(require_picocolors(), 1);
|
|
892
|
+
var import_picocolors$5 = __toESM(require_picocolors$1(), 1);
|
|
893
893
|
function getPackageJson(cwd) {
|
|
894
894
|
const packageText = readFile(cwd, commonFilePaths.packageJson);
|
|
895
895
|
if (!packageText) {
|
|
@@ -1060,7 +1060,7 @@ function parseKitOptions(cwd) {
|
|
|
1060
1060
|
|
|
1061
1061
|
//#endregion
|
|
1062
1062
|
//#region packages/cli/lib/install.ts
|
|
1063
|
-
var import_picocolors$4 = __toESM(require_picocolors(), 1);
|
|
1063
|
+
var import_picocolors$4 = __toESM(require_picocolors$1(), 1);
|
|
1064
1064
|
async function installAddon({ addons, cwd, options: options$6, packageManager = "npm" }) {
|
|
1065
1065
|
const workspace = await createWorkspace({
|
|
1066
1066
|
cwd,
|
|
@@ -1254,7 +1254,7 @@ else if (y > 0) ret += `${CSI}${y}B`;
|
|
|
1254
1254
|
};
|
|
1255
1255
|
} });
|
|
1256
1256
|
var import_src$1 = __toESM$1(require_src(), 1);
|
|
1257
|
-
var import_picocolors$3 = __toESM$1(require_picocolors
|
|
1257
|
+
var import_picocolors$3 = __toESM$1(require_picocolors(), 1);
|
|
1258
1258
|
function hu({ onlyFirst: e$1 = !1 } = {}) {
|
|
1259
1259
|
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
1260
1260
|
return new RegExp(t, e$1 ? void 0 : "g");
|
|
@@ -1989,8 +1989,8 @@ B$1 = new WeakMap(), k$1 = new WeakMap(), I = new WeakMap(), v$1 = new WeakMap()
|
|
|
1989
1989
|
e$1 ? this.filteredOptions = D$1.filter((t) => x$1(this, I).call(this, e$1, t)) : this.filteredOptions = [...D$1], m(this, B$1, FD(this.focusedValue, this.filteredOptions)), this.focusedValue = this.filteredOptions[x$1(this, B$1)]?.value, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
1990
1990
|
}
|
|
1991
1991
|
};
|
|
1992
|
-
var import_picocolors$1 = __toESM$1(require_picocolors
|
|
1993
|
-
var import_picocolors$2 = __toESM$1(require_picocolors
|
|
1992
|
+
var import_picocolors$1 = __toESM$1(require_picocolors(), 1);
|
|
1993
|
+
var import_picocolors$2 = __toESM$1(require_picocolors(), 1);
|
|
1994
1994
|
var import_src = __toESM$1(require_src(), 1);
|
|
1995
1995
|
function Pe() {
|
|
1996
1996
|
return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
@@ -2691,7 +2691,7 @@ else return true;
|
|
|
2691
2691
|
if (version.patch === below.patch) return false;
|
|
2692
2692
|
return undefined;
|
|
2693
2693
|
}
|
|
2694
|
-
var import_picocolors = __toESM$1(require_picocolors
|
|
2694
|
+
var import_picocolors = __toESM$1(require_picocolors(), 1);
|
|
2695
2695
|
var colors = import_picocolors.default;
|
|
2696
2696
|
|
|
2697
2697
|
//#endregion
|
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { AGENT_NAMES, Command, De, Fe, Ge, J, Ke, Option, T, Ue, Vu, We, __toESM$1 as __toESM, addPnpmBuildDependencies, create, detect, et, from, getUserAgent, installDependencies, installOption, ke, packageManagerPrompt, program, require_picocolors$1 as require_picocolors, resolveCommand, templates, up, ze } from "./package-manager-DO5R9a6p.js";
|
|
3
|
-
import { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, isVersionUnsupportedBelow, officialAddons, setupAddons } from "./addons-
|
|
3
|
+
import { applyAddons, communityAddonIds, createWorkspace, formatFiles, getAddonDetails, getCommunityAddon, getHighlighter, isVersionUnsupportedBelow, officialAddons, setupAddons } from "./addons-ZFgzq16L.js";
|
|
4
4
|
import fs, { existsSync } from "node:fs";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -12,7 +12,7 @@ import { pipeline } from "node:stream/promises";
|
|
|
12
12
|
|
|
13
13
|
//#region packages/cli/package.json
|
|
14
14
|
var name = "sv";
|
|
15
|
-
var version = "0.
|
|
15
|
+
var version = "0.9.0";
|
|
16
16
|
var type = "module";
|
|
17
17
|
var description = "A CLI for creating and updating SvelteKit projects";
|
|
18
18
|
var license = "MIT";
|
|
@@ -676,46 +676,50 @@ async function fetchPackageJSON(packageName) {
|
|
|
676
676
|
}
|
|
677
677
|
|
|
678
678
|
//#endregion
|
|
679
|
-
//#region packages/cli/commands/add/
|
|
680
|
-
function
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
return {
|
|
694
|
-
success: true,
|
|
695
|
-
message: undefined
|
|
696
|
-
};
|
|
697
|
-
} catch {
|
|
698
|
-
return {
|
|
699
|
-
success: true,
|
|
700
|
-
message: "Not a git repository"
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}, {
|
|
705
|
-
name: "unsupported add-ons",
|
|
706
|
-
run: () => {
|
|
707
|
-
const reasons = addons.flatMap((a) => addonSetupResult[a.id].unsupported.map((reason) => ({
|
|
708
|
-
id: a.id,
|
|
709
|
-
reason
|
|
710
|
-
})));
|
|
711
|
-
if (reasons.length === 0) return {
|
|
679
|
+
//#region packages/cli/commands/add/verifiers.ts
|
|
680
|
+
function verifyCleanWorkingDirectory(cwd, gitCheck) {
|
|
681
|
+
const verifications = [];
|
|
682
|
+
if (gitCheck) verifications.push({
|
|
683
|
+
name: "clean working directory",
|
|
684
|
+
run: async () => {
|
|
685
|
+
try {
|
|
686
|
+
const asyncExec = promisify(exec);
|
|
687
|
+
const { stdout: stdout$1 } = await asyncExec("git status --short", { cwd });
|
|
688
|
+
if (stdout$1) return {
|
|
689
|
+
success: false,
|
|
690
|
+
message: "Found modified files"
|
|
691
|
+
};
|
|
692
|
+
return {
|
|
712
693
|
success: true,
|
|
713
694
|
message: undefined
|
|
714
695
|
};
|
|
715
|
-
|
|
696
|
+
} catch {
|
|
697
|
+
return {
|
|
698
|
+
success: true,
|
|
699
|
+
message: "Not a git repository"
|
|
700
|
+
};
|
|
716
701
|
}
|
|
717
|
-
}
|
|
718
|
-
};
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
return verifications;
|
|
705
|
+
}
|
|
706
|
+
function verifyUnsupportedAddons(addons, addonSetupResult) {
|
|
707
|
+
const verifications = [];
|
|
708
|
+
verifications.push({
|
|
709
|
+
name: "unsupported add-ons",
|
|
710
|
+
run: () => {
|
|
711
|
+
const reasons = addons.flatMap((a) => addonSetupResult[a.id].unsupported.map((reason) => ({
|
|
712
|
+
id: a.id,
|
|
713
|
+
reason
|
|
714
|
+
})));
|
|
715
|
+
if (reasons.length === 0) return {
|
|
716
|
+
success: true,
|
|
717
|
+
message: undefined
|
|
718
|
+
};
|
|
719
|
+
throw new UnsupportedError(reasons);
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
return verifications;
|
|
719
723
|
}
|
|
720
724
|
|
|
721
725
|
//#endregion
|
|
@@ -728,7 +732,7 @@ const AddonsSchema = array(string());
|
|
|
728
732
|
const OptionsSchema$1 = strictObject({
|
|
729
733
|
cwd: string(),
|
|
730
734
|
install: union([boolean(), picklist(AGENT_NAMES)]),
|
|
731
|
-
|
|
735
|
+
gitCheck: boolean(),
|
|
732
736
|
community: optional(union([AddonsSchema, boolean()])),
|
|
733
737
|
addons: record(string(), optional(array(string())))
|
|
734
738
|
});
|
|
@@ -758,7 +762,7 @@ const add = new Command("add").description("applies specified add-ons into a pro
|
|
|
758
762
|
options: options$1
|
|
759
763
|
});
|
|
760
764
|
return prev;
|
|
761
|
-
}).option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-
|
|
765
|
+
}).option("-C, --cwd <path>", "path to working directory", defaultCwd).option("--no-git-check", "even if some files are dirty, no prompt will be shown").option("--no-install", "skip installing dependencies").addOption(installOption).configureHelp({
|
|
762
766
|
...helpConfig,
|
|
763
767
|
formatHelp(cmd, helper) {
|
|
764
768
|
const termWidth = helper.padWidth(cmd, helper);
|
|
@@ -901,7 +905,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
901
905
|
options$1.community = selected;
|
|
902
906
|
}
|
|
903
907
|
if (Array.isArray(options$1.community) && options$1.community.length > 0) {
|
|
904
|
-
const addons = options$1.community.map((id) => {
|
|
908
|
+
const addons$1 = options$1.community.map((id) => {
|
|
905
909
|
const hasDirective = Object.values(Directive).some((directive) => id.startsWith(directive));
|
|
906
910
|
if (hasDirective) return id;
|
|
907
911
|
const validAddon = communityAddonIds.includes(id);
|
|
@@ -911,7 +915,7 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
911
915
|
const { start, stop } = J();
|
|
912
916
|
try {
|
|
913
917
|
start("Resolving community add-on packages");
|
|
914
|
-
const pkgs = await Promise.all(addons.map(async (id) => {
|
|
918
|
+
const pkgs = await Promise.all(addons$1.map(async (id) => {
|
|
915
919
|
return await getPackageJSON({
|
|
916
920
|
cwd: options$1.cwd,
|
|
917
921
|
packageName: id
|
|
@@ -994,28 +998,26 @@ else if (official[addonId][id] !== undefined) throw new Error(`Incompatible '${a
|
|
|
994
998
|
});
|
|
995
999
|
}
|
|
996
1000
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
process.exit(1);
|
|
1018
|
-
}
|
|
1001
|
+
const addons = selectedAddons.map(({ addon }) => addon);
|
|
1002
|
+
const verifications = [...verifyCleanWorkingDirectory(options$1.cwd, options$1.gitCheck), ...verifyUnsupportedAddons(addons, addonSetupResults)];
|
|
1003
|
+
const fails = [];
|
|
1004
|
+
for (const verification of verifications) {
|
|
1005
|
+
const { message, success } = await verification.run();
|
|
1006
|
+
if (!success) fails.push({
|
|
1007
|
+
name: verification.name,
|
|
1008
|
+
message
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
if (fails.length > 0) {
|
|
1012
|
+
const message = fails.map(({ name: name$1, message: message$1 }) => import_picocolors$2.default.yellow(`${name$1} (${message$1})`)).join("\n- ");
|
|
1013
|
+
Ke(`- ${message}`, "Verifications not met", { format: (line) => line });
|
|
1014
|
+
const force = await ke({
|
|
1015
|
+
message: "Verifications failed. Do you wish to continue?",
|
|
1016
|
+
initialValue: false
|
|
1017
|
+
});
|
|
1018
|
+
if (Vu(force) || !force) {
|
|
1019
|
+
De("Operation cancelled.");
|
|
1020
|
+
process.exit(1);
|
|
1019
1021
|
}
|
|
1020
1022
|
}
|
|
1021
1023
|
for (const { addon, type: type$1 } of selectedAddons) {
|
|
@@ -1337,7 +1339,7 @@ async function createProject(cwd, options$1) {
|
|
|
1337
1339
|
const { nextSteps, packageManager: pm } = await runAddCommand({
|
|
1338
1340
|
cwd: projectPath,
|
|
1339
1341
|
install: options$1.install,
|
|
1340
|
-
|
|
1342
|
+
gitCheck: false,
|
|
1341
1343
|
community: [],
|
|
1342
1344
|
addons: {}
|
|
1343
1345
|
}, []);
|
package/dist/index.js
CHANGED
package/dist/shared.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"library"
|
|
29
29
|
],
|
|
30
30
|
"exclude": [],
|
|
31
|
-
"contents": "# Svelte library\n\nEverything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).\n\nRead more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```sh\n# create a new project in the current directory\nnpx sv create\n\n# create a new project in my-app\nnpx sv create my-app\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```sh\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\nEverything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.\n\n## Building\n\nTo build your library:\n\n```sh\nnpm
|
|
31
|
+
"contents": "# Svelte library\n\nEverything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).\n\nRead more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).\n\n## Creating a project\n\nIf you're seeing this, you've probably already done this step. Congrats!\n\n```sh\n# create a new project in the current directory\nnpx sv create\n\n# create a new project in my-app\nnpx sv create my-app\n```\n\n## Developing\n\nOnce you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:\n\n```sh\nnpm run dev\n\n# or start the server and open the app in a new browser tab\nnpm run dev -- --open\n```\n\nEverything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.\n\n## Building\n\nTo build your library:\n\n```sh\nnpm pack\n```\n\nTo create a production version of your showcase app:\n\n```sh\nnpm run build\n```\n\nYou can preview the production build with `npm run preview`.\n\n> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.\n\n## Publishing\n\nGo into the `package.json` and give your package the desired name through the `\"name\"` option. Also consider adding a `\"license\"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).\n\nTo publish your library to [npm](https://www.npmjs.com):\n\n```sh\nnpm publish\n```\n"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "jsconfig.json",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sv",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CLI for creating and updating SvelteKit projects",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"ps-tree": "^1.2.0",
|
|
37
37
|
"tinyexec": "^0.3.2",
|
|
38
38
|
"valibot": "^0.41.0",
|
|
39
|
+
"@sveltejs/addons": "0.0.0",
|
|
39
40
|
"@sveltejs/cli-core": "0.0.0",
|
|
40
|
-
"@sveltejs/create": "0.0.0"
|
|
41
|
-
"@sveltejs/addons": "0.0.0"
|
|
41
|
+
"@sveltejs/create": "0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"create",
|