querysub 0.6.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,12 +157,10 @@ let moduleResolver = async (spec: FunctionSpec) => {
|
|
|
157
157
|
return repoPath;
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
export function isInNestedImport(): boolean {
|
|
165
|
-
return !!(globalThis as any)[key];
|
|
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");
|
|
166
164
|
}
|
|
167
165
|
|
|
168
166
|
async function getModuleFromSpecBase(
|
|
@@ -192,7 +190,6 @@ async function getModuleFromSpecBase(
|
|
|
192
190
|
}
|
|
193
191
|
console.log(blue(`require(${JSON.stringify(path)})`));
|
|
194
192
|
try {
|
|
195
|
-
setInNestedImport(true);
|
|
196
193
|
await SocketFunction.ignoreExposeCalls(async () => {
|
|
197
194
|
// Import deploy, which should always exist, and provides a consistent
|
|
198
195
|
// import order, fixing a lot of cyclic / module level code logic issues.
|
|
@@ -204,8 +201,6 @@ async function getModuleFromSpecBase(
|
|
|
204
201
|
});
|
|
205
202
|
} catch (e: any) {
|
|
206
203
|
throw new Error(`Error when loading function for ${JSON.stringify(path)}:${spec.FunctionId}\n${e.stack}`);
|
|
207
|
-
} finally {
|
|
208
|
-
setInNestedImport(false);
|
|
209
204
|
}
|
|
210
205
|
let moduleId = require.resolve(path) || path;
|
|
211
206
|
let module = require.cache[moduleId];
|
|
@@ -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,7 +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 {
|
|
19
|
+
import { isDynamicModule } from "../3-path-functions/pathFunctionLoader";
|
|
20
20
|
|
|
21
21
|
// Map, so hot reloading doesn't break things
|
|
22
22
|
let componentButtons = new Map<string, { title: string, callback: (component: ExternalRenderClass) => void }>();
|
|
@@ -25,7 +25,7 @@ export function addComponentButton(config: {
|
|
|
25
25
|
title: string;
|
|
26
26
|
callback: (component: ExternalRenderClass) => void;
|
|
27
27
|
}) {
|
|
28
|
-
if (
|
|
28
|
+
if (isDynamicModule(module)) return;
|
|
29
29
|
if (!isHotReloading() && componentButtons.has(config.title)) {
|
|
30
30
|
throw new Error(`Component button with title ${config.title} already exists`);
|
|
31
31
|
}
|