vite-plugin-php 1.0.70 → 1.0.71
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 +1 -2
- package/dist/index.cjs +15 -0
- package/dist/index.mjs +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ 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.71 | Fixed assets prepending for namespaced PHP-files |
|
|
25
26
|
| 1.0.70 | Added include path override for relative PHP imports in dev mode |
|
|
26
27
|
| 1.0.69 | Using new token format to escape PHP in HTML |
|
|
27
28
|
| 1.0.68 | Improved transpiled code evaluation (removed native `eval()`) |
|
|
@@ -30,8 +31,6 @@ Check out the [starter repo](https://github.com/nititech/php-vite-starter) for a
|
|
|
30
31
|
| 1.0.65 | Fixed request body forwarding for all request methods |
|
|
31
32
|
| 1.0.62 | HTML transforms are now only applied to HTML contents during dev |
|
|
32
33
|
| 1.0.60 | Fixed inline module transpiling -> PHP code is being properly inserted into transpiled inline module chunks |
|
|
33
|
-
| 1.0.55 | Fixed pure PHP file processing |
|
|
34
|
-
| 1.0.50 | Using native Rollup pipeline to generate bundle -> proper error messages during build |
|
|
35
34
|
| ... | ... |
|
|
36
35
|
|
|
37
36
|
## Write some PHP code in your `index.php`
|
package/dist/index.cjs
CHANGED
|
@@ -6977,6 +6977,19 @@ function consoleHijack(entries) {
|
|
|
6977
6977
|
});
|
|
6978
6978
|
}
|
|
6979
6979
|
|
|
6980
|
+
const namespacePattern = new RegExp(
|
|
6981
|
+
/(.+?)(<\?(?:php|)\s+namespace\s\S+?(?:\s*;|\s*{).+)(<\/.+?>|<.+?\/>)(.+|$)/,
|
|
6982
|
+
"si"
|
|
6983
|
+
);
|
|
6984
|
+
function processOutput(input) {
|
|
6985
|
+
let out = input;
|
|
6986
|
+
out = out.replace(
|
|
6987
|
+
namespacePattern,
|
|
6988
|
+
(match, assets, contents, lastTag, trailingContent) => contents + lastTag + "\r\n" + assets.trim() + trailingContent
|
|
6989
|
+
);
|
|
6990
|
+
return out;
|
|
6991
|
+
}
|
|
6992
|
+
|
|
6980
6993
|
const internalParam = "__314159265359__";
|
|
6981
6994
|
function usePHP(cfg = {}) {
|
|
6982
6995
|
const {
|
|
@@ -7246,6 +7259,7 @@ function usePHP(cfg = {}) {
|
|
|
7246
7259
|
escapedCode: item.source.toString(),
|
|
7247
7260
|
phpCodes: meta.phpCodes
|
|
7248
7261
|
});
|
|
7262
|
+
item.source = processOutput(item.source);
|
|
7249
7263
|
}
|
|
7250
7264
|
} else if (item.type === "chunk" && item.facadeModuleId) {
|
|
7251
7265
|
const meta = this.getModuleInfo(
|
|
@@ -7256,6 +7270,7 @@ function usePHP(cfg = {}) {
|
|
|
7256
7270
|
escapedCode: item.code,
|
|
7257
7271
|
phpCodes: meta.phpCodes
|
|
7258
7272
|
});
|
|
7273
|
+
item.code = processOutput(item.code);
|
|
7259
7274
|
}
|
|
7260
7275
|
}
|
|
7261
7276
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -6964,6 +6964,19 @@ function consoleHijack(entries) {
|
|
|
6964
6964
|
});
|
|
6965
6965
|
}
|
|
6966
6966
|
|
|
6967
|
+
const namespacePattern = new RegExp(
|
|
6968
|
+
/(.+?)(<\?(?:php|)\s+namespace\s\S+?(?:\s*;|\s*{).+)(<\/.+?>|<.+?\/>)(.+|$)/,
|
|
6969
|
+
"si"
|
|
6970
|
+
);
|
|
6971
|
+
function processOutput(input) {
|
|
6972
|
+
let out = input;
|
|
6973
|
+
out = out.replace(
|
|
6974
|
+
namespacePattern,
|
|
6975
|
+
(match, assets, contents, lastTag, trailingContent) => contents + lastTag + "\r\n" + assets.trim() + trailingContent
|
|
6976
|
+
);
|
|
6977
|
+
return out;
|
|
6978
|
+
}
|
|
6979
|
+
|
|
6967
6980
|
const internalParam = "__314159265359__";
|
|
6968
6981
|
function usePHP(cfg = {}) {
|
|
6969
6982
|
const {
|
|
@@ -7233,6 +7246,7 @@ function usePHP(cfg = {}) {
|
|
|
7233
7246
|
escapedCode: item.source.toString(),
|
|
7234
7247
|
phpCodes: meta.phpCodes
|
|
7235
7248
|
});
|
|
7249
|
+
item.source = processOutput(item.source);
|
|
7236
7250
|
}
|
|
7237
7251
|
} else if (item.type === "chunk" && item.facadeModuleId) {
|
|
7238
7252
|
const meta = this.getModuleInfo(
|
|
@@ -7243,6 +7257,7 @@ function usePHP(cfg = {}) {
|
|
|
7243
7257
|
escapedCode: item.code,
|
|
7244
7258
|
phpCodes: meta.phpCodes
|
|
7245
7259
|
});
|
|
7260
|
+
item.code = processOutput(item.code);
|
|
7246
7261
|
}
|
|
7247
7262
|
}
|
|
7248
7263
|
});
|