@bigbinary/neeto-commons-frontend 4.13.53 → 4.13.54
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.
|
@@ -1,29 +1,43 @@
|
|
|
1
|
-
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
2
|
-
|
|
3
1
|
const path = require("path");
|
|
4
2
|
|
|
5
3
|
const { watch } = require("chokidar");
|
|
6
4
|
|
|
7
|
-
const nanoDevelopmentPlugin = () =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const bigBinaryPackages = path.resolve(
|
|
11
|
-
process.cwd(),
|
|
12
|
-
"node_modules",
|
|
13
|
-
"@bigbinary"
|
|
14
|
-
);
|
|
5
|
+
const nanoDevelopmentPlugin = () => {
|
|
6
|
+
let restartTimeout;
|
|
7
|
+
const isWatchMode = process.env.WATCH_MODE === "true";
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/* eslint-disable no-console */
|
|
24
|
-
console.log(`[nano-development-plugin] watcher error: ${error}`)
|
|
9
|
+
return {
|
|
10
|
+
name: "vite-plugin-nano-development",
|
|
11
|
+
configureServer(server) {
|
|
12
|
+
const bigBinaryPackagesDir = path.resolve(
|
|
13
|
+
process.cwd(),
|
|
14
|
+
"node_modules",
|
|
15
|
+
"@bigbinary"
|
|
25
16
|
);
|
|
26
|
-
|
|
27
|
-
})
|
|
17
|
+
|
|
18
|
+
watch(bigBinaryPackagesDir, { ignoreInitial: true })
|
|
19
|
+
.on("add", restartServer)
|
|
20
|
+
.on("change", restartServer)
|
|
21
|
+
.on("error", error =>
|
|
22
|
+
// eslint-disable-next-line no-console
|
|
23
|
+
console.error(`[nano-development-plugin] watcher error: ${error}`)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
function restartServer(filePath) {
|
|
27
|
+
if (isWatchMode && !filePath.endsWith(".ready")) return;
|
|
28
|
+
|
|
29
|
+
clearTimeout(restartTimeout);
|
|
30
|
+
restartTimeout = setTimeout(async () => {
|
|
31
|
+
try {
|
|
32
|
+
await server.restart(true);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console.error(`[nano-development-plugin] restart error: ${error}`);
|
|
36
|
+
}
|
|
37
|
+
}, 300);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
};
|
|
28
42
|
|
|
29
43
|
module.exports = { nanoDevelopmentPlugin };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/* eslint-disable import/extensions */
|
|
2
2
|
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const getUncachedTranslations = () => {
|
|
5
|
+
delete require.cache[require.resolve("../../scripts/getPkgTranslations.js")];
|
|
6
|
+
|
|
7
|
+
return require("../../scripts/getPkgTranslations.js");
|
|
8
|
+
};
|
|
5
9
|
|
|
6
10
|
const PREVAL_IMPORT =
|
|
7
11
|
'preval.require("../../configs/scripts/getPkgTranslations.js")';
|
|
@@ -12,7 +16,7 @@ const prevalPlugin = () => ({
|
|
|
12
16
|
if (id.includes("node_modules") && code.includes(PREVAL_IMPORT)) {
|
|
13
17
|
const replacedCode = code.replace(
|
|
14
18
|
PREVAL_IMPORT,
|
|
15
|
-
JSON.stringify(
|
|
19
|
+
JSON.stringify(getUncachedTranslations())
|
|
16
20
|
);
|
|
17
21
|
|
|
18
22
|
return { code: replacedCode, map: null };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.54",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|