sv 0.17.0 → 1.0.0-next.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 +2678 -13
- package/dist/{engine-5Sg3lJiQ.d.mts → engine-0wnzAQ2W.d.mts} +23 -15
- package/dist/{engine-B7chsCPG.mjs → engine-Cbq-kxIr.mjs} +1319 -2965
- package/dist/shared.json +6 -6
- package/dist/src/index.d.mts +5 -6
- package/dist/src/index.mjs +1 -12
- package/dist/src/testing.d.mts +3 -3
- package/dist/src/testing.mjs +1 -1
- package/dist/templates/addon/assets/src/index.js +1 -1
- package/dist/templates/addon/package.json +3 -3
- package/dist/templates/demo/files.types=checkjs.json +4 -4
- package/dist/templates/demo/files.types=none.json +4 -4
- package/dist/templates/demo/files.types=typescript.json +4 -4
- package/dist/templates/demo/package.json +8 -4
- package/dist/templates/library/package.json +9 -5
- package/dist/templates/minimal/files.types=checkjs.json +2 -2
- package/dist/templates/minimal/files.types=none.json +2 -2
- package/dist/templates/minimal/files.types=typescript.json +2 -2
- package/dist/templates/minimal/package.json +8 -4
- package/package.json +4 -5
|
@@ -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"; /**
|
|
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
|
-
/**
|
|
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,25 @@ 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:
|
|
125
|
+
file: (path: string, edit: FileEdit) => void; /** Remove a file from the workspace. Respects the migration file filter. */
|
|
126
|
+
removeFile: (path: string) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Edits matching files in the workspace.
|
|
129
|
+
* The `include` and `exclude` patterns are glob patterns relative to the workspace root.
|
|
130
|
+
* For each matching file, the `edit` callback is called with the file content,
|
|
131
|
+
* and should return the new content (or `false` to abort editing that file).
|
|
132
|
+
*
|
|
133
|
+
* Note: always adds excludes for `node_modules` and dot-prefixed directories
|
|
134
|
+
*/
|
|
135
|
+
files: (options: {
|
|
136
|
+
/** Glob patterns to include */include: string | string[]; /** Glob patterns to exclude */
|
|
137
|
+
exclude?: string[];
|
|
138
|
+
/**
|
|
139
|
+
* Only run `edit` for files whose current content matches this predicate.
|
|
140
|
+
* Useful for avoiding expensive transforms on unrelated files.
|
|
141
|
+
*/
|
|
142
|
+
where?: (content: string) => boolean;
|
|
143
|
+
}, edit: FileEditMultiple) => void;
|
|
136
144
|
};
|
|
137
145
|
type Addon<Args extends OptionDefinition, Id extends string = string, Setup extends Record<string, unknown> = Record<string, unknown>> = {
|
|
138
146
|
id: Id;
|