create-prisma-php-app 1.27.1 → 1.27.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.
@@ -8,10 +8,10 @@ const { __dirname } = getFileMeta();
8
8
  const parser = new Engine({
9
9
  parser: {
10
10
  php8: true,
11
- extractDoc: true,
11
+ suppressErrors: true,
12
12
  },
13
13
  ast: {
14
- withPositions: true,
14
+ withPositions: false,
15
15
  },
16
16
  });
17
17
 
@@ -58,10 +58,6 @@ async function getAllPhpFiles(dir: string): Promise<string[]> {
58
58
  return files;
59
59
  }
60
60
 
61
- function preprocessPhpCode(code: string): string {
62
- return code.replace(/<<<['"]?[A-Z_]+['"]?[\s\S]*?[A-Z_]+\s*;/g, "'';");
63
- }
64
-
65
61
  function combineNamespaces(
66
62
  baseNamespace: string,
67
63
  subNamespace: string
@@ -74,10 +70,7 @@ function combineNamespaces(
74
70
  async function analyzeImportsInFile(
75
71
  filePath: string
76
72
  ): Promise<Record<string, string>> {
77
- let code = await fs.readFile(filePath, "utf-8");
78
-
79
- // Preprocess the PHP code
80
- code = preprocessPhpCode(code);
73
+ const code = await fs.readFile(filePath, "utf-8");
81
74
 
82
75
  try {
83
76
  // Parse the PHP file to AST
@@ -13,10 +13,10 @@ const PHPX_BASE_CLASS = "PHPX";
13
13
  const parser = new Engine({
14
14
  parser: {
15
15
  php8: true,
16
- extractDoc: true,
16
+ suppressErrors: true,
17
17
  },
18
18
  ast: {
19
- withPositions: true,
19
+ withPositions: false,
20
20
  },
21
21
  });
22
22
 
@@ -33,16 +33,8 @@ async function saveLogData(logData: Record<string, any>) {
33
33
  await fs.writeFile(LOG_FILE, JSON.stringify(logData, null, 2));
34
34
  }
35
35
 
36
- function preprocessPhpCode(code: string): string {
37
- // Match heredocs and nowdocs and replace them with placeholders
38
- return code.replace(/<<<['"]?[A-Z_]+['"]?[\s\S]*?[A-Z_]+\s*;/g, "'';");
39
- }
40
-
41
36
  async function analyzePhpFile(filePath: string) {
42
- let code = await fs.readFile(filePath, "utf-8");
43
-
44
- // Preprocess the PHP code
45
- code = preprocessPhpCode(code);
37
+ const code = await fs.readFile(filePath, "utf-8");
46
38
 
47
39
  try {
48
40
  // Parse the PHP file to AST
@@ -18,6 +18,15 @@ final class AuthMiddleware
18
18
  $isPublicRoute = self::matches($requestPathname, AuthConfig::$publicRoutes);
19
19
  $isAuthRoute = self::matches($requestPathname, AuthConfig::$authRoutes);
20
20
 
21
+ // Check if the user is authenticated and refresh the token if necessary
22
+ if (AuthConfig::IS_TOKEN_AUTO_REFRESH) {
23
+ $auth = Auth::getInstance();
24
+ if (isset($_COOKIE[Auth::COOKIE_NAME])) {
25
+ $jwt = $_COOKIE[Auth::COOKIE_NAME];
26
+ $jwt = $auth->refreshToken($jwt);
27
+ }
28
+ }
29
+
21
30
  // Skip the middleware if the route is api auth route
22
31
  if ($isApiAuthRoute) {
23
32
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.27.1",
3
+ "version": "1.27.3",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",