vite-plugin-php 1.0.66 → 1.0.68

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/README.md CHANGED
@@ -22,16 +22,15 @@ Check out the [starter repo](https://github.com/nititech/php-vite-starter) for a
22
22
 
23
23
  | Version | Feature |
24
24
  | ------- | ----------------------------------------------------------------------------------------------------------- |
25
+ | 1.0.68 | Improved transpiled code evaluation (removed native `eval()`) |
26
+ | 1.0.67 | Removed whitespaces from PHP responses in dev mode |
25
27
  | 1.0.66 | Fixed file monitoring on Windows |
26
28
  | 1.0.65 | Fixed request body forwarding for all request methods |
27
29
  | 1.0.62 | HTML transforms are now only applied to HTML contents during dev |
28
30
  | 1.0.60 | Fixed inline module transpiling -> PHP code is being properly inserted into transpiled inline module chunks |
29
31
  | 1.0.55 | Fixed pure PHP file processing |
30
32
  | 1.0.50 | Using native Rollup pipeline to generate bundle -> proper error messages during build |
31
- | 1.0.40 | Vite's "HTML Env Replacement" feature in transpiled PHP files |
32
- | 1.0.30 | Proper PHP header forwarding during development |
33
- | 1.0.20 | URL rewrite functionality to mimic mod_rewrite & friends |
34
- | 1.0.11 | Improved Windows support |
33
+ | ... | ... |
35
34
 
36
35
  ## Write some PHP code in your `index.php`
37
36
 
package/dist/router.php CHANGED
@@ -32,11 +32,18 @@ if (count($matches)) {
32
32
  $source .= ' ?>';
33
33
  }
34
34
 
35
- (function () {
36
- try {
37
- eval('?> ' . func_get_arg(0) . ' <?php');
38
- die();
39
- } catch (\Throwable $th) {
40
- die($th->getMessage());
35
+ $includeFile = tempnam(sys_get_temp_dir(), 'vite-php');
36
+ register_shutdown_function(function ($file) {
37
+ if (file_exists($file)) {
38
+ unlink($file);
41
39
  }
42
- })($source);
40
+ }, $includeFile);
41
+ file_put_contents($includeFile, $source);
42
+
43
+ try {
44
+ (function () {
45
+ include(func_get_arg(0));
46
+ })($includeFile);
47
+ } catch (\Throwable $th) {
48
+ print($th->getMessage());
49
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-php",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
4
4
  "author": "Nikita 'donnikitos' Nitichevski <me@donnikitos.com> (https://donnikitos.com/)",
5
5
  "repository": {
6
6
  "type": "git",