afront 1.0.6 → 1.0.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.
Files changed (3) hide show
  1. package/install.js +1 -1
  2. package/package.json +17 -7
  3. package/server.js +11 -0
package/install.js CHANGED
@@ -8,7 +8,7 @@ const AdmZip = require('adm-zip');
8
8
  const readline = require('readline');
9
9
 
10
10
  // Configuration
11
- const GITHUB_ZIP_URL = 'https://github.com/Asggen/afront/archive/refs/tags/v1.0.2.zip'; // Updated URL
11
+ const GITHUB_ZIP_URL = 'https://github.com/Asggen/afront/archive/refs/tags/v1.0.8.zip'; // Updated URL
12
12
 
13
13
  // Define files to skip
14
14
  const SKIP_FILES = ['FUNDING.yml', 'CODE_OF_CONDUCT.md', 'SECURITY.md', 'install.js'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afront",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "AFront is a front-end JavaScript library designed to create seamless server-side rendered (SSSR) websites.",
5
5
  "main": "webpack.dev.js",
6
6
  "scripts": {
@@ -33,22 +33,26 @@
33
33
  ],
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
+ "adm-zip": "^0.5.15",
37
+ "afront": "^1.0.5",
36
38
  "asggen-headtags": "^1.0.3",
37
39
  "babel-plugin-css-modules-transform": "^1.6.2",
38
40
  "babel-plugin-dynamic-import-node": "^2.3.3",
39
41
  "copy-webpack-plugin": "^12.0.2",
40
42
  "dotenv": "^16.4.5",
43
+ "express-rate-limit": "^7.4.0",
44
+ "extract-zip": "^2.0.0",
45
+ "follow-redirects": "^1.15.6",
41
46
  "fs-extra": "^11.2.0",
42
47
  "ignore-styles": "^5.0.1",
48
+ "json5": "^1.0.2",
49
+ "loader-utils": "^1.4.2",
43
50
  "react-router-dom": "^6.26.0",
44
51
  "readline-sync": "^1.4.10",
45
52
  "styled-components": "^6.1.12",
46
53
  "terser-webpack-plugin": "^5.3.10",
47
- "tmp": "^0.2.1",
48
- "extract-zip": "^2.0.0",
49
- "adm-zip": "^0.5.15",
50
- "afront": "^1.0.5",
51
- "follow-redirects": "^1.15.6"
54
+ "postcss": "^8.4.31",
55
+ "tmp": "^0.2.1"
52
56
  },
53
57
  "devDependencies": {
54
58
  "@babel/cli": "^7.24.8",
@@ -62,14 +66,20 @@
62
66
  "express": "^4.19.2",
63
67
  "html-webpack-plugin": "^5.6.0",
64
68
  "ignore-styles": "^5.0.1",
69
+ "json5": "^1.0.2",
65
70
  "mini-css-extract-plugin": "^2.9.0",
71
+ "patch-package": "^8.0.0",
66
72
  "react": "^18.3.1",
67
73
  "react-dom": "^18.3.1",
68
74
  "style-loader": "^4.0.0",
69
75
  "webpack": "^5.91.0",
70
76
  "webpack-cli": "^5.1.4",
71
77
  "webpack-dev-server": "^5.0.4",
72
- "webpack-node-externals": "^3.0.0"
78
+ "webpack-node-externals": "^3.0.0",
79
+ "postcss": "^8.4.31"
80
+ },
81
+ "resolutions": {
82
+ "loader-utils": "^1.4.2"
73
83
  },
74
84
  "bin": {
75
85
  "afront": "install.js"
package/server.js CHANGED
@@ -1,11 +1,22 @@
1
1
  const express = require("express");
2
2
  const path = require("path");
3
+ const RateLimit = require("express-rate-limit");
3
4
  require("dotenv").config();
4
5
 
5
6
  const app = express();
6
7
  const PORT = process.env.PORT;
7
8
  const HOST = process.env.HOST;
8
9
 
10
+ // Set up rate limiter: maximum of 100 requests per 15 minutes
11
+ const limiter = RateLimit({
12
+ windowMs: 15 * 60 * 1000, // 15 minutes
13
+ max: 100, // max 100 requests per windowMs
14
+ message: "Too many requests from this IP, please try again after 15 minutes",
15
+ });
16
+
17
+ // Apply rate limiter to all requests
18
+ app.use(limiter);
19
+
9
20
  // Serve static files from the build-prod-static directory
10
21
  app.use(express.static(path.join(__dirname, "build-prod-static")));
11
22