sv 0.10.8 → 0.11.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/bin.mjs +342 -166
- package/dist/{core-B7rc0ndx.mjs → core-D6dTS6c8.mjs} +1179 -236
- package/dist/{index-BFCTEVad.d.mts → index-7xp7FWpU.d.mts} +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index2.d.mts +1 -1
- package/dist/lib/core/index.mjs +1 -1
- package/dist/lib/index.mjs +3 -3
- package/dist/lib/testing.mjs +60 -60
- package/dist/{official-BW6tJgBq.mjs → official-A2Qnog8q.mjs} +118 -26
- package/dist/{package-manager-Cn_q-LoO.mjs → package-manager-BaBHlsHz.mjs} +846 -609
- package/dist/templates/demo/files.types=checkjs.json +1 -1
- package/dist/templates/demo/files.types=none.json +1 -1
- package/dist/templates/demo/files.types=typescript.json +1 -1
- package/package.json +12 -11
package/dist/bin.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { i as __toESM } from "./chunk-BjMGrMj9.mjs";
|
|
3
|
-
import { D as dist, E as templates, O as getSharedFiles, S as resolveCommand, T as create$1, a as installOption, b as from, c as Option, f as formatFiles, i as installDependencies, l as program, m as getPackageJson, n as addPnpmBuildDependencies, o as packageManagerPrompt, p as getHighlighter, r as getUserAgent, s as Command, t as AGENT_NAMES, u as commonFilePaths, x as detect, y as up$1 } from "./package-manager-
|
|
4
|
-
import { $ as
|
|
5
|
-
import { a as setupAddons, n as officialAddons, o as createWorkspace, r as applyAddons, t as getAddonDetails } from "./official-
|
|
3
|
+
import { D as dist, E as templates, O as getSharedFiles, S as resolveCommand, T as create$1, a as installOption, b as from, c as Option, f as formatFiles, i as installDependencies, l as program, m as getPackageJson, n as addPnpmBuildDependencies, o as packageManagerPrompt, p as getHighlighter, r as getUserAgent, s as Command, t as AGENT_NAMES, u as commonFilePaths, x as detect, y as up$1 } from "./package-manager-BaBHlsHz.mjs";
|
|
4
|
+
import { $ as Fe, F as create$2, I as overrideProperties, O as addDefault, Q as De, X as walk, a as toFragment, at as We, ct as ke, dt as require_picocolors, et as Ge, g as parseSvelte, h as parseScript, it as Ue, lt as ze, m as parseJson, nt as Ke, o as isVersionUnsupportedBelow, r as ensureScript, rt as T, st as et, tt as J, ut as Vu, w as createDefault } from "./core-D6dTS6c8.mjs";
|
|
5
|
+
import { a as setupAddons, n as officialAddons, o as createWorkspace, r as applyAddons, t as getAddonDetails } from "./official-A2Qnog8q.mjs";
|
|
6
6
|
import fs, { existsSync } from "node:fs";
|
|
7
7
|
import path, { dirname, join } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
@@ -14,7 +14,7 @@ import { pipeline } from "node:stream/promises";
|
|
|
14
14
|
|
|
15
15
|
//#region package.json
|
|
16
16
|
var name = "sv";
|
|
17
|
-
var version = "0.
|
|
17
|
+
var version = "0.11.0";
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region lib/addons/_config/community.ts
|
|
@@ -26,7 +26,7 @@ async function getCommunityAddon(name$1) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region ../../node_modules/.pnpm/empathic@
|
|
29
|
+
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/package.mjs
|
|
30
30
|
/**
|
|
31
31
|
* Find the closest "package.json" file while walking parent directories.
|
|
32
32
|
* @returns The absolute path to a "package.json", if found.
|
|
@@ -36,29 +36,72 @@ function up(options$1) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
//#endregion
|
|
39
|
-
//#region ../../node_modules/.pnpm/valibot@
|
|
39
|
+
//#region ../../node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.mjs
|
|
40
40
|
var import_picocolors$3 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
let store$4;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the global configuration.
|
|
44
|
+
*
|
|
45
|
+
* @param config The config to merge.
|
|
46
|
+
*
|
|
47
|
+
* @returns The configuration.
|
|
48
|
+
*/
|
|
49
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
50
|
+
function getGlobalConfig(config$1) {
|
|
43
51
|
return {
|
|
44
|
-
lang:
|
|
45
|
-
message:
|
|
46
|
-
abortEarly:
|
|
47
|
-
abortPipeEarly:
|
|
52
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
53
|
+
message: config$1?.message,
|
|
54
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
55
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
48
56
|
};
|
|
49
57
|
}
|
|
50
|
-
|
|
58
|
+
let store$3;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a global error message.
|
|
61
|
+
*
|
|
62
|
+
* @param lang The language of the message.
|
|
63
|
+
*
|
|
64
|
+
* @returns The error message.
|
|
65
|
+
*/
|
|
66
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
51
67
|
function getGlobalMessage(lang) {
|
|
52
|
-
return
|
|
68
|
+
return store$3?.get(lang);
|
|
53
69
|
}
|
|
54
|
-
|
|
70
|
+
let store$2;
|
|
71
|
+
/**
|
|
72
|
+
* Returns a schema error message.
|
|
73
|
+
*
|
|
74
|
+
* @param lang The language of the message.
|
|
75
|
+
*
|
|
76
|
+
* @returns The error message.
|
|
77
|
+
*/
|
|
78
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
55
79
|
function getSchemaMessage(lang) {
|
|
56
|
-
return
|
|
80
|
+
return store$2?.get(lang);
|
|
57
81
|
}
|
|
58
|
-
|
|
82
|
+
let store$1;
|
|
83
|
+
/**
|
|
84
|
+
* Returns a specific error message.
|
|
85
|
+
*
|
|
86
|
+
* @param reference The identifier reference.
|
|
87
|
+
* @param lang The language of the message.
|
|
88
|
+
*
|
|
89
|
+
* @returns The error message.
|
|
90
|
+
*/
|
|
91
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
59
92
|
function getSpecificMessage(reference, lang) {
|
|
60
|
-
return
|
|
93
|
+
return store$1?.get(reference)?.get(lang);
|
|
61
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Stringifies an unknown input to a literal or type string.
|
|
97
|
+
*
|
|
98
|
+
* @param input The unknown input.
|
|
99
|
+
*
|
|
100
|
+
* @returns A literal or type string.
|
|
101
|
+
*
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
62
105
|
function _stringify(input) {
|
|
63
106
|
const type = typeof input;
|
|
64
107
|
if (type === "string") return `"${input}"`;
|
|
@@ -66,10 +109,21 @@ function _stringify(input) {
|
|
|
66
109
|
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
67
110
|
return type;
|
|
68
111
|
}
|
|
69
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Adds an issue to the dataset.
|
|
114
|
+
*
|
|
115
|
+
* @param context The issue context.
|
|
116
|
+
* @param label The issue label.
|
|
117
|
+
* @param dataset The input dataset.
|
|
118
|
+
* @param config The configuration.
|
|
119
|
+
* @param other The optional props.
|
|
120
|
+
*
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
70
124
|
const input = other && "input" in other ? other.input : dataset.value;
|
|
71
125
|
const expected = other?.expected ?? context.expects ?? null;
|
|
72
|
-
const received = other?.received ?? _stringify(input);
|
|
126
|
+
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
73
127
|
const issue = {
|
|
74
128
|
kind: context.kind,
|
|
75
129
|
type: context.type,
|
|
@@ -80,30 +134,69 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
80
134
|
requirement: context.requirement,
|
|
81
135
|
path: other?.path,
|
|
82
136
|
issues: other?.issues,
|
|
83
|
-
lang:
|
|
84
|
-
abortEarly:
|
|
85
|
-
abortPipeEarly:
|
|
137
|
+
lang: config$1.lang,
|
|
138
|
+
abortEarly: config$1.abortEarly,
|
|
139
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
86
140
|
};
|
|
87
141
|
const isSchema = context.kind === "schema";
|
|
88
|
-
const message = other?.message ?? context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ??
|
|
89
|
-
if (message) issue.message = typeof message === "function" ? message(issue) : message;
|
|
142
|
+
const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
143
|
+
if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
90
144
|
if (isSchema) dataset.typed = false;
|
|
91
145
|
if (dataset.issues) dataset.issues.push(issue);
|
|
92
146
|
else dataset.issues = [issue];
|
|
93
147
|
}
|
|
94
|
-
|
|
95
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Returns the Standard Schema properties.
|
|
150
|
+
*
|
|
151
|
+
* @param context The schema context.
|
|
152
|
+
*
|
|
153
|
+
* @returns The Standard Schema properties.
|
|
154
|
+
*/
|
|
155
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
156
|
+
function _getStandardProps(context) {
|
|
157
|
+
return {
|
|
158
|
+
version: 1,
|
|
159
|
+
vendor: "valibot",
|
|
160
|
+
validate(value$1) {
|
|
161
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
162
|
+
}
|
|
163
|
+
};
|
|
96
164
|
}
|
|
97
|
-
|
|
98
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Disallows inherited object properties and prevents object prototype
|
|
167
|
+
* pollution by disallowing certain keys.
|
|
168
|
+
*
|
|
169
|
+
* @param object The object to check.
|
|
170
|
+
* @param key The key to check.
|
|
171
|
+
*
|
|
172
|
+
* @returns Whether the key is allowed.
|
|
173
|
+
*
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
176
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
177
|
+
function _isValidObjectKey(object$1, key) {
|
|
178
|
+
return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Joins multiple `expects` values with the given separator.
|
|
182
|
+
*
|
|
183
|
+
* @param values The `expects` values.
|
|
184
|
+
* @param separator The separator.
|
|
185
|
+
*
|
|
186
|
+
* @returns The joined `expects` property.
|
|
187
|
+
*
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
191
|
+
function _joinExpects(values$1, separator) {
|
|
192
|
+
const list = [...new Set(values$1)];
|
|
99
193
|
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
100
194
|
return list[0] ?? "never";
|
|
101
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* A Valibot error with useful information.
|
|
198
|
+
*/
|
|
102
199
|
var ValiError = class extends Error {
|
|
103
|
-
/**
|
|
104
|
-
* The error issues.
|
|
105
|
-
*/
|
|
106
|
-
issues;
|
|
107
200
|
/**
|
|
108
201
|
* Creates a Valibot error with useful information.
|
|
109
202
|
*
|
|
@@ -115,6 +208,14 @@ var ValiError = class extends Error {
|
|
|
115
208
|
this.issues = issues;
|
|
116
209
|
}
|
|
117
210
|
};
|
|
211
|
+
/**
|
|
212
|
+
* Creates a custom transformation action.
|
|
213
|
+
*
|
|
214
|
+
* @param operation The transformation operation.
|
|
215
|
+
*
|
|
216
|
+
* @returns A transform action.
|
|
217
|
+
*/
|
|
218
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
118
219
|
function transform(operation) {
|
|
119
220
|
return {
|
|
120
221
|
kind: "transformation",
|
|
@@ -122,16 +223,40 @@ function transform(operation) {
|
|
|
122
223
|
reference: transform,
|
|
123
224
|
async: false,
|
|
124
225
|
operation,
|
|
125
|
-
|
|
226
|
+
"~run"(dataset) {
|
|
126
227
|
dataset.value = this.operation(dataset.value);
|
|
127
228
|
return dataset;
|
|
128
229
|
}
|
|
129
230
|
};
|
|
130
231
|
}
|
|
131
|
-
|
|
132
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Returns the fallback value of the schema.
|
|
234
|
+
*
|
|
235
|
+
* @param schema The schema to get it from.
|
|
236
|
+
* @param dataset The output dataset if available.
|
|
237
|
+
* @param config The config if available.
|
|
238
|
+
*
|
|
239
|
+
* @returns The fallback value.
|
|
240
|
+
*/
|
|
241
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
242
|
+
function getFallback(schema, dataset, config$1) {
|
|
243
|
+
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Returns the default value of the schema.
|
|
247
|
+
*
|
|
248
|
+
* @param schema The schema to get it from.
|
|
249
|
+
* @param dataset The input dataset if available.
|
|
250
|
+
* @param config The config if available.
|
|
251
|
+
*
|
|
252
|
+
* @returns The default value.
|
|
253
|
+
*/
|
|
254
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
255
|
+
function getDefault(schema, dataset, config$1) {
|
|
256
|
+
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
133
257
|
}
|
|
134
|
-
|
|
258
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
259
|
+
function array(item, message$1) {
|
|
135
260
|
return {
|
|
136
261
|
kind: "schema",
|
|
137
262
|
type: "array",
|
|
@@ -139,25 +264,25 @@ function array(item, message) {
|
|
|
139
264
|
expects: "Array",
|
|
140
265
|
async: false,
|
|
141
266
|
item,
|
|
142
|
-
message,
|
|
143
|
-
|
|
267
|
+
message: message$1,
|
|
268
|
+
get "~standard"() {
|
|
269
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
270
|
+
},
|
|
271
|
+
"~run"(dataset, config$1) {
|
|
144
272
|
const input = dataset.value;
|
|
145
273
|
if (Array.isArray(input)) {
|
|
146
274
|
dataset.typed = true;
|
|
147
275
|
dataset.value = [];
|
|
148
276
|
for (let key = 0; key < input.length; key++) {
|
|
149
|
-
const
|
|
150
|
-
const itemDataset = this.item
|
|
151
|
-
typed: false,
|
|
152
|
-
value: value2
|
|
153
|
-
}, config2);
|
|
277
|
+
const value$1 = input[key];
|
|
278
|
+
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
154
279
|
if (itemDataset.issues) {
|
|
155
280
|
const pathItem = {
|
|
156
281
|
type: "array",
|
|
157
282
|
origin: "value",
|
|
158
283
|
input,
|
|
159
284
|
key,
|
|
160
|
-
value:
|
|
285
|
+
value: value$1
|
|
161
286
|
};
|
|
162
287
|
for (const issue of itemDataset.issues) {
|
|
163
288
|
if (issue.path) issue.path.unshift(pathItem);
|
|
@@ -165,7 +290,7 @@ function array(item, message) {
|
|
|
165
290
|
dataset.issues?.push(issue);
|
|
166
291
|
}
|
|
167
292
|
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
168
|
-
if (
|
|
293
|
+
if (config$1.abortEarly) {
|
|
169
294
|
dataset.typed = false;
|
|
170
295
|
break;
|
|
171
296
|
}
|
|
@@ -173,65 +298,77 @@ function array(item, message) {
|
|
|
173
298
|
if (!itemDataset.typed) dataset.typed = false;
|
|
174
299
|
dataset.value.push(itemDataset.value);
|
|
175
300
|
}
|
|
176
|
-
} else _addIssue(this, "type", dataset,
|
|
301
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
177
302
|
return dataset;
|
|
178
303
|
}
|
|
179
304
|
};
|
|
180
305
|
}
|
|
181
|
-
|
|
306
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
307
|
+
function boolean(message$1) {
|
|
182
308
|
return {
|
|
183
309
|
kind: "schema",
|
|
184
310
|
type: "boolean",
|
|
185
311
|
reference: boolean,
|
|
186
312
|
expects: "boolean",
|
|
187
313
|
async: false,
|
|
188
|
-
message,
|
|
189
|
-
|
|
314
|
+
message: message$1,
|
|
315
|
+
get "~standard"() {
|
|
316
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
317
|
+
},
|
|
318
|
+
"~run"(dataset, config$1) {
|
|
190
319
|
if (typeof dataset.value === "boolean") dataset.typed = true;
|
|
191
|
-
else _addIssue(this, "type", dataset,
|
|
320
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
192
321
|
return dataset;
|
|
193
322
|
}
|
|
194
323
|
};
|
|
195
324
|
}
|
|
196
|
-
|
|
197
|
-
|
|
325
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
326
|
+
function optional(wrapped, default_) {
|
|
327
|
+
return {
|
|
198
328
|
kind: "schema",
|
|
199
329
|
type: "optional",
|
|
200
330
|
reference: optional,
|
|
201
331
|
expects: `(${wrapped.expects} | undefined)`,
|
|
202
332
|
async: false,
|
|
203
333
|
wrapped,
|
|
204
|
-
|
|
334
|
+
default: default_,
|
|
335
|
+
get "~standard"() {
|
|
336
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
337
|
+
},
|
|
338
|
+
"~run"(dataset, config$1) {
|
|
205
339
|
if (dataset.value === void 0) {
|
|
206
|
-
if (
|
|
340
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
207
341
|
if (dataset.value === void 0) {
|
|
208
342
|
dataset.typed = true;
|
|
209
343
|
return dataset;
|
|
210
344
|
}
|
|
211
345
|
}
|
|
212
|
-
return this.wrapped
|
|
346
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
213
347
|
}
|
|
214
348
|
};
|
|
215
|
-
if (0 in args) schema.default = args[0];
|
|
216
|
-
return schema;
|
|
217
349
|
}
|
|
218
|
-
|
|
350
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
351
|
+
function picklist(options$1, message$1) {
|
|
219
352
|
return {
|
|
220
353
|
kind: "schema",
|
|
221
354
|
type: "picklist",
|
|
222
355
|
reference: picklist,
|
|
223
|
-
expects: _joinExpects(options$1.map(_stringify), "|"),
|
|
356
|
+
expects: /* @__PURE__ */ _joinExpects(options$1.map(_stringify), "|"),
|
|
224
357
|
async: false,
|
|
225
358
|
options: options$1,
|
|
226
|
-
message,
|
|
227
|
-
|
|
359
|
+
message: message$1,
|
|
360
|
+
get "~standard"() {
|
|
361
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
362
|
+
},
|
|
363
|
+
"~run"(dataset, config$1) {
|
|
228
364
|
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
229
|
-
else _addIssue(this, "type", dataset,
|
|
365
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
230
366
|
return dataset;
|
|
231
367
|
}
|
|
232
368
|
};
|
|
233
369
|
}
|
|
234
|
-
|
|
370
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
371
|
+
function record(key, value$1, message$1) {
|
|
235
372
|
return {
|
|
236
373
|
kind: "schema",
|
|
237
374
|
type: "record",
|
|
@@ -239,19 +376,19 @@ function record(key, value2, message) {
|
|
|
239
376
|
expects: "Object",
|
|
240
377
|
async: false,
|
|
241
378
|
key,
|
|
242
|
-
value:
|
|
243
|
-
message,
|
|
244
|
-
|
|
379
|
+
value: value$1,
|
|
380
|
+
message: message$1,
|
|
381
|
+
get "~standard"() {
|
|
382
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
383
|
+
},
|
|
384
|
+
"~run"(dataset, config$1) {
|
|
245
385
|
const input = dataset.value;
|
|
246
386
|
if (input && typeof input === "object") {
|
|
247
387
|
dataset.typed = true;
|
|
248
388
|
dataset.value = {};
|
|
249
|
-
for (const entryKey in input) if (_isValidObjectKey(input, entryKey)) {
|
|
389
|
+
for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
250
390
|
const entryValue = input[entryKey];
|
|
251
|
-
const keyDataset = this.key
|
|
252
|
-
typed: false,
|
|
253
|
-
value: entryKey
|
|
254
|
-
}, config2);
|
|
391
|
+
const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
|
|
255
392
|
if (keyDataset.issues) {
|
|
256
393
|
const pathItem = {
|
|
257
394
|
type: "object",
|
|
@@ -265,15 +402,12 @@ function record(key, value2, message) {
|
|
|
265
402
|
dataset.issues?.push(issue);
|
|
266
403
|
}
|
|
267
404
|
if (!dataset.issues) dataset.issues = keyDataset.issues;
|
|
268
|
-
if (
|
|
405
|
+
if (config$1.abortEarly) {
|
|
269
406
|
dataset.typed = false;
|
|
270
407
|
break;
|
|
271
408
|
}
|
|
272
409
|
}
|
|
273
|
-
const valueDataset = this.value
|
|
274
|
-
typed: false,
|
|
275
|
-
value: entryValue
|
|
276
|
-
}, config2);
|
|
410
|
+
const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
|
|
277
411
|
if (valueDataset.issues) {
|
|
278
412
|
const pathItem = {
|
|
279
413
|
type: "object",
|
|
@@ -288,7 +422,7 @@ function record(key, value2, message) {
|
|
|
288
422
|
dataset.issues?.push(issue);
|
|
289
423
|
}
|
|
290
424
|
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
291
|
-
if (
|
|
425
|
+
if (config$1.abortEarly) {
|
|
292
426
|
dataset.typed = false;
|
|
293
427
|
break;
|
|
294
428
|
}
|
|
@@ -296,114 +430,146 @@ function record(key, value2, message) {
|
|
|
296
430
|
if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
|
|
297
431
|
if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
|
|
298
432
|
}
|
|
299
|
-
} else _addIssue(this, "type", dataset,
|
|
433
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
300
434
|
return dataset;
|
|
301
435
|
}
|
|
302
436
|
};
|
|
303
437
|
}
|
|
304
|
-
|
|
438
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
439
|
+
function strictObject(entries$1, message$1) {
|
|
305
440
|
return {
|
|
306
441
|
kind: "schema",
|
|
307
442
|
type: "strict_object",
|
|
308
443
|
reference: strictObject,
|
|
309
444
|
expects: "Object",
|
|
310
445
|
async: false,
|
|
311
|
-
entries,
|
|
312
|
-
message,
|
|
313
|
-
|
|
446
|
+
entries: entries$1,
|
|
447
|
+
message: message$1,
|
|
448
|
+
get "~standard"() {
|
|
449
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
450
|
+
},
|
|
451
|
+
"~run"(dataset, config$1) {
|
|
314
452
|
const input = dataset.value;
|
|
315
453
|
if (input && typeof input === "object") {
|
|
316
454
|
dataset.typed = true;
|
|
317
455
|
dataset.value = {};
|
|
318
456
|
for (const key in this.entries) {
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
value:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
457
|
+
const valueSchema = this.entries[key];
|
|
458
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
459
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
460
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
461
|
+
if (valueDataset.issues) {
|
|
462
|
+
const pathItem = {
|
|
463
|
+
type: "object",
|
|
464
|
+
origin: "value",
|
|
465
|
+
input,
|
|
466
|
+
key,
|
|
467
|
+
value: value$1
|
|
468
|
+
};
|
|
469
|
+
for (const issue of valueDataset.issues) {
|
|
470
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
471
|
+
else issue.path = [pathItem];
|
|
472
|
+
dataset.issues?.push(issue);
|
|
473
|
+
}
|
|
474
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
475
|
+
if (config$1.abortEarly) {
|
|
476
|
+
dataset.typed = false;
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
341
479
|
}
|
|
480
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
481
|
+
dataset.value[key] = valueDataset.value;
|
|
482
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
483
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
484
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
485
|
+
input: void 0,
|
|
486
|
+
expected: `"${key}"`,
|
|
487
|
+
path: [{
|
|
488
|
+
type: "object",
|
|
489
|
+
origin: "key",
|
|
490
|
+
input,
|
|
491
|
+
key,
|
|
492
|
+
value: input[key]
|
|
493
|
+
}]
|
|
494
|
+
});
|
|
495
|
+
if (config$1.abortEarly) break;
|
|
342
496
|
}
|
|
343
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
344
|
-
if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
|
|
345
497
|
}
|
|
346
|
-
if (!dataset.issues || !
|
|
498
|
+
if (!dataset.issues || !config$1.abortEarly) {
|
|
347
499
|
for (const key in input) if (!(key in this.entries)) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
input: value2,
|
|
500
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
501
|
+
input: key,
|
|
351
502
|
expected: "never",
|
|
352
503
|
path: [{
|
|
353
504
|
type: "object",
|
|
354
|
-
origin: "
|
|
505
|
+
origin: "key",
|
|
355
506
|
input,
|
|
356
507
|
key,
|
|
357
|
-
value:
|
|
508
|
+
value: input[key]
|
|
358
509
|
}]
|
|
359
510
|
});
|
|
360
511
|
break;
|
|
361
512
|
}
|
|
362
513
|
}
|
|
363
|
-
} else _addIssue(this, "type", dataset,
|
|
514
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
364
515
|
return dataset;
|
|
365
516
|
}
|
|
366
517
|
};
|
|
367
518
|
}
|
|
368
|
-
|
|
519
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
520
|
+
function string(message$1) {
|
|
369
521
|
return {
|
|
370
522
|
kind: "schema",
|
|
371
523
|
type: "string",
|
|
372
524
|
reference: string,
|
|
373
525
|
expects: "string",
|
|
374
526
|
async: false,
|
|
375
|
-
message,
|
|
376
|
-
|
|
527
|
+
message: message$1,
|
|
528
|
+
get "~standard"() {
|
|
529
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
530
|
+
},
|
|
531
|
+
"~run"(dataset, config$1) {
|
|
377
532
|
if (typeof dataset.value === "string") dataset.typed = true;
|
|
378
|
-
else _addIssue(this, "type", dataset,
|
|
533
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
379
534
|
return dataset;
|
|
380
535
|
}
|
|
381
536
|
};
|
|
382
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Returns the sub issues of the provided datasets for the union issue.
|
|
540
|
+
*
|
|
541
|
+
* @param datasets The datasets.
|
|
542
|
+
*
|
|
543
|
+
* @returns The sub issues.
|
|
544
|
+
*
|
|
545
|
+
* @internal
|
|
546
|
+
*/
|
|
547
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
383
548
|
function _subIssues(datasets) {
|
|
384
549
|
let issues;
|
|
385
550
|
if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
|
|
386
551
|
else issues = dataset.issues;
|
|
387
552
|
return issues;
|
|
388
553
|
}
|
|
389
|
-
|
|
554
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
555
|
+
function union(options$1, message$1) {
|
|
390
556
|
return {
|
|
391
557
|
kind: "schema",
|
|
392
558
|
type: "union",
|
|
393
559
|
reference: union,
|
|
394
|
-
expects: _joinExpects(options$1.map((option) => option.expects), "|"),
|
|
560
|
+
expects: /* @__PURE__ */ _joinExpects(options$1.map((option) => option.expects), "|"),
|
|
395
561
|
async: false,
|
|
396
562
|
options: options$1,
|
|
397
|
-
message,
|
|
398
|
-
|
|
563
|
+
message: message$1,
|
|
564
|
+
get "~standard"() {
|
|
565
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
566
|
+
},
|
|
567
|
+
"~run"(dataset, config$1) {
|
|
399
568
|
let validDataset;
|
|
400
569
|
let typedDatasets;
|
|
401
570
|
let untypedDatasets;
|
|
402
571
|
for (const schema of this.options) {
|
|
403
|
-
const optionDataset = schema
|
|
404
|
-
typed: false,
|
|
405
|
-
value: dataset.value
|
|
406
|
-
}, config2);
|
|
572
|
+
const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
|
|
407
573
|
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
408
574
|
else typedDatasets = [optionDataset];
|
|
409
575
|
else {
|
|
@@ -416,33 +582,43 @@ function union(options$1, message) {
|
|
|
416
582
|
if (validDataset) return validDataset;
|
|
417
583
|
if (typedDatasets) {
|
|
418
584
|
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
419
|
-
_addIssue(this, "type", dataset,
|
|
585
|
+
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
420
586
|
dataset.typed = true;
|
|
421
587
|
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
422
|
-
else _addIssue(this, "type", dataset,
|
|
588
|
+
else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
423
589
|
return dataset;
|
|
424
590
|
}
|
|
425
591
|
};
|
|
426
592
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
593
|
+
/**
|
|
594
|
+
* Parses an unknown input based on a schema.
|
|
595
|
+
*
|
|
596
|
+
* @param schema The schema to be used.
|
|
597
|
+
* @param input The input to be parsed.
|
|
598
|
+
* @param config The parse configuration.
|
|
599
|
+
*
|
|
600
|
+
* @returns The parsed input.
|
|
601
|
+
*/
|
|
602
|
+
function parse(schema, input, config$1) {
|
|
603
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
432
604
|
if (dataset.issues) throw new ValiError(dataset.issues);
|
|
433
605
|
return dataset.value;
|
|
434
606
|
}
|
|
435
|
-
|
|
607
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
608
|
+
function pipe(...pipe$1) {
|
|
436
609
|
return {
|
|
437
|
-
...
|
|
438
|
-
pipe:
|
|
439
|
-
|
|
440
|
-
|
|
610
|
+
...pipe$1[0],
|
|
611
|
+
pipe: pipe$1,
|
|
612
|
+
get "~standard"() {
|
|
613
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
614
|
+
},
|
|
615
|
+
"~run"(dataset, config$1) {
|
|
616
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
441
617
|
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
442
618
|
dataset.typed = false;
|
|
443
619
|
break;
|
|
444
620
|
}
|
|
445
|
-
if (!dataset.issues || !
|
|
621
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
446
622
|
}
|
|
447
623
|
return dataset;
|
|
448
624
|
}
|
|
@@ -562,13 +738,13 @@ function errorAndExit(message) {
|
|
|
562
738
|
|
|
563
739
|
//#endregion
|
|
564
740
|
//#region lib/cli/add/verifiers.ts
|
|
565
|
-
function verifyCleanWorkingDirectory(cwd, gitCheck) {
|
|
741
|
+
function verifyCleanWorkingDirectory(cwd$1, gitCheck) {
|
|
566
742
|
const verifications = [];
|
|
567
743
|
if (gitCheck) verifications.push({
|
|
568
744
|
name: "clean working directory",
|
|
569
745
|
run: async () => {
|
|
570
746
|
try {
|
|
571
|
-
const { stdout: stdout$1 } = await promisify(exec)("git status --short", { cwd });
|
|
747
|
+
const { stdout: stdout$1 } = await promisify(exec)("git status --short", { cwd: cwd$1 });
|
|
572
748
|
if (stdout$1) return {
|
|
573
749
|
success: false,
|
|
574
750
|
message: "Found modified files"
|
|
@@ -647,10 +823,10 @@ async function downloadPackage(options$1) {
|
|
|
647
823
|
const { default: details } = await import(pkg.name);
|
|
648
824
|
return details;
|
|
649
825
|
}
|
|
650
|
-
async function getPackageJSON({ cwd, packageName }) {
|
|
826
|
+
async function getPackageJSON({ cwd: cwd$1, packageName }) {
|
|
651
827
|
let npm = packageName;
|
|
652
828
|
if (packageName.startsWith(Directive.file)) {
|
|
653
|
-
const pkgPath = path.resolve(cwd, packageName.slice(Directive.file.length));
|
|
829
|
+
const pkgPath = path.resolve(cwd$1, packageName.slice(Directive.file.length));
|
|
654
830
|
const pkgJSONPath = path.resolve(pkgPath, "package.json");
|
|
655
831
|
const json = fs.readFileSync(pkgJSONPath, "utf8");
|
|
656
832
|
const pkg$1 = JSON.parse(json);
|
|
@@ -1183,7 +1359,7 @@ function getOptionChoices(details) {
|
|
|
1183
1359
|
groups
|
|
1184
1360
|
};
|
|
1185
1361
|
}
|
|
1186
|
-
async function resolveCommunityAddons(cwd, community) {
|
|
1362
|
+
async function resolveCommunityAddons(cwd$1, community) {
|
|
1187
1363
|
const selectedAddons = [];
|
|
1188
1364
|
const addons = community.map((id) => {
|
|
1189
1365
|
if (Object.values(Directive).some((directive) => id.startsWith(directive))) return id;
|
|
@@ -1195,7 +1371,7 @@ async function resolveCommunityAddons(cwd, community) {
|
|
|
1195
1371
|
start("Resolving community add-on packages");
|
|
1196
1372
|
const pkgs = await Promise.all(addons.map(async (id) => {
|
|
1197
1373
|
return await getPackageJSON({
|
|
1198
|
-
cwd,
|
|
1374
|
+
cwd: cwd$1,
|
|
1199
1375
|
packageName: id
|
|
1200
1376
|
});
|
|
1201
1377
|
}));
|
|
@@ -1316,13 +1492,13 @@ function extractPackageVersion(pkgName) {
|
|
|
1316
1492
|
if (pkgName.includes("@", 1)) [, version$1] = pkgName.split("@");
|
|
1317
1493
|
return version$1;
|
|
1318
1494
|
}
|
|
1319
|
-
function setupPlaygroundProject(url, playground, cwd, installDependencies$1) {
|
|
1495
|
+
function setupPlaygroundProject(url, playground, cwd$1, installDependencies$1) {
|
|
1320
1496
|
const mainFile = playground.files.find((file) => file.name === "App.svelte");
|
|
1321
1497
|
if (!mainFile) throw new Error("Failed to find `App.svelte` entrypoint.");
|
|
1322
1498
|
const dependencies = detectPlaygroundDependencies(playground.files);
|
|
1323
1499
|
for (const file of playground.files) {
|
|
1324
1500
|
for (const [pkg, version$1] of dependencies) if (version$1 !== "latest") file.content = file.content.replaceAll(`${pkg}@${version$1}`, pkg);
|
|
1325
|
-
const filePath$1 = path.join(cwd, "src", "lib", "playground", file.name);
|
|
1501
|
+
const filePath$1 = path.join(cwd$1, "src", "lib", "playground", file.name);
|
|
1326
1502
|
fs.mkdirSync(path.dirname(filePath$1), { recursive: true });
|
|
1327
1503
|
fs.writeFileSync(filePath$1, file.content, "utf8");
|
|
1328
1504
|
}
|
|
@@ -1343,10 +1519,10 @@ function setupPlaygroundProject(url, playground, cwd, installDependencies$1) {
|
|
|
1343
1519
|
} });
|
|
1344
1520
|
contentToWrite = generateCode$1();
|
|
1345
1521
|
}
|
|
1346
|
-
fs.writeFileSync(path.join(cwd, file.name), contentToWrite, "utf-8");
|
|
1522
|
+
fs.writeFileSync(path.join(cwd$1, file.name), contentToWrite, "utf-8");
|
|
1347
1523
|
}
|
|
1348
1524
|
}
|
|
1349
|
-
const filePath = path.join(cwd, "src/routes/+page.svelte");
|
|
1525
|
+
const filePath = path.join(cwd$1, "src/routes/+page.svelte");
|
|
1350
1526
|
const { ast, generateCode } = parseSvelte(fs.readFileSync(filePath, "utf-8"));
|
|
1351
1527
|
const scriptAst = ensureScript(ast);
|
|
1352
1528
|
addDefault(scriptAst, {
|
|
@@ -1362,7 +1538,7 @@ function setupPlaygroundProject(url, playground, cwd, installDependencies$1) {
|
|
|
1362
1538
|
</PlaygroundLayout>`));
|
|
1363
1539
|
const newContent = generateCode();
|
|
1364
1540
|
fs.writeFileSync(filePath, newContent, "utf-8");
|
|
1365
|
-
const pkgPath = path.join(cwd, "package.json");
|
|
1541
|
+
const pkgPath = path.join(cwd$1, "package.json");
|
|
1366
1542
|
const pkgJson = parseJson(fs.readFileSync(pkgPath, "utf-8"));
|
|
1367
1543
|
let updatePackageJson = false;
|
|
1368
1544
|
if (installDependencies$1 && dependencies.size >= 0) {
|
|
@@ -1372,7 +1548,7 @@ function setupPlaygroundProject(url, playground, cwd, installDependencies$1) {
|
|
|
1372
1548
|
}
|
|
1373
1549
|
let experimentalAsyncNeeded = true;
|
|
1374
1550
|
const addExperimentalAsync = () => {
|
|
1375
|
-
const svelteConfigPath = path.join(cwd, "svelte.config.js");
|
|
1551
|
+
const svelteConfigPath = path.join(cwd$1, "svelte.config.js");
|
|
1376
1552
|
const { ast: ast$1, generateCode: generateCode$1 } = parseScript(fs.readFileSync(svelteConfigPath, "utf-8"));
|
|
1377
1553
|
const { value: config } = createDefault(ast$1, { fallback: create$2({}) });
|
|
1378
1554
|
overrideProperties(config, { compilerOptions: { experimental: { async: true } } });
|
|
@@ -1416,14 +1592,14 @@ const OptionsSchema = strictObject({
|
|
|
1416
1592
|
dirCheck: boolean()
|
|
1417
1593
|
});
|
|
1418
1594
|
const create = new Command("create").description("scaffolds a new SvelteKit project").argument("[path]", "where the project will be created").addOption(templateOption).addOption(langOption).option("--no-types").addOption(noAddonsOption).addOption(addOption).option("--no-install", "skip installing dependencies").option("--from-playground <url>", "create a project from the svelte playground").option("--no-dir-check", "even if the folder is not empty, no prompt will be shown").addOption(installOption).configureHelp(helpConfig).action((projectPath, opts) => {
|
|
1419
|
-
const cwd = parse(ProjectPathSchema, projectPath);
|
|
1595
|
+
const cwd$1 = parse(ProjectPathSchema, projectPath);
|
|
1420
1596
|
const options$1 = parse(OptionsSchema, opts);
|
|
1421
1597
|
if (options$1.fromPlayground && !validatePlaygroundUrl(options$1.fromPlayground)) {
|
|
1422
1598
|
console.error(import_picocolors$1.default.red(`Error: Invalid playground URL: ${options$1.fromPlayground}`));
|
|
1423
1599
|
process.exit(1);
|
|
1424
1600
|
}
|
|
1425
1601
|
runCommand(async () => {
|
|
1426
|
-
const { directory, addOnNextSteps, packageManager } = await createProject(cwd, options$1);
|
|
1602
|
+
const { directory, addOnNextSteps, packageManager } = await createProject(cwd$1, options$1);
|
|
1427
1603
|
const highlight = (str) => import_picocolors$1.default.bold(import_picocolors$1.default.cyan(str));
|
|
1428
1604
|
let i = 1;
|
|
1429
1605
|
const initialSteps = ["📁 Project steps", ""];
|
|
@@ -1456,12 +1632,12 @@ const create = new Command("create").description("scaffolds a new SvelteKit proj
|
|
|
1456
1632
|
Ke(steps.join("\n"), "What's next?", { format: (line) => line });
|
|
1457
1633
|
});
|
|
1458
1634
|
}).showHelpAfterError(true);
|
|
1459
|
-
async function createProject(cwd, options$1) {
|
|
1635
|
+
async function createProject(cwd$1, options$1) {
|
|
1460
1636
|
if (options$1.fromPlayground) T.warn("The Svelte maintainers have not reviewed playgrounds for malicious code. Use at your discretion.");
|
|
1461
1637
|
const { directory, template, language } = await We({
|
|
1462
1638
|
directory: () => {
|
|
1463
1639
|
const defaultPath = "./";
|
|
1464
|
-
if (cwd) return Promise.resolve(cwd);
|
|
1640
|
+
if (cwd$1) return Promise.resolve(cwd$1);
|
|
1465
1641
|
return et({
|
|
1466
1642
|
message: "Where would you like your project to be created?",
|
|
1467
1643
|
placeholder: ` (hit Enter to use '${defaultPath}')`,
|
|
@@ -1603,10 +1779,10 @@ async function createProject(cwd, options$1) {
|
|
|
1603
1779
|
packageManager
|
|
1604
1780
|
};
|
|
1605
1781
|
}
|
|
1606
|
-
async function createProjectFromPlayground(url, cwd) {
|
|
1782
|
+
async function createProjectFromPlayground(url, cwd$1) {
|
|
1607
1783
|
const playground = await downloadPlaygroundData(parsePlaygroundUrl(url));
|
|
1608
1784
|
const dependencies = detectPlaygroundDependencies(playground.files);
|
|
1609
|
-
setupPlaygroundProject(url, playground, cwd, await confirmExternalDependencies(Array.from(dependencies.keys())));
|
|
1785
|
+
setupPlaygroundProject(url, playground, cwd$1, await confirmExternalDependencies(Array.from(dependencies.keys())));
|
|
1610
1786
|
}
|
|
1611
1787
|
async function confirmExternalDependencies(dependencies) {
|
|
1612
1788
|
if (dependencies.length === 0) return false;
|
|
@@ -1622,7 +1798,7 @@ async function confirmExternalDependencies(dependencies) {
|
|
|
1622
1798
|
}
|
|
1623
1799
|
return installDeps;
|
|
1624
1800
|
}
|
|
1625
|
-
async function createVirtualWorkspace({ cwd, template, type }) {
|
|
1801
|
+
async function createVirtualWorkspace({ cwd: cwd$1, template, type }) {
|
|
1626
1802
|
const override = { dependencies: {} };
|
|
1627
1803
|
if (template === "minimal" || template === "demo" || template === "library") override.kit = {
|
|
1628
1804
|
routesDirectory: "src/routes",
|
|
@@ -1635,7 +1811,7 @@ async function createVirtualWorkspace({ cwd, template, type }) {
|
|
|
1635
1811
|
...override.dependencies
|
|
1636
1812
|
};
|
|
1637
1813
|
const tentativeWorkspace = await createWorkspace({
|
|
1638
|
-
cwd,
|
|
1814
|
+
cwd: cwd$1,
|
|
1639
1815
|
override
|
|
1640
1816
|
});
|
|
1641
1817
|
return {
|
|
@@ -1654,7 +1830,7 @@ async function createVirtualWorkspace({ cwd, template, type }) {
|
|
|
1654
1830
|
const migrate = new Command("migrate").description("a CLI for migrating Svelte(Kit) codebases").argument("[migration]", "migration to run").option("-C, --cwd <path>", "path to working directory", process.cwd()).action((migration, options$1) => {
|
|
1655
1831
|
runMigrate(options$1.cwd, [migration]);
|
|
1656
1832
|
});
|
|
1657
|
-
function runMigrate(cwd, args) {
|
|
1833
|
+
function runMigrate(cwd$1, args) {
|
|
1658
1834
|
const pm = getUserAgent() ?? "npm";
|
|
1659
1835
|
try {
|
|
1660
1836
|
const cmdArgs = ["svelte-migrate@latest", ...args];
|
|
@@ -1662,7 +1838,7 @@ function runMigrate(cwd, args) {
|
|
|
1662
1838
|
const cmd = resolveCommand(pm, "execute", cmdArgs);
|
|
1663
1839
|
execSync(`${cmd.command} ${cmd.args.join(" ")}`, {
|
|
1664
1840
|
stdio: "inherit",
|
|
1665
|
-
cwd
|
|
1841
|
+
cwd: cwd$1
|
|
1666
1842
|
});
|
|
1667
1843
|
} catch (error) {
|
|
1668
1844
|
forwardExitCode(error);
|
|
@@ -1676,13 +1852,13 @@ const check = new Command("check").description("a CLI for checking your Svelte c
|
|
|
1676
1852
|
runCheck(process.cwd(), ["--help"]);
|
|
1677
1853
|
return "";
|
|
1678
1854
|
} }).action((options$1, check$1) => {
|
|
1679
|
-
const cwd = options$1.cwd;
|
|
1855
|
+
const cwd$1 = options$1.cwd;
|
|
1680
1856
|
const args = check$1.args;
|
|
1681
|
-
runCheck(cwd, args);
|
|
1857
|
+
runCheck(cwd$1, args);
|
|
1682
1858
|
});
|
|
1683
|
-
function runCheck(cwd, args) {
|
|
1859
|
+
function runCheck(cwd$1, args) {
|
|
1684
1860
|
const pm = getUserAgent() ?? "npm";
|
|
1685
|
-
if (!from(cwd, "svelte-check", true)) {
|
|
1861
|
+
if (!from(cwd$1, "svelte-check", true)) {
|
|
1686
1862
|
const cmd = resolveCommand(pm, "add", ["-D", "svelte-check"]);
|
|
1687
1863
|
console.error(`'svelte-check' is not installed locally. Install it with: ${import_picocolors.default.bold(`${cmd.command} ${cmd.args.join(" ")}`)}`);
|
|
1688
1864
|
process.exit(1);
|
|
@@ -1691,7 +1867,7 @@ function runCheck(cwd, args) {
|
|
|
1691
1867
|
const cmd = resolveCommand(pm, "execute-local", ["svelte-check", ...args]);
|
|
1692
1868
|
execSync(`${cmd.command} ${cmd.args.join(" ")}`, {
|
|
1693
1869
|
stdio: "inherit",
|
|
1694
|
-
cwd
|
|
1870
|
+
cwd: cwd$1
|
|
1695
1871
|
});
|
|
1696
1872
|
} catch (error) {
|
|
1697
1873
|
forwardExitCode(error);
|