@catfyrr/vite-plugin-ssi 0.0.4 → 0.1.0
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.cjs +30 -9
- package/dist/index.d.ts +48 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -4,38 +4,59 @@ var __defProp = Object.defineProperty;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
7
12
|
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
8
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
21
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
22
|
for (let key of __getOwnPropNames(mod))
|
|
11
23
|
if (!__hasOwnProp.call(to, key))
|
|
12
24
|
__defProp(to, key, {
|
|
13
|
-
get: (
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
14
26
|
enumerable: true
|
|
15
27
|
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
16
30
|
return to;
|
|
17
31
|
};
|
|
18
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
19
32
|
var __toCommonJS = (from) => {
|
|
20
|
-
var entry = __moduleCache.get(from), desc;
|
|
33
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
21
34
|
if (entry)
|
|
22
35
|
return entry;
|
|
23
36
|
entry = __defProp({}, "__esModule", { value: true });
|
|
24
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
38
|
+
for (var key of __getOwnPropNames(from))
|
|
39
|
+
if (!__hasOwnProp.call(entry, key))
|
|
40
|
+
__defProp(entry, key, {
|
|
41
|
+
get: __accessProp.bind(from, key),
|
|
42
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
43
|
+
});
|
|
44
|
+
}
|
|
29
45
|
__moduleCache.set(from, entry);
|
|
30
46
|
return entry;
|
|
31
47
|
};
|
|
48
|
+
var __moduleCache;
|
|
49
|
+
var __returnValue = (v) => v;
|
|
50
|
+
function __exportSetter(name, newValue) {
|
|
51
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
52
|
+
}
|
|
32
53
|
var __export = (target, all) => {
|
|
33
54
|
for (var name in all)
|
|
34
55
|
__defProp(target, name, {
|
|
35
56
|
get: all[name],
|
|
36
57
|
enumerable: true,
|
|
37
58
|
configurable: true,
|
|
38
|
-
set: (
|
|
59
|
+
set: __exportSetter.bind(all, name)
|
|
39
60
|
});
|
|
40
61
|
};
|
|
41
62
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
2
|
import { type FileTypeMap } from './file-types';
|
|
3
|
+
/**
|
|
4
|
+
* File type to extension mappings for intelligent SSI processing.
|
|
5
|
+
* Maps file type names (e.g., 'js', 'css', 'html') to arrays of file extensions.
|
|
6
|
+
* Used to determine which file types should be processed when included via SSI.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const fileTypeMap: FileTypeMap = {
|
|
11
|
+
* js: ['.js', '.ts', '.jsx'],
|
|
12
|
+
* css: ['.css', '.scss']
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
3
16
|
export type { FileTypeMap } from './file-types';
|
|
17
|
+
/**
|
|
18
|
+
* Configuration options for the Vite SSI plugin.
|
|
19
|
+
*
|
|
20
|
+
* All options are optional and have sensible defaults.
|
|
21
|
+
*/
|
|
4
22
|
export interface VitePluginSsiOptions {
|
|
5
23
|
/**
|
|
6
24
|
* Maximum depth for recursive includes
|
|
@@ -35,4 +53,34 @@ export interface VitePluginSsiOptions {
|
|
|
35
53
|
*/
|
|
36
54
|
fileTypeMap?: FileTypeMap;
|
|
37
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Vite plugin for Server-Side Includes (SSI) processing.
|
|
58
|
+
*
|
|
59
|
+
* This plugin processes Apache/Nginx-compatible SSI directives in HTML files,
|
|
60
|
+
* including support for `<!--#include virtual="..." -->` and `<!--#include file="..." -->`.
|
|
61
|
+
*
|
|
62
|
+
* Features:
|
|
63
|
+
* - Supports recursive includes with configurable depth limits
|
|
64
|
+
* - Hot Module Replacement (HMR) support for included files
|
|
65
|
+
* - Works in dev, build, and preview modes
|
|
66
|
+
* - Configurable file type processing
|
|
67
|
+
* - Custom file type mappings
|
|
68
|
+
*
|
|
69
|
+
* @param options - Configuration options for the SSI plugin
|
|
70
|
+
* @returns A Vite plugin instance
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* import vitePluginSsi from '@catfyrr/vite-plugin-ssi';
|
|
75
|
+
*
|
|
76
|
+
* export default defineConfig({
|
|
77
|
+
* plugins: [
|
|
78
|
+
* vitePluginSsi({
|
|
79
|
+
* maxDepth: 5,
|
|
80
|
+
* includeFileTypes: ['html', 'js']
|
|
81
|
+
* })
|
|
82
|
+
* ]
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
38
86
|
export default function vitePluginSsi(options?: VitePluginSsiOptions): Plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catfyrr/vite-plugin-ssi",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Fully Apache/Nginx compatible Server-Side Includes (SSI) Vite plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/catFurr/vite-plugin-ssi#readme",
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"vite": "^5.0.0"
|
|
49
|
+
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^20.10.0",
|
|
@@ -59,6 +59,6 @@
|
|
|
59
59
|
"husky": "^8.0.3",
|
|
60
60
|
"prettier": "^3.1.0",
|
|
61
61
|
"typescript": "^5.3.2",
|
|
62
|
-
"vite": "^
|
|
62
|
+
"vite": "^6.0.0"
|
|
63
63
|
}
|
|
64
64
|
}
|