@bonsae/nrg 0.5.0 → 0.5.2
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/build/server/index.cjs +7 -1
- package/build/server/resources/nrg-client.js +91 -89
- package/build/server/resources/vue.esm-browser.js +18708 -0
- package/build/vite/index.js +15 -3
- package/package.json +1 -1
- package/src/core/client/components/node-red-editor-input.vue +11 -9
- package/src/core/server/index.ts +11 -1
- package/src/vite/plugins/build.ts +15 -3
package/build/vite/index.js
CHANGED
|
@@ -1843,10 +1843,22 @@ function buildPlugin(options) {
|
|
|
1843
1843
|
const tsconfigsToCheck = [serverTsconfig, clientTsconfig].filter(
|
|
1844
1844
|
(p) => fs11.existsSync(p)
|
|
1845
1845
|
);
|
|
1846
|
-
|
|
1847
|
-
|
|
1846
|
+
try {
|
|
1847
|
+
for (const tsconfig of tsconfigsToCheck) {
|
|
1848
|
+
execSync(`npx tsc -p ${tsconfig} --noEmit`, {
|
|
1849
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
1850
|
+
encoding: "utf-8"
|
|
1851
|
+
});
|
|
1852
|
+
}
|
|
1853
|
+
logger.stopSpinner("Type checked");
|
|
1854
|
+
} catch (e) {
|
|
1855
|
+
logger.stopSpinner("Type check failed");
|
|
1856
|
+
const output = (e.stdout || "") + (e.stderr || "");
|
|
1857
|
+
if (output) {
|
|
1858
|
+
console.error(output);
|
|
1859
|
+
}
|
|
1860
|
+
throw new BuildError("type-check", e);
|
|
1848
1861
|
}
|
|
1849
|
-
logger.stopSpinner("Type checked");
|
|
1850
1862
|
logger.startSpinner("Cleaning");
|
|
1851
1863
|
cleanDir(buildContext.outDir);
|
|
1852
1864
|
logger.stopSpinner("Cleaned");
|
package/package.json
CHANGED
|
@@ -8,14 +8,16 @@
|
|
|
8
8
|
:required="required"
|
|
9
9
|
/>
|
|
10
10
|
</slot>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
<div class="editor-wrapper">
|
|
12
|
+
<button
|
|
13
|
+
ref="expand-button"
|
|
14
|
+
class="red-ui-button red-ui-button-small expand-button"
|
|
15
|
+
@click="onClickExpand"
|
|
16
|
+
>
|
|
17
|
+
<i class="fa fa-expand"></i>
|
|
18
|
+
</button>
|
|
19
|
+
<div :id="editorId" ref="editor"></div>
|
|
20
|
+
</div>
|
|
19
21
|
<div v-show="error" class="node-red-vue-input-error-message">
|
|
20
22
|
{{ error }}
|
|
21
23
|
</div>
|
|
@@ -290,7 +292,7 @@ export default defineComponent({
|
|
|
290
292
|
});
|
|
291
293
|
</script>
|
|
292
294
|
<style scoped>
|
|
293
|
-
.
|
|
295
|
+
.editor-wrapper {
|
|
294
296
|
position: relative;
|
|
295
297
|
}
|
|
296
298
|
|
package/src/core/server/index.ts
CHANGED
|
@@ -32,9 +32,19 @@ function serveNrgResources(RED: RED): void {
|
|
|
32
32
|
httpAdmin.use(function (req: any, res: any, next: any) {
|
|
33
33
|
const prefix = "/nrg/assets/";
|
|
34
34
|
if (!(req.path as string).startsWith(prefix)) return next();
|
|
35
|
-
|
|
35
|
+
let reqPath = (req.path as string)
|
|
36
36
|
.slice(prefix.length)
|
|
37
37
|
.replace(/\.\./g, "");
|
|
38
|
+
// Serve the Vue dev build in development for devtools support
|
|
39
|
+
if (
|
|
40
|
+
reqPath === "vue.esm-browser.prod.js" &&
|
|
41
|
+
process.env.NODE_ENV !== "production"
|
|
42
|
+
) {
|
|
43
|
+
const devPath = path.resolve(clientDir, "vue.esm-browser.js");
|
|
44
|
+
if (fs.existsSync(devPath)) {
|
|
45
|
+
reqPath = "vue.esm-browser.js";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
38
48
|
const filePath = path.resolve(clientDir, reqPath);
|
|
39
49
|
if (!filePath.startsWith(clientDir)) return next();
|
|
40
50
|
if (!fs.existsSync(filePath) || !fs.statSync(filePath).isFile())
|
|
@@ -37,10 +37,22 @@ function buildPlugin(options: BuildPluginOptions): Plugin {
|
|
|
37
37
|
const tsconfigsToCheck = [serverTsconfig, clientTsconfig].filter((p) =>
|
|
38
38
|
fs.existsSync(p),
|
|
39
39
|
);
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
try {
|
|
41
|
+
for (const tsconfig of tsconfigsToCheck) {
|
|
42
|
+
execSync(`npx tsc -p ${tsconfig} --noEmit`, {
|
|
43
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
44
|
+
encoding: "utf-8",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
logger.stopSpinner("Type checked");
|
|
48
|
+
} catch (e: any) {
|
|
49
|
+
logger.stopSpinner("Type check failed");
|
|
50
|
+
const output = (e.stdout || "") + (e.stderr || "");
|
|
51
|
+
if (output) {
|
|
52
|
+
console.error(output);
|
|
53
|
+
}
|
|
54
|
+
throw new BuildError("type-check", e);
|
|
42
55
|
}
|
|
43
|
-
logger.stopSpinner("Type checked");
|
|
44
56
|
|
|
45
57
|
logger.startSpinner("Cleaning");
|
|
46
58
|
cleanDir(buildContext.outDir);
|