silgi 0.29.10 → 0.29.12

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.29.10";
4
+ const version = "0.29.12";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -365,12 +365,12 @@ async function prepareCoreFile(silgi) {
365
365
  addImportItem,
366
366
  addImportItemType,
367
367
  addFunction: (data) => {
368
- for (const item of data) {
368
+ for (const item of toArray(data)) {
369
369
  if (item.where === "after") {
370
- after.push(item.params?.length ? ` await ${item.name}(option, ${item.params.join(",")})` : ` await ${item.name}(framework)`);
370
+ after.push(item.params?.length ? ` await ${item.name}(option, ${item.params.join(",")})` : ` await ${item.name}(option)`);
371
371
  }
372
372
  if (item.where === "before") {
373
- before.push(item.params?.length ? ` await ${item.name}(option, ${item.params.join(",")})` : ` await ${item.name}(framework)`);
373
+ before.push(item.params?.length ? ` await ${item.name}(option, ${item.params.join(",")})` : ` await ${item.name}(option)`);
374
374
  }
375
375
  }
376
376
  }
@@ -3,6 +3,7 @@ import { Buffer } from 'node:buffer';
3
3
  import { ConsolaOptions, ConsolaInstance } from 'consola';
4
4
  import * as rfc6902 from 'rfc6902';
5
5
  import { IncomingMessage, ServerResponse } from 'node:http';
6
+ import { PresetName } from 'silgi/presets';
6
7
 
7
8
  declare function addCommands(data: Commands | Commands[]): Promise<void>;
8
9
 
@@ -300,6 +301,7 @@ declare function hasSilgiModule(moduleKey: string, silgi?: SilgiCLI): boolean;
300
301
  declare function hasInstalledModule(moduleKey: string, silgi?: SilgiCLI): boolean;
301
302
  declare const baseHeaderBannerComment: string[];
302
303
  declare function processFilePath(src: string): string;
304
+ declare function isPresents(names: PresetName[]): boolean;
303
305
 
304
- export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory, isH3, isNitro, isNuxt, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
306
+ export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory, isH3, isNitro, isNuxt, isPresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
305
307
  export type { FunctionConfig, JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult };
@@ -60,6 +60,10 @@ function processFilePath(src) {
60
60
  }
61
61
  return src;
62
62
  }
63
+ function isPresents(names) {
64
+ const silgi = useSilgiCLI();
65
+ return names.filter((name) => silgi.options.preset.includes(name)).length > 0;
66
+ }
63
67
 
64
68
  async function addCommands(data) {
65
69
  useSilgiCLI$1().hook("prepare:commands", (commads) => {
@@ -969,4 +973,4 @@ function isValidIp(ip) {
969
973
  return false;
970
974
  }
971
975
 
972
- export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
976
+ export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, isPresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, parseServices, prettyPath, processFilePath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, serviceParseModule, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
@@ -301,7 +301,11 @@ interface PrepareCore {
301
301
  name: string;
302
302
  params?: string[];
303
303
  where: 'before' | 'after';
304
- }[]) => void;
304
+ }[] | {
305
+ name: string;
306
+ params?: string[];
307
+ where: 'before' | 'after';
308
+ }) => void;
305
309
  }
306
310
 
307
311
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.29.10",
4
+ "version": "0.29.12",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {