@catfyrr/vite-plugin-ssi 0.0.1

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.
Files changed (3) hide show
  1. package/README.md +38 -0
  2. package/dist/index.js +53 -0
  3. package/package.json +63 -0
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Vite SSI Plugin
2
+
3
+ A fully Apache/Nginx compatible Server-Side Includes (SSI) plugin for Vite.
4
+
5
+ ## Features
6
+
7
+ - 🌐 Apache/Nginx SSI compatibility
8
+ - 🚀 Vite integration
9
+ - 🔧 Customizable include processing
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ bun add @catfyrr/vite-plugin-ssi
15
+ # or
16
+ npm install @catfyrr/vite-plugin-ssi
17
+ # or
18
+ npx jsr install @catfyrr/vite-plugin-ssi
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```typescript
24
+ import { defineConfig } from 'vite';
25
+ import vitePluginSsi from '@catfyrr/vite-plugin-ssi';
26
+
27
+ export default defineConfig({
28
+ plugins: [
29
+ vitePluginSsi({
30
+ include: ['.html', '.shtml'],
31
+ })
32
+ ]
33
+ });
34
+ ```
35
+
36
+ ## License
37
+
38
+ MIT
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ // @bun @bun-cjs
2
+ (function(exports, require, module, __filename, __dirname) {var __defProp = Object.defineProperty;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __moduleCache = /* @__PURE__ */ new WeakMap;
7
+ var __toCommonJS = (from) => {
8
+ var entry = __moduleCache.get(from), desc;
9
+ if (entry)
10
+ return entry;
11
+ entry = __defProp({}, "__esModule", { value: true });
12
+ if (from && typeof from === "object" || typeof from === "function")
13
+ __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ }));
17
+ __moduleCache.set(from, entry);
18
+ return entry;
19
+ };
20
+ var __export = (target, all) => {
21
+ for (var name in all)
22
+ __defProp(target, name, {
23
+ get: all[name],
24
+ enumerable: true,
25
+ configurable: true,
26
+ set: (newValue) => all[name] = () => newValue
27
+ });
28
+ };
29
+
30
+ // src/index.ts
31
+ var exports_src = {};
32
+ __export(exports_src, {
33
+ default: () => vitePluginSsi
34
+ });
35
+ module.exports = __toCommonJS(exports_src);
36
+ function vitePluginSsi(options = {}) {
37
+ const { include = [".html"], processIncludes = defaultProcessIncludes } = options;
38
+ return {
39
+ name: "vite-plugin-ssi",
40
+ transform(code, id) {
41
+ if (!include.some((ext) => id.endsWith(ext))) {
42
+ return null;
43
+ }
44
+ return processIncludes(code);
45
+ }
46
+ };
47
+ }
48
+ function defaultProcessIncludes(content) {
49
+ return content.replace(/<!--\s*#include\s+(virtual|file)="([^"]+)"\s*-->/g, (match, type, path) => {
50
+ return `<!-- Unimplemented SSI include: ${type} - ${path} -->`;
51
+ });
52
+ }
53
+ })
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@catfyrr/vite-plugin-ssi",
3
+ "version": "0.0.1",
4
+ "description": "Fully Apache/Nginx compatible Server-Side Includes (SSI) Vite plugin",
5
+ "type": "module",
6
+ "exports": {
7
+ "import": "./dist/index.mjs",
8
+ "require": "./dist/index.cjs",
9
+ "types": "./dist/index.d.ts"
10
+ },
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.mjs",
13
+ "types": "./dist/index.d.ts",
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18.0.0"
19
+ },
20
+ "scripts": {
21
+ "build": "bun run build:esm && bun run build:cjs",
22
+ "build:esm": "bun build ./src/index.ts --outdir dist --target bun --format esm",
23
+ "build:cjs": "bun build ./src/index.ts --outdir dist --target bun --format cjs",
24
+ "test": "bun test",
25
+ "test:watch": "bun test --watch",
26
+ "lint": "eslint src tests",
27
+ "lint:fix": "eslint src tests --fix",
28
+ "prepublishOnly": "bun run build",
29
+ "prepare": "husky install"
30
+ },
31
+ "keywords": [
32
+ "vite",
33
+ "plugin",
34
+ "ssi",
35
+ "server-side-includes",
36
+ "build-tool"
37
+ ],
38
+ "author": "catFurr <ibrahim3@tutamail.com>",
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/catFurr/vite-plugin-ssi.git"
43
+ },
44
+ "bugs": {
45
+ "url": "https://github.com/catFurr/vite-plugin-ssi/issues"
46
+ },
47
+ "homepage": "https://github.com/catFurr/vite-plugin-ssi#readme",
48
+ "dependencies": {
49
+ "vite": "^5.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^20.10.0",
53
+ "@typescript-eslint/eslint-plugin": "^6.13.1",
54
+ "@typescript-eslint/parser": "^6.13.1",
55
+ "bun-types": "latest",
56
+ "eslint": "^8.54.0",
57
+ "eslint-config-prettier": "^9.0.0",
58
+ "eslint-plugin-prettier": "^5.0.1",
59
+ "husky": "^8.0.3",
60
+ "prettier": "^3.1.0",
61
+ "typescript": "^5.3.2"
62
+ }
63
+ }