vite-plugin-php 1.0.8 → 1.0.10
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/dist/index.cjs +12 -2
- package/dist/index.mjs +12 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -34,7 +34,7 @@ function escapePHP(inputFile, outputFile) {
|
|
|
34
34
|
const codeTokens = {};
|
|
35
35
|
const isJS = inputFile.includes(".js") || inputFile.includes(".ts");
|
|
36
36
|
const isML = inputFile.includes(".php") || inputFile.includes(".htm");
|
|
37
|
-
const out = input.
|
|
37
|
+
const out = input.replace(/<\?(?:php|).+?(\?>|$)/gis, (match) => {
|
|
38
38
|
let token = makeID();
|
|
39
39
|
if (isJS) {
|
|
40
40
|
token = `/*${token}*/`;
|
|
@@ -6913,6 +6913,7 @@ function usePHP(cfg = {}) {
|
|
|
6913
6913
|
url.pathname = tempFile;
|
|
6914
6914
|
const phpResult = await new Promise(
|
|
6915
6915
|
(resolve2, reject) => {
|
|
6916
|
+
const chunks = [];
|
|
6916
6917
|
http__default.request(
|
|
6917
6918
|
url.toString(),
|
|
6918
6919
|
{
|
|
@@ -6920,7 +6921,16 @@ function usePHP(cfg = {}) {
|
|
|
6920
6921
|
headers: req.headers
|
|
6921
6922
|
},
|
|
6922
6923
|
(msg) => {
|
|
6923
|
-
msg.on(
|
|
6924
|
+
msg.on(
|
|
6925
|
+
"data",
|
|
6926
|
+
(data) => chunks.push(data)
|
|
6927
|
+
);
|
|
6928
|
+
msg.on("end", () => {
|
|
6929
|
+
const result = Buffer.concat(
|
|
6930
|
+
chunks
|
|
6931
|
+
).toString("utf8");
|
|
6932
|
+
resolve2(result);
|
|
6933
|
+
});
|
|
6924
6934
|
}
|
|
6925
6935
|
).on("error", reject).end();
|
|
6926
6936
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ function escapePHP(inputFile, outputFile) {
|
|
|
21
21
|
const codeTokens = {};
|
|
22
22
|
const isJS = inputFile.includes(".js") || inputFile.includes(".ts");
|
|
23
23
|
const isML = inputFile.includes(".php") || inputFile.includes(".htm");
|
|
24
|
-
const out = input.
|
|
24
|
+
const out = input.replace(/<\?(?:php|).+?(\?>|$)/gis, (match) => {
|
|
25
25
|
let token = makeID();
|
|
26
26
|
if (isJS) {
|
|
27
27
|
token = `/*${token}*/`;
|
|
@@ -6900,6 +6900,7 @@ function usePHP(cfg = {}) {
|
|
|
6900
6900
|
url.pathname = tempFile;
|
|
6901
6901
|
const phpResult = await new Promise(
|
|
6902
6902
|
(resolve2, reject) => {
|
|
6903
|
+
const chunks = [];
|
|
6903
6904
|
http.request(
|
|
6904
6905
|
url.toString(),
|
|
6905
6906
|
{
|
|
@@ -6907,7 +6908,16 @@ function usePHP(cfg = {}) {
|
|
|
6907
6908
|
headers: req.headers
|
|
6908
6909
|
},
|
|
6909
6910
|
(msg) => {
|
|
6910
|
-
msg.on(
|
|
6911
|
+
msg.on(
|
|
6912
|
+
"data",
|
|
6913
|
+
(data) => chunks.push(data)
|
|
6914
|
+
);
|
|
6915
|
+
msg.on("end", () => {
|
|
6916
|
+
const result = Buffer.concat(
|
|
6917
|
+
chunks
|
|
6918
|
+
).toString("utf8");
|
|
6919
|
+
resolve2(result);
|
|
6920
|
+
});
|
|
6911
6921
|
}
|
|
6912
6922
|
).on("error", reject).end();
|
|
6913
6923
|
}
|