site-config-stack 3.1.7 → 3.1.8

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/urls.cjs CHANGED
@@ -20,9 +20,119 @@ function resolveSitePath(pathOrUrl, options) {
20
20
  const resolvedUrl = ufo.withBase(path, baseWithOrigin);
21
21
  return path === "/" && !options.withBase ? ufo.withTrailingSlash(resolvedUrl) : fixSlashes(options.trailingSlash, resolvedUrl);
22
22
  }
23
+ const fileExtensions = [
24
+ // Images
25
+ "jpg",
26
+ "jpeg",
27
+ "png",
28
+ "gif",
29
+ "bmp",
30
+ "webp",
31
+ "svg",
32
+ "ico",
33
+ // Documents
34
+ "pdf",
35
+ "doc",
36
+ "docx",
37
+ "xls",
38
+ "xlsx",
39
+ "ppt",
40
+ "pptx",
41
+ "txt",
42
+ "md",
43
+ "markdown",
44
+ // Archives
45
+ "zip",
46
+ "rar",
47
+ "7z",
48
+ "tar",
49
+ "gz",
50
+ // Audio
51
+ "mp3",
52
+ "wav",
53
+ "flac",
54
+ "ogg",
55
+ "opus",
56
+ "m4a",
57
+ "aac",
58
+ "midi",
59
+ "mid",
60
+ // Video
61
+ "mp4",
62
+ "avi",
63
+ "mkv",
64
+ "mov",
65
+ "wmv",
66
+ "flv",
67
+ "webm",
68
+ // Web
69
+ "html",
70
+ "css",
71
+ "js",
72
+ "json",
73
+ "xml",
74
+ "tsx",
75
+ "jsx",
76
+ "ts",
77
+ "vue",
78
+ "svelte",
79
+ // Programming
80
+ "php",
81
+ "py",
82
+ "rb",
83
+ "java",
84
+ "c",
85
+ "cpp",
86
+ "h",
87
+ "go",
88
+ // Data formats
89
+ "csv",
90
+ "tsv",
91
+ "sql",
92
+ "yaml",
93
+ "yml",
94
+ // Fonts
95
+ "woff",
96
+ "woff2",
97
+ "ttf",
98
+ "otf",
99
+ "eot",
100
+ // Executables/Binaries
101
+ "exe",
102
+ "msi",
103
+ "apk",
104
+ "ipa",
105
+ "dmg",
106
+ "iso",
107
+ "bin",
108
+ // Scripts/Config
109
+ "bat",
110
+ "cmd",
111
+ "sh",
112
+ "env",
113
+ "htaccess",
114
+ "conf",
115
+ "toml",
116
+ "ini",
117
+ // Package formats
118
+ "deb",
119
+ "rpm",
120
+ "jar",
121
+ "war",
122
+ // E-books
123
+ "epub",
124
+ "mobi",
125
+ // Common temporary/backup files
126
+ "log",
127
+ "tmp",
128
+ "bak",
129
+ "old",
130
+ "sav"
131
+ ];
23
132
  function isPathFile(path) {
24
133
  const lastSegment = path.split("/").pop();
25
- return !!(lastSegment || path).match(/\.[0-9a-z]+$/i)?.[0];
134
+ const ext = (lastSegment || path).match(/\.[0-9a-z]+$/i)?.[0];
135
+ return ext && fileExtensions.includes(ext.replace(".", ""));
26
136
  }
