@dosgato/templating 1.0.2 → 1.0.3
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +1 -3
- package/dist/names.d.ts +0 -4
- package/dist/names.js +0 -17
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dosgato/templating",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A library to support building templates for dosgato CMS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,11 +14,9 @@
|
|
|
14
14
|
"build": "rm -rf dist && tsc"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"mime-types": "^2.1.35",
|
|
18
17
|
"txstate-utils": "^1.8.8"
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|
|
21
|
-
"@types/mime-types": "^2.1.1",
|
|
22
20
|
"@types/node": "^18.7.11",
|
|
23
21
|
"eslint-config-standard-with-typescript": "^34.0.0",
|
|
24
22
|
"typescript": "^5.0.4"
|
package/dist/names.d.ts
DELETED
package/dist/names.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { lookup } from 'mime-types';
|
|
2
|
-
export function makeSafeFilename(str) {
|
|
3
|
-
const extFromFileName = str.match(/\.(\w+)$/)?.[1];
|
|
4
|
-
if (extFromFileName && lookup(extFromFileName))
|
|
5
|
-
str = str.replace(/\.(\w+)$/, '');
|
|
6
|
-
return str.normalize('NFKD').replace(/[^. _a-z0-9-]/ig, '').replace(/\s+/g, ' ').trim();
|
|
7
|
-
}
|
|
8
|
-
export function makeFilenamePathSafe(path) {
|
|
9
|
-
const parts = path.split('/');
|
|
10
|
-
return [...parts.slice(0, -1).map(makeSafe), makeSafeFilename(parts[parts.length - 1])].join('/');
|
|
11
|
-
}
|
|
12
|
-
export function makePathSafe(path) {
|
|
13
|
-
return path.split('/').map(makeSafe).join('/');
|
|
14
|
-
}
|
|
15
|
-
export function makeSafe(str) {
|
|
16
|
-
return str.normalize('NFKD').toLocaleLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-/, '').replace(/-$/, '');
|
|
17
|
-
}
|