querysub 0.5.0 → 0.7.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
|
@@ -157,6 +157,11 @@ let moduleResolver = async (spec: FunctionSpec) => {
|
|
|
157
157
|
return repoPath;
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
+
export function isDynamicModule(module: NodeJS.Module): boolean {
|
|
161
|
+
// Mostly a hack, but... it SHOULD be fine
|
|
162
|
+
let parts = module.filename.replaceAll("\\", "/").split("/");
|
|
163
|
+
return parts.includes("node_modules") || parts.includes("synced_repos");
|
|
164
|
+
}
|
|
160
165
|
|
|
161
166
|
async function getModuleFromSpecBase(
|
|
162
167
|
spec: FunctionSpec
|
|
@@ -195,7 +200,6 @@ async function getModuleFromSpecBase(
|
|
|
195
200
|
await (require as any)(path, true);
|
|
196
201
|
});
|
|
197
202
|
} catch (e: any) {
|
|
198
|
-
|
|
199
203
|
throw new Error(`Error when loading function for ${JSON.stringify(path)}:${spec.FunctionId}\n${e.stack}`);
|
|
200
204
|
}
|
|
201
205
|
let moduleId = require.resolve(path) || path;
|
|
@@ -49,6 +49,7 @@ import { devDebugbreak, getDomain, isDevDebugbreak, isNoNetwork, isPublic } from
|
|
|
49
49
|
import { hookErrors } from "../diagnostics/errorLogs/hookErrors";
|
|
50
50
|
import { Schema2, Schema2T, t } from "../2-proxy/schema2";
|
|
51
51
|
import { CALL_PERMISSIONS_KEY } from "./permissionsShared";
|
|
52
|
+
import { isDynamicModule } from "../3-path-functions/pathFunctionLoader";
|
|
52
53
|
|
|
53
54
|
export { t };
|
|
54
55
|
|
|
@@ -16,6 +16,7 @@ import { PathValueProxyWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
|
16
16
|
import { InputLabel, InputLabelURL } from "../library-components/InputLabel";
|
|
17
17
|
import { URLParam } from "../library-components/URLParam";
|
|
18
18
|
import { hotReloadingGuard, isHotReloading, onHotReload } from "socket-function/hot/HotReloadController";
|
|
19
|
+
import { isDynamicModule } from "../3-path-functions/pathFunctionLoader";
|
|
19
20
|
|
|
20
21
|
// Map, so hot reloading doesn't break things
|
|
21
22
|
let componentButtons = new Map<string, { title: string, callback: (component: ExternalRenderClass) => void }>();
|
|
@@ -24,6 +25,7 @@ export function addComponentButton(config: {
|
|
|
24
25
|
title: string;
|
|
25
26
|
callback: (component: ExternalRenderClass) => void;
|
|
26
27
|
}) {
|
|
28
|
+
if (isDynamicModule(module)) return;
|
|
27
29
|
if (!isHotReloading() && componentButtons.has(config.title)) {
|
|
28
30
|
throw new Error(`Component button with title ${config.title} already exists`);
|
|
29
31
|
}
|