@pronto-tools-and-more/pronto 4.2.0 → 4.3.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pronto-tools-and-more/pronto",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pronto-tools-and-more/file-watcher": "4.
|
|
17
|
-
"@pronto-tools-and-more/files": "4.
|
|
18
|
-
"@pronto-tools-and-more/network-process": "4.
|
|
19
|
-
"@pronto-tools-and-more/sass-compiler": "4.
|
|
16
|
+
"@pronto-tools-and-more/file-watcher": "4.3.0",
|
|
17
|
+
"@pronto-tools-and-more/files": "4.3.0",
|
|
18
|
+
"@pronto-tools-and-more/network-process": "4.3.0",
|
|
19
|
+
"@pronto-tools-and-more/sass-compiler": "4.3.0",
|
|
20
20
|
"@lvce-editor/assert": "^1.2.0",
|
|
21
21
|
"@lvce-editor/ipc": "^9.3.0",
|
|
22
22
|
"@lvce-editor/json-rpc": "^1.3.0",
|
package/src/parts/App/App.js
CHANGED
|
@@ -90,6 +90,22 @@ export const create = ({
|
|
|
90
90
|
ProxyPath.create({
|
|
91
91
|
prefix: "/resources/web",
|
|
92
92
|
to: Config.managerWebUrl,
|
|
93
|
+
customIf: [
|
|
94
|
+
{
|
|
95
|
+
match: "purpleshared/custom.css",
|
|
96
|
+
file: join(defaultPath, "readmode", "custom.css"),
|
|
97
|
+
postfix: "",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
match: "purpleshared/custom.js",
|
|
101
|
+
file: join(defaultPath, "readmode", "custom.js"),
|
|
102
|
+
postfix: `
|
|
103
|
+
const script = document.createElement('script')
|
|
104
|
+
script.src='/assets/live-reload-readmode.js'
|
|
105
|
+
document.head.append(script)
|
|
106
|
+
`,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
93
109
|
})
|
|
94
110
|
);
|
|
95
111
|
return app;
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
1
2
|
import { join } from "node:path";
|
|
2
3
|
import * as SendFullUpdates from "../SendFullUpdates/SendFullUpdates.js";
|
|
3
4
|
import * as SendSassUpdates from "../SendSassUpdates/SendSassUpdates.js";
|
|
5
|
+
import * as SendUpdates from "../SendUpdates/SendUpdates.js";
|
|
4
6
|
|
|
5
|
-
export const handleFileChange = (clients, event, root, errorColor) => {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
export const handleFileChange = async (clients, event, root, errorColor) => {
|
|
8
|
+
const absolutePath = join(root, event.filename);
|
|
9
|
+
if (event.filename === "default/readmode/custom.css") {
|
|
10
|
+
const css = await readFile(absolutePath, "utf8");
|
|
11
|
+
const changes = [
|
|
12
|
+
{
|
|
13
|
+
fileName: event.filename,
|
|
14
|
+
css,
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
SendUpdates.sendUpdates(clients, {
|
|
18
|
+
jsonrpc: "2.0",
|
|
19
|
+
method: "updateCss",
|
|
20
|
+
params: [changes],
|
|
21
|
+
});
|
|
22
|
+
} else if (event.filename.endsWith(".scss")) {
|
|
8
23
|
SendSassUpdates.sendSassUpdates(
|
|
9
24
|
clients,
|
|
10
25
|
absolutePath,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VError } from "@lvce-editor/verror";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
2
3
|
import { pipeline } from "node:stream/promises";
|
|
3
4
|
|
|
4
5
|
const getProxyResponse = async (prefix, to, sourceUrl) => {
|
|
@@ -16,8 +17,17 @@ const getProxyResponse = async (prefix, to, sourceUrl) => {
|
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
export const create = ({ prefix, to }) => {
|
|
20
|
+
export const create = ({ prefix, to, customIf }) => {
|
|
20
21
|
const proxyFn = async (req, res) => {
|
|
22
|
+
for (const item of customIf) {
|
|
23
|
+
if (req.url.includes(item.match)) {
|
|
24
|
+
const absolutePath = item.file;
|
|
25
|
+
const content = await readFile(absolutePath, "utf8");
|
|
26
|
+
const fullContent = content + "\n" + item.postfix;
|
|
27
|
+
res.end(fullContent);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
21
31
|
const proxyResponse = await getProxyResponse(prefix, to, req.url);
|
|
22
32
|
await pipeline(proxyResponse, res);
|
|
23
33
|
};
|