querysub 0.5.0 → 0.6.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,13 @@ let moduleResolver = async (spec: FunctionSpec) => {
|
|
|
157
157
|
return repoPath;
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
+
let key = "isInNestedImport-302fec38-0443-44f7-b31f-1f514900437f";
|
|
161
|
+
function setInNestedImport(value: boolean) {
|
|
162
|
+
(globalThis as any)[key] = value;
|
|
163
|
+
}
|
|
164
|
+
export function isInNestedImport(): boolean {
|
|
165
|
+
return !!(globalThis as any)[key];
|
|
166
|
+
}
|
|
160
167
|
|
|
161
168
|
async function getModuleFromSpecBase(
|
|
162
169
|
spec: FunctionSpec
|
|
@@ -185,6 +192,7 @@ async function getModuleFromSpecBase(
|
|
|
185
192
|
}
|
|
186
193
|
console.log(blue(`require(${JSON.stringify(path)})`));
|
|
187
194
|
try {
|
|
195
|
+
setInNestedImport(true);
|
|
188
196
|
await SocketFunction.ignoreExposeCalls(async () => {
|
|
189
197
|
// Import deploy, which should always exist, and provides a consistent
|
|
190
198
|
// import order, fixing a lot of cyclic / module level code logic issues.
|
|
@@ -195,8 +203,9 @@ async function getModuleFromSpecBase(
|
|
|
195
203
|
await (require as any)(path, true);
|
|
196
204
|
});
|
|
197
205
|
} catch (e: any) {
|
|
198
|
-
|
|
199
206
|
throw new Error(`Error when loading function for ${JSON.stringify(path)}:${spec.FunctionId}\n${e.stack}`);
|
|
207
|
+
} finally {
|
|
208
|
+
setInNestedImport(false);
|
|
200
209
|
}
|
|
201
210
|
let moduleId = require.resolve(path) || path;
|
|
202
211
|
let module = require.cache[moduleId];
|
|
@@ -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 { isInNestedImport } 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 (isInNestedImport()) return;
|
|
27
29
|
if (!isHotReloading() && componentButtons.has(config.title)) {
|
|
28
30
|
throw new Error(`Component button with title ${config.title} already exists`);
|
|
29
31
|
}
|