silgi 0.9.25 → 0.9.26

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,4 +1,4 @@
1
- const version = "0.9.25";
1
+ const version = "0.9.26";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.3.0",
4
4
  "@nuxt/kit": "^3.15.4",
@@ -11,8 +11,8 @@ const devDependencies = {
11
11
  nitropack: "^2.10.4",
12
12
  nuxt: "^3.15.4",
13
13
  typescript: "^5.7.3",
14
- unbuild: "^3.3.1",
15
- vitest: "^3.0.6",
14
+ unbuild: "^3.5.0",
15
+ vitest: "^3.0.7",
16
16
  vue: "^3.5.13",
17
17
  zod: "^3.24.2"
18
18
  };
@@ -15,6 +15,12 @@ declare function tryResolveModule(id: string, url?: string | string[]): Promise<
15
15
  declare function writeFile(file: string, contents: Buffer | string, log?: boolean): Promise<void>;
16
16
  declare function isDirectory(path: string): Promise<boolean>;
17
17
 
18
+ declare function hash(data: any, type?: {
19
+ camelCase?: boolean;
20
+ snakeCase?: boolean;
21
+ flatCase?: boolean;
22
+ }): string;
23
+
18
24
  declare function isNuxt(): boolean;
19
25
  declare function isNitro(): boolean;
20
26
  declare function isH3(): boolean;
@@ -109,4 +115,4 @@ declare const MODE_RE: RegExp;
109
115
  declare function hasSilgiModule(moduleKey: string, silgi?: SilgiCLI): boolean;
110
116
  declare function hasInstalledModule(moduleKey: string, silgi?: SilgiCLI): boolean;
111
117
 
112
- export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
118
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, hash, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
@@ -15,6 +15,12 @@ declare function tryResolveModule(id: string, url?: string | string[]): Promise<
15
15
  declare function writeFile(file: string, contents: Buffer | string, log?: boolean): Promise<void>;
16
16
  declare function isDirectory(path: string): Promise<boolean>;
17
17
 
18
+ declare function hash(data: any, type?: {
19
+ camelCase?: boolean;
20
+ snakeCase?: boolean;
21
+ flatCase?: boolean;
22
+ }): string;
23
+
18
24
  declare function isNuxt(): boolean;
19
25
  declare function isNitro(): boolean;
20
26
  declare function isH3(): boolean;
@@ -109,4 +115,4 @@ declare const MODE_RE: RegExp;
109
115
  declare function hasSilgiModule(moduleKey: string, silgi?: SilgiCLI): boolean;
110
116
  declare function hasInstalledModule(moduleKey: string, silgi?: SilgiCLI): boolean;
111
117
 
112
- export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
118
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, hash, isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
@@ -4,6 +4,8 @@ import consola, { consola as consola$1 } from 'consola';
4
4
  import { relative, resolve, dirname, normalize, isAbsolute, join, parse, basename } from 'pathe';
5
5
  import { colors } from 'consola/utils';
6
6
  import { getProperty } from 'dot-prop';
7
+ import { hash as hash$1 } from 'ohash';
8
+ import { camelCase, snakeCase, flatCase } from 'scule';
7
9
  import { useSilgi, tryUseSilgiCLI, useSilgiCLI, tryUseSilgi } from 'silgi/core';
8
10
  import { defu } from 'defu';
9
11
  import { c as checkSilgiCompatibility } from '../cli/compatibility.mjs';
@@ -13,8 +15,6 @@ import { resolveAlias as resolveAlias$1 } from 'pathe/utils';
13
15
  import process$1 from 'node:process';
14
16
  import destr from 'destr';
15
17
  import { klona } from 'klona';
16
- import { snakeCase } from 'scule';
17
- import { hash } from 'ohash';
18
18
  import 'semver/functions/satisfies.js';
19
19
  import 'silgi/meta';
20
20
 
@@ -72,6 +72,19 @@ async function isDirectory$1(path) {
72
72
  }
73
73
  }
74
74
 
75
+ function hash(data, type) {
76
+ if (type?.camelCase) {
77
+ return camelCase(hash$1(data));
78
+ }
79
+ if (type?.snakeCase) {
80
+ return snakeCase(hash$1(data));
81
+ }
82
+ if (type?.flatCase) {
83
+ return flatCase(hash$1(data));
84
+ }
85
+ return flatCase(hash$1(data));
86
+ }
87
+
75
88
  function isNuxt() {
76
89
  const silgi = useSilgi();
77
90
  if (silgi.options.present === "nitro" || silgi.options.present === "h3" || silgi.options.present === "nuxt") {
@@ -340,7 +353,7 @@ function normalizeTemplate(template, buildDir) {
340
353
  }
341
354
  if (!template.filename) {
342
355
  const srcPath = parse(template.src);
343
- template.filename = template.fileName || `${basename(srcPath.dir)}.${srcPath.name}.${hash(template.src)}${srcPath.ext}`;
356
+ template.filename = template.fileName || `${basename(srcPath.dir)}.${srcPath.name}.${hash$1(template.src)}${srcPath.ext}`;
344
357
  }
345
358
  }
346
359
  if (!template.src && !template.getContents) {
@@ -360,4 +373,4 @@ function normalizeTemplate(template, buildDir) {
360
373
  return template;
361
374
  }
362
375
 
363
- export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
376
+ export { MODE_RE, addTemplate, applyEnv, createResolver, defineSilgiModule, defineSilgiPreset, filterInPlace, hasInstalledModule, hasSilgiModule, hash, isDirectory$1 as isDirectory, isH3, isNitro, isNuxt, normalizeTemplate, prettyPath, relativeWithDot, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useSilgiRuntimeConfig, writeFile };
@@ -1,4 +1,4 @@
1
- const version = "0.9.25";
1
+ const version = "0.9.26";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.3.0",
4
4
  "@nuxt/kit": "^3.15.4",
@@ -11,8 +11,8 @@ const devDependencies = {
11
11
  nitropack: "^2.10.4",
12
12
  nuxt: "^3.15.4",
13
13
  typescript: "^5.7.3",
14
- unbuild: "^3.3.1",
15
- vitest: "^3.0.6",
14
+ unbuild: "^3.5.0",
15
+ vitest: "^3.0.7",
16
16
  vue: "^3.5.13",
17
17
  zod: "^3.24.2"
18
18
  };
@@ -1,4 +1,4 @@
1
- const version = "0.9.25";
1
+ const version = "0.9.26";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.3.0",
4
4
  "@nuxt/kit": "^3.15.4",
@@ -11,8 +11,8 @@ const devDependencies = {
11
11
  nitropack: "^2.10.4",
12
12
  nuxt: "^3.15.4",
13
13
  typescript: "^5.7.3",
14
- unbuild: "^3.3.1",
15
- vitest: "^3.0.6",
14
+ unbuild: "^3.5.0",
15
+ vitest: "^3.0.7",
16
16
  vue: "^3.5.13",
17
17
  zod: "^3.24.2"
18
18
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.9.25",
4
+ "version": "0.9.26",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -157,8 +157,8 @@
157
157
  "nitropack": "^2.10.4",
158
158
  "nuxt": "^3.15.4",
159
159
  "typescript": "^5.7.3",
160
- "unbuild": "^3.3.1",
161
- "vitest": "^3.0.6",
160
+ "unbuild": "^3.5.0",
161
+ "vitest": "^3.0.7",
162
162
  "vue": "^3.5.13",
163
163
  "zod": "^3.24.2"
164
164
  },