sv 0.13.0 → 0.13.1

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 CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { f as program, l as from, r as detectPackageManager, u as Command } from "./package-manager-BU-MLhop.mjs";
3
- import { a as helpConfig, i as forwardExitCode, n as add, o as name, r as create, s as version } from "./engine-DOKagHfI.mjs";
2
+ import { a as detectPackageManager, c as name, h as program, l as version, m as Command, n as add, o as forwardExitCode, p as from, r as create, s as helpConfig } from "./engine-lCnxwqd0.mjs";
4
3
  import { color, resolveCommand } from "@sveltejs/sv-utils";
5
4
  import process from "node:process";
6
5
  import { execSync } from "node:child_process";
@@ -81,9 +81,10 @@ type Workspace = {
81
81
  */
82
82
  dependencyVersion: (pkg: string) => string | undefined; /** to know if the workspace is using typescript or javascript */
83
83
  language: "ts" | "js";
84
- files: {
84
+ file: {
85
85
  viteConfig: "vite.config.js" | "vite.config.ts";
86
- svelteConfig: "svelte.config.js" | "svelte.config.ts"; /** `${kit.routesDirectory}/layout.css` or `src/app.css` */
86
+ svelteConfig: "svelte.config.js" | "svelte.config.ts";
87
+ typeConfig: "jsconfig.json" | "tsconfig.json" | undefined; /** `${directory.routes}/layout.css` or `src/app.css` */
87
88
  stylesheet: `${string}/layout.css` | "src/app.css";
88
89
  package: "package.json";
89
90
  gitignore: ".gitignore";
@@ -99,18 +100,21 @@ type Workspace = {
99
100
  from?: string;
100
101
  to: string;
101
102
  }) => string;
102
- }; /** If we are in a kit project, this object will contain the lib and routes directories */
103
- kit: {
104
- libDirectory: string;
105
- routesDirectory: string;
106
- } | undefined; /** The package manager used to install dependencies */
103
+ };
104
+ isKit: boolean;
105
+ directory: {
106
+ src: string; /** In SvelteKit taking `kit.files.lib` automatically. Falls back to `src/lib` in non-Kit projects */
107
+ lib: string; /** In SvelteKit taking `kit.files.routes` automatically. Falls back to `src/routes` in non-Kit projects */
108
+ kitRoutes: string;
109
+ }; /** The package manager used to install dependencies */
107
110
  packageManager: AgentName;
108
111
  };
109
112
  type CreateWorkspaceOptions = {
110
113
  cwd: string;
111
114
  packageManager?: AgentName;
112
115
  override?: {
113
- kit?: Workspace["kit"];
116
+ isKit?: boolean;
117
+ directory?: Workspace["directory"];
114
118
  dependencies: Record<string, string>;
115
119
  };
116
120
  };
@@ -138,8 +142,13 @@ type SvApi = {
138
142
  /** Add a package to the pnpm build dependencies. */pnpmBuildDependency: (pkg: string) => void; /** Add a package to the dependencies. */
139
143
  dependency: (pkg: string, version: string) => void; /** Add a package to the dev dependencies. */
140
144
  devDependency: (pkg: string, version: string) => void; /** Execute a command in the workspace. */
141
- execute: (args: string[], stdio: "inherit" | "pipe") => Promise<void>; /** Edit a file in the workspace. (will create it if it doesn't exist) */
142
- file: (path: string, edit: (content: string) => string) => void;
145
+ execute: (args: string[], stdio: "inherit" | "pipe") => Promise<void>;
146
+ /**
147
+ * Edit a file in the workspace. (will create it if it doesn't exist)
148
+ *
149
+ * Return `false` from the callback to abort - the original content is returned unchanged.
150
+ */
151
+ file: (path: string, edit: (content: string) => string | false) => void;
143
152
  };
144
153
  type Addon<Args extends OptionDefinition, Id extends string = string> = {
145
154
  id: Id;
@@ -153,7 +162,7 @@ type Addon<Args extends OptionDefinition, Id extends string = string> = {
153
162
  /** Why is this addon not supported?
154
163
  *
155
164
  * @example
156
- * if (!kit) unsupported('Requires SvelteKit');
165
+ * if (!isKit) unsupported('Requires SvelteKit');
157
166
  */
158
167
  unsupported: (reason: string) => void; /** On what official addons does this addon run after? */
159
168
  runsAfter: (name: keyof typeof officialAddons) => void;