create-kitql
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"license": "MIT", | ||
@@ -21,9 +21,9 @@ "type": "module", | ||
"devDependencies": { | ||
"@types/node": "^20.9.2", | ||
"@kitql/eslint-config": "0.3.2" | ||
"@types/node": "20.16.1", | ||
"@kitql/eslint-config": "0.3.7" | ||
}, | ||
"dependencies": { | ||
"@clack/prompts": "^0.7.0", | ||
"@kitql/helpers": "0.8.9", | ||
"commander": "^12.0.0" | ||
"commander": "^12.0.0", | ||
"@kitql/helpers": "0.8.10" | ||
}, | ||
@@ -30,0 +30,0 @@ "sideEffects": false, |
@@ -19,3 +19,3 @@ { | ||
"devDependencies": { | ||
"@playwright/test": "^1.42.1", | ||
"@playwright/test": "^1.46.1", | ||
"@sveltejs/adapter-auto": "^3.0.0", | ||
@@ -28,3 +28,3 @@ "@sveltejs/kit": "^2.4.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-svelte": "^2.30.0", | ||
"eslint-plugin-svelte": "^2.43.0", | ||
"prettier": "^3.0.0", | ||
@@ -34,8 +34,8 @@ "prettier-plugin-svelte": "^3.0.0", | ||
"svelte-check": "^3.6.0", | ||
"tslib": "^2.4.1", | ||
"typescript": "^5.0.0", | ||
"vite": "^5.0.0", | ||
"vite-plugin-kit-routes": "0.5.3", | ||
"vitest": "^1.0.0" | ||
"tslib": "^2.7.0", | ||
"typescript": "5.5.4", | ||
"vite": "^5.4.0", | ||
"vite-plugin-kit-routes": "latest", | ||
"vitest": "2.0.5" | ||
} | ||
} |
@@ -39,22 +39,38 @@ /* eslint-disable */ | ||
params.d = params.d ?? 'identicon'; | ||
return `https://www.gravatar.com/avatar/${params.str}${appendSp({ | ||
s: params?.s, | ||
d: params?.d | ||
})}`; | ||
return `https://www.gravatar.com/avatar/${params.str}${appendSp({ s: params.s, d: params.d })}`; | ||
} | ||
}; | ||
type ParamValue = string | number | undefined; | ||
/** | ||
* Append search params to a string | ||
*/ | ||
const appendSp = (sp?: Record<string, string | number | undefined>, prefix: '?' | '&' = '?') => { | ||
export const appendSp = ( | ||
sp?: Record<string, ParamValue | ParamValue[]>, | ||
prefix: '?' | '&' = '?' | ||
) => { | ||
if (sp === undefined) return ''; | ||
const mapping = Object.entries(sp) | ||
.filter((c) => c[1] !== undefined) | ||
.map((c) => [c[0], String(c[1])]); | ||
const formated = new URLSearchParams(mapping).toString(); | ||
if (formated) { | ||
return `${prefix}${formated}`; | ||
const params = new URLSearchParams(); | ||
const append = (n: string, v: ParamValue) => { | ||
if (v !== undefined) { | ||
params.append(n, String(v)); | ||
} | ||
}; | ||
for (const [name, val] of Object.entries(sp)) { | ||
if (Array.isArray(val)) { | ||
for (const v of val) { | ||
append(name, v); | ||
} | ||
} else { | ||
append(name, val); | ||
} | ||
} | ||
const formatted = params.toString(); | ||
if (formatted) { | ||
return `${prefix}${formatted}`; | ||
} | ||
return ''; | ||
@@ -88,2 +104,9 @@ }; | ||
export type Routes = keyof AllTypes extends `${string}/${infer Route}` | ||
? `/${Route}` | ||
: keyof AllTypes; | ||
export const routes = [ | ||
...new Set(Object.keys(AllObjs).map((route) => /^\/.*|[^ ]?\/.*$/.exec(route)?.[0] ?? route)) | ||
] as Routes[]; | ||
/** | ||
@@ -90,0 +113,0 @@ * To be used like this: |
@@ -19,4 +19,4 @@ { | ||
"devDependencies": { | ||
"@kitql/eslint-config": "^0.3.2", | ||
"@playwright/test": "^1.42.1", | ||
"@kitql/eslint-config": "latest", | ||
"@playwright/test": "^1.46.1", | ||
"@sveltejs/adapter-auto": "^3.0.0", | ||
@@ -26,12 +26,12 @@ "@sveltejs/kit": "^2.4.0", | ||
"pg": "^8.11.3", | ||
"remult": "^0.25.0", | ||
"remult": "^0.27.0", | ||
"svelte": "^4.2.7", | ||
"svelte-check": "^3.6.0", | ||
"tslib": "^2.4.1", | ||
"typescript": "^5.0.0", | ||
"vite": "^5.0.0", | ||
"vite-plugin-kit-routes": "^0.5.3", | ||
"vite-plugin-stripper": "^0.4.1", | ||
"vitest": "^1.0.0" | ||
"tslib": "^2.7.0", | ||
"typescript": "5.5.4", | ||
"vite": "^5.4.0", | ||
"vite-plugin-kit-routes": "latest", | ||
"vite-plugin-stripper": "latest", | ||
"vitest": "2.0.5" | ||
} | ||
} |
@@ -86,10 +86,2 @@ /* eslint-disable */ | ||
function StringOrUndefined(val: any) { | ||
if (val === undefined) { | ||
return undefined | ||
} | ||
return String(val) | ||
} | ||
// route function helpers | ||
@@ -103,2 +95,9 @@ type NonFunctionKeys<T> = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T] | ||
export type Routes = keyof AllTypes extends `${string}/${infer Route}` | ||
? `/${Route}` | ||
: keyof AllTypes | ||
export const routes = [ | ||
...new Set(Object.keys(AllObjs).map((route) => /^\/.*|[^ ]?\/.*$/.exec(route)?.[0] ?? route)), | ||
] as Routes[] | ||
/** | ||
@@ -105,0 +104,0 @@ * To be used like this: |
@@ -13,4 +13,4 @@ { | ||
"strict": true, | ||
"moduleResolution": "bundler", | ||
}, | ||
"moduleResolution": "bundler" | ||
} | ||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias | ||
@@ -17,0 +17,0 @@ // |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71104
756
+ Added@kitql/helpers@0.8.10(transitive)
- Removed@kitql/helpers@0.8.9(transitive)
Updated@kitql/helpers@0.8.10