27
137
  function fixSlashes(trailingSlash, pathOrUrl) {
28
138
  const $url = ufo.parseURL(pathOrUrl);
package/dist/urls.d.cts CHANGED
@@ -5,7 +5,7 @@ declare function resolveSitePath(pathOrUrl: string, options: {
5
5
  absolute?: boolean;
6
6
  withBase?: boolean;
7
7
  }): string;
8
- declare function isPathFile(path: string): boolean;
8
+ declare function isPathFile(path: string): boolean | "" | undefined;
9
9
  declare function fixSlashes(trailingSlash: boolean | undefined, pathOrUrl: string): string;
10
10
 
11
11
  export { fixSlashes, isPathFile, resolveSitePath };
package/dist/urls.d.mts CHANGED
@@ -5,7 +5,7 @@ declare function resolveSitePath(pathOrUrl: string, options: {
5
5
  absolute?: boolean;
6
6
  withBase?: boolean;
7
7
  }): string;
8
- declare function isPathFile(path: string): boolean;
8
+ declare function isPathFile(path: string): boolean | "" | undefined;
9
9
  declare function fixSlashes(trailingSlash: boolean | undefined, pathOrUrl: string): string;
10
10
 
11
11
  export { fixSlashes, isPathFile, resolveSitePath };
package/dist/urls.d.ts CHANGED
@@ -5,7 +5,7 @@ declare function resolveSitePath(pathOrUrl: string, options: {
5
5
  absolute?: boolean;
6
6
  withBase?: boolean;
7
7
  }): string;
8
- declare function isPathFile(path: string): boolean;
8
+ declare function isPathFile(path: string): boolean | "" | undefined;
9
9
  declare function fixSlashes(trailingSlash: boolean | undefined, pathOrUrl: string): string;
10
10
 
11
11
  export { fixSlashes, isPathFile, resolveSitePath };
package/dist/urls.mjs CHANGED
@@ -18,9 +18,119 @@ function resolveSitePath(pathOrUrl, options) {
18
18
  const resolvedUrl = withBase(path, baseWithOrigin);
19
19
  return path === "/" && !options.withBase ? withTrailingSlash(resolvedUrl) : fixSlashes(options.trailingSlash, resolvedUrl);
20
20
  }
21
+ const fileExtensions = [
22
+ // Images
23
+ "jpg",
24
+ "jpeg",
25
+ "png",
26
+ "gif",
27
+ "bmp",
28
+ "webp",
29
+ "svg",
30
+ "ico",
31
+ // Documents
32
+ "pdf",
33
+ "doc",
34
+ "docx",
35
+ "xls",
36
+ "xlsx",
37
+ "ppt",
38
+ "pptx",
39
+ "txt",
40
+ "md",
41
+ "markdown",
42
+ // Archives
43
+ "zip",
44
+ "rar",
45
+ "7z",
46
+ "tar",
47
+ "gz",
48
+ // Audio
49
+ "mp3",
50
+ "wav",
51
+ "flac",
52
+ "ogg",
53
+ "opus",
54
+ "m4a",
55
+ "aac",
56
+ "midi",
57
+ "mid",
58
+ // Video
59
+ "mp4",
60
+ "avi",
61
+ "mkv",
62
+ "mov",
63
+ "wmv",
64
+ "flv",
65
+ "webm",
66
+ // Web
67
+ "html",
68
+ "css",
69
+ "js",
70
+ "json",
71
+ "xml",
72
+ "tsx",
73
+ "jsx",
74
+ "ts",
75
+ "vue",
76
+ "svelte",
77
+ // Programming
78
+ "php",
79
+ "py",
80
+ "rb",
81
+ "java",
82
+ "c",
83
+ "cpp",
84
+ "h",
85
+ "go",
86
+ // Data formats
87
+ "csv",
88
+ "tsv",
89
+ "sql",
90
+ "yaml",
91
+ "yml",
92
+ // Fonts
93
+ "woff",
94
+ "woff2",
95
+ "ttf",
96
+ "otf",
97
+ "eot",
98
+ // Executables/Binaries
99
+ "exe",
100
+ "msi",
101
+ "apk",
102
+ "ipa",
103
+ "dmg",
104
+ "iso",
105
+ "bin",
106
+ // Scripts/Config
107
+ "bat",
108
+ "cmd",
109
+ "sh",
110
+ "env",
111
+ "htaccess",
112
+ "conf",
113
+ "toml",
114
+ "ini",
115
+ // Package formats
116
+ "deb",
117
+ "rpm",
118
+ "jar",
119
+ "war",
120
+ // E-books
121
+ "epub",
122
+ "mobi",
123
+ // Common temporary/backup files
124
+ "log",
125
+ "tmp",
126
+ "bak",
127
+ "old",
128
+ "sav"
129
+ ];
21
130
  function isPathFile(path) {
22
131
  const lastSegment = path.split("/").pop();
23
- return !!(lastSegment || path).match(/\.[0-9a-z]+$/i)?.[0];
132
+ const ext = (lastSegment || path).match(/\.[0-9a-z]+$/i)?.[0];
133
+ return ext && fileExtensions.includes(ext.replace(".", ""));
24
134
  }
25
135
  function fixSlashes(trailingSlash, pathOrUrl) {
26
136
  const $url = parseURL(pathOrUrl);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "site-config-stack",
3
3
  "type": "module",
4
- "version": "3.1.7",
4
+ "version": "3.1.8",
5
5
  "description": "Shared site configuration utilities.",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",