silgi 0.42.5 → 0.43.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/_virtual/rolldown_runtime.mjs +11 -0
- package/dist/build.d.mts +3 -11
- package/dist/build.mjs +4 -48
- package/dist/cli/build/build.mjs +17 -0
- package/dist/cli/build/dev.d.mts +9 -0
- package/dist/cli/build/dev.mjs +59 -0
- package/dist/cli/build/prepare.d.mts +6 -0
- package/dist/cli/build/prepare.mjs +15 -0
- package/dist/cli/commands/commands.mjs +90 -0
- package/dist/cli/commands/env.mjs +53 -0
- package/dist/cli/commands/init.mjs +84 -0
- package/dist/cli/commands/install.mjs +52 -0
- package/dist/cli/commands/prepare.mjs +65 -0
- package/dist/cli/commands/reset.mjs +46 -0
- package/dist/cli/commands/run.mjs +105 -0
- package/dist/cli/commands/watch.mjs +48 -0
- package/dist/cli/config/defaults.mjs +117 -0
- package/dist/cli/config/index.d.mts +3 -11
- package/dist/cli/config/index.mjs +4 -17
- package/dist/cli/config/loader.d.mts +6 -0
- package/dist/cli/config/loader.mjs +71 -0
- package/dist/cli/config/resolvers/compatibility.mjs +71 -0
- package/dist/cli/config/resolvers/imports.mjs +35 -0
- package/dist/cli/config/resolvers/paths.mjs +98 -0
- package/dist/cli/config/resolvers/storage.mjs +23 -0
- package/dist/cli/config/resolvers/url.mjs +9 -0
- package/dist/cli/config/types.d.mts +14 -0
- package/dist/cli/config/types.mjs +147 -0
- package/dist/cli/core/apiful.mjs +36 -0
- package/dist/cli/core/app.mjs +105 -0
- package/dist/cli/core/devServer.mjs +10 -0
- package/dist/cli/core/env.mjs +68 -0
- package/dist/cli/core/installPackage.mjs +60 -0
- package/dist/cli/core/runtimeConfig.mjs +70 -0
- package/dist/cli/core/scan.mjs +35 -0
- package/dist/cli/core/silgi.mjs +111 -0
- package/dist/cli/core/templates.mjs +38 -0
- package/dist/cli/framework/emptyFramework.mjs +7 -0
- package/dist/cli/framework/h3.mjs +55 -0
- package/dist/cli/framework/index.mjs +15 -0
- package/dist/cli/framework/nitro.mjs +24 -0
- package/dist/cli/framework/nuxt.mjs +10 -0
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.mjs +24 -27
- package/dist/cli/module/exportScan.mjs +180 -0
- package/dist/cli/module/install.mjs +49 -0
- package/dist/cli/module/scan.mjs +195 -0
- package/dist/cli/scan/prepareCommands.mjs +40 -0
- package/dist/cli/scan/prepareConfigs.mjs +33 -0
- package/dist/cli/scan/prepareCoreFile.mjs +118 -0
- package/dist/cli/scan/prepareScanFile.mjs +59 -0
- package/dist/cli/scan/prepareSchema.mjs +140 -0
- package/dist/cli/scan/scanExportFile.mjs +312 -0
- package/dist/cli/scan/writeCoreFile.mjs +22 -0
- package/dist/cli/scan/writeTypesAndFiles.mjs +72 -0
- package/dist/cli/utils/cancel.mjs +14 -0
- package/dist/cli/utils/common.mjs +15 -0
- package/dist/cli/utils/compatibility.mjs +33 -0
- package/dist/cli/utils/debug.mjs +11 -0
- package/dist/cli/utils/ignore.mjs +56 -0
- package/dist/cli/utils/readScanFile.mjs +58 -0
- package/dist/cli/utils/storage.mjs +23 -0
- package/dist/core/context.d.mts +30 -0
- package/dist/core/context.mjs +32 -0
- package/dist/core/createSilgi.d.mts +6 -0
- package/dist/core/createSilgi.mjs +152 -0
- package/dist/core/error.d.mts +65 -0
- package/dist/core/error.mjs +106 -0
- package/dist/core/event.d.mts +26 -0
- package/dist/core/event.mjs +44 -0
- package/dist/core/index.d.mts +24 -316
- package/dist/core/index.mjs +27 -1345
- package/dist/core/orchestrate.mjs +113 -0
- package/dist/core/response.d.mts +20 -0
- package/dist/core/response.mjs +105 -0
- package/dist/core/silgi.d.mts +19 -0
- package/dist/core/silgi.mjs +141 -0
- package/dist/core/silgiApp.d.mts +9 -0
- package/dist/core/silgiApp.mjs +23 -0
- package/dist/core/storage.d.mts +7 -0
- package/dist/core/storage.mjs +15 -0
- package/dist/core/unctx.d.mts +21 -0
- package/dist/core/unctx.mjs +35 -0
- package/dist/core/utils/event-stream.d.mts +53 -0
- package/dist/core/utils/event-stream.mjs +38 -0
- package/dist/core/utils/event.d.mts +8 -0
- package/dist/core/utils/event.mjs +12 -0
- package/dist/core/utils/internal/event-stream.d.mts +45 -0
- package/dist/core/utils/internal/event-stream.mjs +137 -0
- package/dist/core/utils/internal/obj.mjs +9 -0
- package/dist/core/utils/internal/object.mjs +29 -0
- package/dist/core/utils/internal/query.mjs +73 -0
- package/dist/core/utils/internal/req.mjs +35 -0
- package/dist/core/utils/merge.d.mts +14 -0
- package/dist/core/utils/merge.mjs +27 -0
- package/dist/{shared/silgi.DTwQEdSr.d.mts → core/utils/middleware.d.mts} +11 -13
- package/dist/core/utils/middleware.mjs +12 -0
- package/dist/core/utils/request.mjs +35 -0
- package/dist/core/utils/resolver.d.mts +7 -0
- package/dist/core/utils/resolver.mjs +29 -0
- package/dist/core/utils/runtime.d.mts +7 -0
- package/dist/core/utils/runtime.mjs +20 -0
- package/dist/core/utils/sanitize.mjs +22 -0
- package/dist/core/utils/schema.d.mts +34 -0
- package/dist/core/utils/schema.mjs +33 -0
- package/dist/core/utils/service.d.mts +13 -0
- package/dist/core/utils/service.mjs +19 -0
- package/dist/core/utils/shared.d.mts +6 -0
- package/dist/core/utils/shared.mjs +7 -0
- package/dist/core/utils/storage.d.mts +24 -0
- package/dist/core/utils/storage.mjs +54 -0
- package/dist/index.d.mts +21 -6
- package/dist/index.mjs +22 -16
- package/dist/kit/add/add-commands.d.mts +6 -0
- package/dist/kit/add/add-commands.mjs +12 -0
- package/dist/kit/add/add-core-file.d.mts +9 -0
- package/dist/kit/add/add-core-file.mjs +11 -0
- package/dist/kit/add/add-imports.d.mts +14 -0
- package/dist/kit/add/add-imports.mjs +56 -0
- package/dist/kit/add/add-npm.d.mts +14 -0
- package/dist/kit/add/add-npm.mjs +23 -0
- package/dist/kit/define.d.mts +28 -0
- package/dist/kit/define.mjs +25 -0
- package/dist/kit/errors.d.mts +6 -0
- package/dist/kit/errors.mjs +11 -0
- package/dist/kit/esm.d.mts +11 -0
- package/dist/kit/esm.mjs +21 -0
- package/dist/kit/fs.d.mts +7 -0
- package/dist/kit/fs.mjs +23 -0
- package/dist/kit/function-utils.d.mts +27 -0
- package/dist/kit/function-utils.mjs +75 -0
- package/dist/kit/gen.d.mts +5 -0
- package/dist/kit/gen.mjs +26 -0
- package/dist/kit/hash.d.mts +4 -0
- package/dist/kit/hash.mjs +10 -0
- package/dist/kit/index.d.mts +22 -321
- package/dist/kit/index.mjs +23 -1039
- package/dist/kit/isFramework.d.mts +6 -0
- package/dist/kit/isFramework.mjs +21 -0
- package/dist/kit/logger.d.mts +6 -0
- package/dist/kit/logger.mjs +10 -0
- package/dist/kit/migration.d.mts +113 -0
- package/dist/kit/migration.mjs +301 -0
- package/dist/kit/module.d.mts +14 -0
- package/dist/kit/module.mjs +53 -0
- package/dist/kit/path.d.mts +7 -0
- package/dist/kit/path.mjs +26 -0
- package/dist/kit/preset.d.mts +8 -0
- package/dist/kit/preset.mjs +11 -0
- package/dist/kit/resolve.d.mts +37 -0
- package/dist/kit/resolve.mjs +82 -0
- package/dist/kit/template.d.mts +14 -0
- package/dist/kit/template.mjs +59 -0
- package/dist/kit/useRequest.d.mts +19 -0
- package/dist/kit/useRequest.mjs +63 -0
- package/dist/kit/utils.d.mts +34 -0
- package/dist/kit/utils.mjs +90 -0
- package/dist/package.mjs +176 -0
- package/dist/presets/_all.gen.d.mts +5 -2
- package/dist/presets/_all.gen.mjs +16 -13
- package/dist/presets/_resolve.d.mts +10 -6
- package/dist/presets/_resolve.mjs +51 -65
- package/dist/presets/_types.gen.d.mts +8 -5
- package/dist/presets/_types.gen.mjs +5 -1
- package/dist/presets/h3/preset.d.mts +5 -2
- package/dist/presets/h3/preset.mjs +33 -38
- package/dist/presets/hono/preset.d.mts +5 -2
- package/dist/presets/hono/preset.mjs +28 -35
- package/dist/presets/index.d.mts +3 -2
- package/dist/presets/index.mjs +3 -1
- package/dist/presets/nitro/preset.d.mts +5 -2
- package/dist/presets/nitro/preset.mjs +35 -42
- package/dist/presets/npmpackage/preset.d.mts +5 -2
- package/dist/presets/npmpackage/preset.mjs +27 -32
- package/dist/presets/nuxt/preset.d.mts +5 -2
- package/dist/presets/nuxt/preset.mjs +39 -44
- package/dist/runtime/index.d.mts +4 -3
- package/dist/runtime/index.mjs +5 -3
- package/dist/runtime/internal/config.d.mts +11 -7
- package/dist/runtime/internal/config.mjs +79 -90
- package/dist/runtime/internal/debug.d.mts +6 -3
- package/dist/runtime/internal/debug.mjs +9 -4
- package/dist/runtime/internal/defu.d.mts +4 -1
- package/dist/runtime/internal/defu.mjs +7 -2
- package/dist/runtime/internal/index.d.mts +7 -6
- package/dist/runtime/internal/index.mjs +8 -20
- package/dist/runtime/internal/nitro.d.mts +6 -3
- package/dist/runtime/internal/nitro.mjs +29 -37
- package/dist/runtime/internal/nuxt.d.mts +12 -8
- package/dist/runtime/internal/nuxt.mjs +12 -7
- package/dist/runtime/internal/ofetch.d.mts +8 -4
- package/dist/runtime/internal/ofetch.mjs +33 -34
- package/dist/runtime/internal/plugin.d.mts +7 -3
- package/dist/runtime/internal/plugin.mjs +7 -3
- package/dist/types/cliConfig.d.mts +288 -0
- package/dist/types/cliConfig.mjs +0 -0
- package/dist/types/cliHooks.d.mts +154 -0
- package/dist/types/cliHooks.mjs +0 -0
- package/dist/types/compatibility.d.mts +13 -0
- package/dist/types/compatibility.mjs +0 -0
- package/dist/types/config.d.mts +46 -0
- package/dist/types/config.mjs +0 -0
- package/dist/types/dotenv.d.mts +29 -0
- package/dist/types/dotenv.mjs +0 -0
- package/dist/types/event.d.mts +63 -0
- package/dist/types/event.mjs +0 -0
- package/dist/types/global.d.mts +24 -0
- package/dist/types/global.mjs +0 -0
- package/dist/types/helper.d.mts +25 -0
- package/dist/types/helper.mjs +0 -0
- package/dist/types/hooks.d.mts +37 -0
- package/dist/types/hooks.mjs +0 -0
- package/dist/types/index.d.mts +26 -1306
- package/dist/types/index.mjs +0 -1
- package/dist/types/kits.d.mts +32 -0
- package/dist/types/kits.mjs +0 -0
- package/dist/types/middleware.d.mts +31 -0
- package/dist/types/middleware.mjs +0 -0
- package/dist/types/module.d.mts +102 -0
- package/dist/types/module.mjs +0 -0
- package/dist/types/preset.d.mts +20 -0
- package/dist/types/preset.mjs +0 -0
- package/dist/types/route.d.mts +59 -0
- package/dist/types/route.mjs +0 -0
- package/dist/types/runtime/index.d.mts +5 -0
- package/dist/types/runtime/index.mjs +0 -0
- package/dist/types/runtime/nuxt.d.mts +13 -0
- package/dist/types/runtime/nuxt.mjs +0 -0
- package/dist/types/runtime/ofetch.d.mts +14 -0
- package/dist/types/runtime/ofetch.mjs +0 -0
- package/dist/types/runtime/plugin.d.mts +8 -0
- package/dist/types/runtime/plugin.mjs +0 -0
- package/dist/types/runtime/silgi.d.mts +11 -0
- package/dist/types/runtime/silgi.mjs +0 -0
- package/dist/types/schema.d.mts +86 -0
- package/dist/types/schema.mjs +0 -0
- package/dist/types/service.d.mts +102 -0
- package/dist/types/service.mjs +0 -0
- package/dist/types/shared.d.mts +19 -0
- package/dist/types/shared.mjs +0 -0
- package/dist/types/silgi.d.mts +71 -0
- package/dist/types/silgi.mjs +0 -0
- package/dist/types/silgiCLI.d.mts +118 -0
- package/dist/types/silgiCLI.mjs +0 -0
- package/dist/types/standard-schema.d.mts +61 -0
- package/dist/types/standard-schema.mjs +0 -0
- package/dist/types/storage.d.mts +30 -0
- package/dist/types/storage.mjs +0 -0
- package/package.json +20 -35
- package/dist/_chunks/silgiApp.mjs +0 -25
- package/dist/cli/build.mjs +0 -2190
- package/dist/cli/common.mjs +0 -13
- package/dist/cli/compatibility.mjs +0 -30
- package/dist/cli/dev.mjs +0 -67
- package/dist/cli/init.mjs +0 -112
- package/dist/cli/install.mjs +0 -151
- package/dist/cli/loader.mjs +0 -618
- package/dist/cli/prepare.mjs +0 -188
- package/dist/cli/reset.mjs +0 -55
- package/dist/cli/run.mjs +0 -159
- package/dist/cli/types.mjs +0 -232
- package/dist/cli/watch.mjs +0 -91
- package/dist/presets/next/preset.d.mts +0 -3
- package/dist/presets/next/preset.mjs +0 -38
- package/dist/runtime/internal/next.d.mts +0 -9
- package/dist/runtime/internal/next.mjs +0 -22
package/dist/cli/common.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import satisfies from 'semver/functions/satisfies.js';
|
|
2
|
-
import { useSilgiCLI } from 'silgi';
|
|
3
|
-
import { version } from 'silgi/meta';
|
|
4
|
-
|
|
5
|
-
const SEMANTIC_VERSION_RE = /-\d+\.[0-9a-f]+/;
|
|
6
|
-
function normalizeSemanticVersion(version) {
|
|
7
|
-
return version.replace(SEMANTIC_VERSION_RE, "");
|
|
8
|
-
}
|
|
9
|
-
const SILGI_VERSION_RE = /^v/g;
|
|
10
|
-
async function checkSilgiCompatibility(constraints, silgi = useSilgiCLI()) {
|
|
11
|
-
const issues = [];
|
|
12
|
-
if (constraints.silgi) {
|
|
13
|
-
const _silgiVersion = version.replace(SILGI_VERSION_RE, "");
|
|
14
|
-
if (!satisfies(normalizeSemanticVersion(_silgiVersion), constraints.silgi, { includePrerelease: true })) {
|
|
15
|
-
issues.push({
|
|
16
|
-
name: "silgi",
|
|
17
|
-
message: `Silgi version \`${constraints.silgi}\` is required but currently using \`${version}\``
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
await silgi.callHook("kit:compatibility", constraints, issues);
|
|
22
|
-
issues.toString = () => issues.map((issue) => ` - [${issue.name}] ${issue.message}`).join("\n");
|
|
23
|
-
return issues;
|
|
24
|
-
}
|
|
25
|
-
function hasInstalledModule(moduleKey, silgi = useSilgiCLI()) {
|
|
26
|
-
const find = silgi.scanModules.find(({ meta }) => meta.configKey === moduleKey);
|
|
27
|
-
return find?.installed ?? false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { checkSilgiCompatibility as c, hasInstalledModule as h };
|
package/dist/cli/dev.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { watch } from 'chokidar';
|
|
2
|
-
import consola from 'consola';
|
|
3
|
-
import { basename } from 'pathe';
|
|
4
|
-
import { debounce } from 'perfect-debounce';
|
|
5
|
-
import { u as useSilgiCLI$1, a as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
|
|
6
|
-
import { useSilgiCLI } from 'silgi';
|
|
7
|
-
import { c as createSilgiCLI, b as build } from './build.mjs';
|
|
8
|
-
|
|
9
|
-
async function reloadScan(path, _stats) {
|
|
10
|
-
const silgi = useSilgiCLI();
|
|
11
|
-
await silgi.callHook("reload:scan", path, _stats);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async function prepareBuild(config) {
|
|
15
|
-
const silgi = await createSilgiCLI({
|
|
16
|
-
commandType: config?.commandType || "prepare",
|
|
17
|
-
...config
|
|
18
|
-
});
|
|
19
|
-
await build(silgi);
|
|
20
|
-
return silgi;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function watchDev() {
|
|
24
|
-
const silgi = useSilgiCLI$1();
|
|
25
|
-
let watcher;
|
|
26
|
-
async function load() {
|
|
27
|
-
await prepareBuild({
|
|
28
|
-
commandType: "prepare",
|
|
29
|
-
activeEnvironment: silgi.options.activeEnvironment || ".env",
|
|
30
|
-
dev: true
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const reload = debounce(load);
|
|
34
|
-
const watchReloadEvents = /* @__PURE__ */ new Set(["add", "addDir", "unlink", "unlinkDir", "change"]);
|
|
35
|
-
if (silgi.options.devServer.watch.length > 0) {
|
|
36
|
-
silgi.options.devServer.watch = [...new Set(silgi.options.devServer.watch)];
|
|
37
|
-
watcher = watch(silgi.options.devServer.watch, silgi.options.watchOptions);
|
|
38
|
-
watcher.on("all", async (event, path, stats) => {
|
|
39
|
-
if (!watchReloadEvents.has(event)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const startTime = performance.now();
|
|
43
|
-
silgi.errors = [];
|
|
44
|
-
try {
|
|
45
|
-
await reloadScan(path, stats);
|
|
46
|
-
await reload();
|
|
47
|
-
} catch (error) {
|
|
48
|
-
consola.withTag("silgi").error(error);
|
|
49
|
-
}
|
|
50
|
-
silgi.errors = [];
|
|
51
|
-
const endTime = performance.now();
|
|
52
|
-
const elapsedTime = Math.round(endTime - startTime);
|
|
53
|
-
silgi.logger.success(`${basename(path)} - ${elapsedTime}ms`);
|
|
54
|
-
}).on("error", (error) => {
|
|
55
|
-
consola.withTag("silgi").error(error);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
async function close() {
|
|
59
|
-
await silgiCLIIClose();
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
watcher,
|
|
63
|
-
close
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export { prepareBuild as p, watchDev as w };
|
package/dist/cli/init.mjs
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'node:fs';
|
|
2
|
-
import fsp from 'node:fs/promises';
|
|
3
|
-
import * as p from '@clack/prompts';
|
|
4
|
-
import { defineCommand, runCommand } from 'citty';
|
|
5
|
-
import consola from 'consola';
|
|
6
|
-
import { dirname } from 'pathe';
|
|
7
|
-
import { c as cancelOnCancel, a as command$1 } from './prepare.mjs';
|
|
8
|
-
import 'pkg-types';
|
|
9
|
-
import 'silgi/meta';
|
|
10
|
-
import './build.mjs';
|
|
11
|
-
import 'hookable';
|
|
12
|
-
import 'silgi';
|
|
13
|
-
import 'silgi/kit';
|
|
14
|
-
import 'silgi/runtime';
|
|
15
|
-
import 'silgi/runtime/meta';
|
|
16
|
-
import 'unimport';
|
|
17
|
-
import 'dotenv';
|
|
18
|
-
import 'knitwork';
|
|
19
|
-
import 'node:path';
|
|
20
|
-
import 'mlly';
|
|
21
|
-
import 'dev-jiti';
|
|
22
|
-
import './compatibility.mjs';
|
|
23
|
-
import 'semver/functions/satisfies.js';
|
|
24
|
-
import 'node:url';
|
|
25
|
-
import 'defu';
|
|
26
|
-
import 'exsolve';
|
|
27
|
-
import 'ufo';
|
|
28
|
-
import 'micromatch';
|
|
29
|
-
import 'oxc-parser';
|
|
30
|
-
import 'tinyglobby';
|
|
31
|
-
import 'ignore';
|
|
32
|
-
import 'scule';
|
|
33
|
-
import 'klona';
|
|
34
|
-
import 'unstorage';
|
|
35
|
-
import './loader.mjs';
|
|
36
|
-
import 'c12';
|
|
37
|
-
import 'compatx';
|
|
38
|
-
import 'klona/full';
|
|
39
|
-
import 'std-env';
|
|
40
|
-
import 'consola/utils';
|
|
41
|
-
import 'escape-string-regexp';
|
|
42
|
-
import 'apiful/openapi';
|
|
43
|
-
import '../_chunks/silgiApp.mjs';
|
|
44
|
-
import 'unctx';
|
|
45
|
-
import 'pathe/utils';
|
|
46
|
-
import 'untyped';
|
|
47
|
-
import './types.mjs';
|
|
48
|
-
import './common.mjs';
|
|
49
|
-
import 'node:child_process';
|
|
50
|
-
|
|
51
|
-
const command = defineCommand({
|
|
52
|
-
meta: {
|
|
53
|
-
name: "Silgi Init",
|
|
54
|
-
description: "Initialize silgi config",
|
|
55
|
-
version: "0.1.0"
|
|
56
|
-
},
|
|
57
|
-
args: {},
|
|
58
|
-
async run() {
|
|
59
|
-
p.intro("Initializing silgi config");
|
|
60
|
-
const framework = await p.select({
|
|
61
|
-
message: "Choose a framework",
|
|
62
|
-
options: [
|
|
63
|
-
{ label: "Nitro", value: "nitro" },
|
|
64
|
-
{ label: "Nuxt", value: "nuxt" },
|
|
65
|
-
{ label: "H3", value: "h3" },
|
|
66
|
-
{ label: "NPM Package", value: "npm-package" }
|
|
67
|
-
],
|
|
68
|
-
initialValue: "h3"
|
|
69
|
-
});
|
|
70
|
-
cancelOnCancel({ value: framework });
|
|
71
|
-
const context = [
|
|
72
|
-
`import { defineSilgiConfig } from 'silgi/config'`,
|
|
73
|
-
"",
|
|
74
|
-
"export default defineSilgiConfig({",
|
|
75
|
-
` preset: '${framework}',`,
|
|
76
|
-
` compatibilityDate: '${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}',`,
|
|
77
|
-
"",
|
|
78
|
-
"})",
|
|
79
|
-
""
|
|
80
|
-
];
|
|
81
|
-
if (framework === "nitro" || framework === "nuxt") {
|
|
82
|
-
const plugin = [
|
|
83
|
-
`import { buildSilgi } from '../silgi/core'`,
|
|
84
|
-
"",
|
|
85
|
-
"export default defineNitroPlugin(async (nitro) => {",
|
|
86
|
-
"",
|
|
87
|
-
" await buildSilgi({",
|
|
88
|
-
" framework: {",
|
|
89
|
-
" nitro,",
|
|
90
|
-
" },",
|
|
91
|
-
" options: {",
|
|
92
|
-
" putStorage: useStorage(),",
|
|
93
|
-
" runtimeConfig: useRuntimeConfig(),",
|
|
94
|
-
" },",
|
|
95
|
-
" })",
|
|
96
|
-
"})",
|
|
97
|
-
""
|
|
98
|
-
];
|
|
99
|
-
const file = "server/plugins/silgi.ts";
|
|
100
|
-
await fsp.mkdir(dirname(file), { recursive: true });
|
|
101
|
-
writeFileSync(file, plugin.join("\n"));
|
|
102
|
-
consola.success("Silgi plugin created, see server/plugins/silgi.ts");
|
|
103
|
-
runCommand(command$1, {
|
|
104
|
-
rawArgs: ["--env", ".env"]
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
writeFileSync("silgi.config.ts", context.join("\n"));
|
|
108
|
-
consola.success("Silgi config created, see silgi.config.ts");
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
export { command as default };
|
package/dist/cli/install.mjs
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { defineCommand, runCommand } from 'citty';
|
|
3
|
-
import { consola } from 'consola';
|
|
4
|
-
import { version } from 'silgi/meta';
|
|
5
|
-
import { addNPMPackage, addTemplate } from 'silgi/kit';
|
|
6
|
-
import { u as useSilgiCLI } from '../_chunks/silgiApp.mjs';
|
|
7
|
-
import { c as commonArgs } from './common.mjs';
|
|
8
|
-
import { a as command$1 } from './prepare.mjs';
|
|
9
|
-
import 'unctx';
|
|
10
|
-
import 'pathe';
|
|
11
|
-
import 'pkg-types';
|
|
12
|
-
import './build.mjs';
|
|
13
|
-
import 'hookable';
|
|
14
|
-
import 'silgi';
|
|
15
|
-
import 'silgi/runtime';
|
|
16
|
-
import 'silgi/runtime/meta';
|
|
17
|
-
import 'unimport';
|
|
18
|
-
import '@clack/prompts';
|
|
19
|
-
import 'node:fs';
|
|
20
|
-
import 'dotenv';
|
|
21
|
-
import 'knitwork';
|
|
22
|
-
import 'node:path';
|
|
23
|
-
import 'mlly';
|
|
24
|
-
import 'dev-jiti';
|
|
25
|
-
import './compatibility.mjs';
|
|
26
|
-
import 'semver/functions/satisfies.js';
|
|
27
|
-
import 'node:url';
|
|
28
|
-
import 'defu';
|
|
29
|
-
import 'exsolve';
|
|
30
|
-
import 'ufo';
|
|
31
|
-
import 'node:fs/promises';
|
|
32
|
-
import 'micromatch';
|
|
33
|
-
import 'oxc-parser';
|
|
34
|
-
import 'tinyglobby';
|
|
35
|
-
import 'ignore';
|
|
36
|
-
import 'scule';
|
|
37
|
-
import 'klona';
|
|
38
|
-
import 'unstorage';
|
|
39
|
-
import './loader.mjs';
|
|
40
|
-
import 'c12';
|
|
41
|
-
import 'compatx';
|
|
42
|
-
import 'klona/full';
|
|
43
|
-
import 'std-env';
|
|
44
|
-
import 'consola/utils';
|
|
45
|
-
import 'escape-string-regexp';
|
|
46
|
-
import 'apiful/openapi';
|
|
47
|
-
import 'pathe/utils';
|
|
48
|
-
import 'untyped';
|
|
49
|
-
import './types.mjs';
|
|
50
|
-
|
|
51
|
-
async function installPackages(silgi = useSilgiCLI()) {
|
|
52
|
-
await addNPMPackage([
|
|
53
|
-
{
|
|
54
|
-
name: "zod-to-json-schema",
|
|
55
|
-
isDev: false,
|
|
56
|
-
when: silgi.options.schemaVendor === "zod"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: "@valibot/to-json-schema",
|
|
60
|
-
isDev: false,
|
|
61
|
-
when: silgi.options.schemaVendor === "valibot"
|
|
62
|
-
}
|
|
63
|
-
]);
|
|
64
|
-
await addNPMPackage([
|
|
65
|
-
{
|
|
66
|
-
name: "@fastify/deepmerge",
|
|
67
|
-
isDev: false
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "@silgi/ecosystem",
|
|
71
|
-
isDev: false
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: "unadapter",
|
|
75
|
-
isDev: false
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "apiful",
|
|
79
|
-
isDev: false
|
|
80
|
-
}
|
|
81
|
-
]);
|
|
82
|
-
const packages = {
|
|
83
|
-
dependencies: {
|
|
84
|
-
...silgi.options.installPackages?.dependencies
|
|
85
|
-
},
|
|
86
|
-
devDependencies: {
|
|
87
|
-
...silgi.options.installPackages?.devDependencies
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
if (silgi.options.preset === "npm-package") {
|
|
91
|
-
packages.devDependencies = {
|
|
92
|
-
...packages.devDependencies,
|
|
93
|
-
...packages.dependencies
|
|
94
|
-
};
|
|
95
|
-
packages.dependencies = {};
|
|
96
|
-
}
|
|
97
|
-
if (silgi.options.debug === true || silgi.options.debug?.install) {
|
|
98
|
-
addTemplate({
|
|
99
|
-
filename: "install.json",
|
|
100
|
-
where: ".silgi",
|
|
101
|
-
write: true,
|
|
102
|
-
getContents: () => JSON.stringify(packages, null, 2)
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return packages;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const command = defineCommand({
|
|
109
|
-
meta: {
|
|
110
|
-
name: "install",
|
|
111
|
-
description: "Install dependencies from the install.json file.",
|
|
112
|
-
version: version
|
|
113
|
-
},
|
|
114
|
-
args: {
|
|
115
|
-
...commonArgs,
|
|
116
|
-
preset: {
|
|
117
|
-
type: "string",
|
|
118
|
-
description: "The build preset to use (you can also use `SILGI_PRESET` environment variable)."
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
async run() {
|
|
122
|
-
await runCommand(command$1, {
|
|
123
|
-
rawArgs: ["--commandType", "install"]
|
|
124
|
-
}).catch(() => {
|
|
125
|
-
});
|
|
126
|
-
const packages = await installPackages();
|
|
127
|
-
const commandArgs = process.argv.slice(process.argv.indexOf("install") + 1);
|
|
128
|
-
const extraArgs = commandArgs.length ? ` ${commandArgs.join(" ")}` : "";
|
|
129
|
-
if (Object.keys(packages).length === 0) {
|
|
130
|
-
consola.info("Empty command list, maybe forgot pnpm silgi prepare?");
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const cleanPackageName = (name, version) => {
|
|
134
|
-
const cleanVersion = version.replace(/^(>=|<=|>|<)/, "^");
|
|
135
|
-
return `${name}@${cleanVersion}`;
|
|
136
|
-
};
|
|
137
|
-
const deps = Object.entries(packages.dependencies || {}).map(([name, version]) => cleanPackageName(name, version)).join(" ");
|
|
138
|
-
const devDeps = Object.entries(packages.devDependencies || {}).map(([name, version]) => cleanPackageName(name, version)).join(" ");
|
|
139
|
-
if (deps) {
|
|
140
|
-
consola.info("Installing dependencies...");
|
|
141
|
-
execSync(`ni ${deps}${extraArgs}`, { stdio: "inherit" });
|
|
142
|
-
}
|
|
143
|
-
if (devDeps) {
|
|
144
|
-
consola.info("Installing dev dependencies...");
|
|
145
|
-
execSync(`ni ${devDeps}${extraArgs} -D`, { stdio: "inherit" });
|
|
146
|
-
}
|
|
147
|
-
consola.success("All dependencies installed successfully.");
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export { command as default };
|