sv 0.17.0 → 1.0.0-next.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.
@@ -83,21 +83,10 @@ type Workspace = {
83
83
  language: "ts" | "js";
84
84
  file: {
85
85
  viteConfig: "vite.config.js" | "vite.config.ts";
86
- /**
87
- * @deprecated the config no longer necessarily lives in `svelte.config.{js,ts}` (it can be
88
- * passed to `sveltekit()` in `vite.config.{js,ts}`). Use `svelteConfig` from
89
- * `@sveltejs/sv-utils` to edit it wherever it lives.
90
- */
91
- svelteConfig: "svelte.config.js" | "svelte.config.ts";
92
86
  typeConfig: "jsconfig.json" | "tsconfig.json" | undefined; /** `${directory.routes}/layout.css` or `src/app.css` */
93
87
  stylesheet: `${string}/layout.css` | "src/app.css";
94
88
  package: "package.json";
95
- gitignore: ".gitignore"; /** @deprecated use the string `.prettierignore` instead. */
96
- prettierignore: ".prettierignore"; /** @deprecated use the string `.prettierrc` instead. */
97
- prettierrc: ".prettierrc"; /** @deprecated use the string `eslint.config.js` instead. */
98
- eslintConfig: "eslint.config.js"; /** @deprecated use the string `.vscode/settings.json` instead. */
99
- vscodeSettings: ".vscode/settings.json"; /** @deprecated use the string `.vscode/extensions.json` instead. */
100
- vscodeExtensions: ".vscode/extensions.json"; /** Get the relative path between two files */
89
+ gitignore: ".gitignore"; /** Get the relative path between two files */
101
90
  getRelative: ({
102
91
  from,
103
92
  to
@@ -122,9 +111,10 @@ type Workspace = {
122
111
  //#endregion
123
112
  //#region src/core/config.d.ts
124
113
  type ConditionDefinition = (Workspace: Workspace) => boolean;
114
+ type FileEdit = (content: string) => string | false;
115
+ type FileEditMultiple = (content: string, path: string) => string | false;
125
116
  type SvApi = {
126
- /** @deprecated use `pnpm.allowBuilds` from `@sveltejs/sv-utils` instead */pnpmBuildDependency: (pkg: string) => void; /** Add a package to the dependencies. */
127
- dependency: (pkg: string, version: string) => void; /** Add a package to the dev dependencies. */
117
+ /** Add a package to the dependencies. */dependency: (pkg: string, version: string) => void; /** Add a package to the dev dependencies. */
128
118
  devDependency: (pkg: string, version: string) => void; /** Execute a command in the workspace. */
129
119
  execute: (args: string[], stdio: "inherit" | "pipe") => Promise<void>;
130
120
  /**
@@ -132,7 +122,24 @@ type SvApi = {
132
122
  *
133
123
  * Return `false` from the callback to abort - the original content is returned unchanged.
134
124
  */
135
- file: (path: string, edit: (content: string) => string | false) => void;
125
+ file: (path: string, edit: FileEdit) => void;
126
+ /**
127
+ * Edits matching files in the workspace.
128
+ * The `include` and `exclude` patterns are glob patterns relative to the workspace root.
129
+ * For each matching file, the `edit` callback is called with the file content,
130
+ * and should return the new content (or `false` to abort editing that file).
131
+ *
132
+ * Note: always adds excludes for `node_modules` and dot-prefixed directories
133
+ */
134
+ files: (options: {
135
+ /** Glob patterns to include */include: string | string[]; /** Glob patterns to exclude */
136
+ exclude?: string[];
137
+ /**
138
+ * Only run `edit` for files whose current content matches this predicate.
139
+ * Useful for avoiding expensive transforms on unrelated files.
140
+ */
141
+ where?: (content: string) => boolean;
142
+ }, edit: FileEditMultiple) => void;
136
143
  };
137
144
  type Addon<Args extends OptionDefinition, Id extends string = string, Setup extends Record<string, unknown> = Record<string, unknown>> = {
138
145
  id: Id;