windmill-ts 1.4.3 → 1.4.4
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/dist/package.json
CHANGED
|
@@ -29,8 +29,13 @@ const preamble = dedent `
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
let ${envStorageName}: AsyncLocalStorage<Record<string, string | undefined>> | null = null;
|
|
32
|
+
let initPromise: Promise<void> | null = null;
|
|
33
|
+
|
|
34
|
+
const initEnvStorage = () => initPromise ??= (async () => {
|
|
35
|
+
if (typeof process === 'undefined') {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
32
38
|
|
|
33
|
-
if (typeof process !== 'undefined') {
|
|
34
39
|
const { AsyncLocalStorage } = await import('node:async_hooks');
|
|
35
40
|
${envStorageName} = new AsyncLocalStorage();
|
|
36
41
|
|
|
@@ -41,7 +46,7 @@ const preamble = dedent `
|
|
|
41
46
|
if (store != null && prop in store && typeof prop === 'string') {
|
|
42
47
|
return store[prop];
|
|
43
48
|
}
|
|
44
|
-
|
|
49
|
+
|
|
45
50
|
return Reflect.get(target, prop, receiver);
|
|
46
51
|
},
|
|
47
52
|
set: (target, prop, value, receiver) => {
|
|
@@ -52,10 +57,12 @@ const preamble = dedent `
|
|
|
52
57
|
|
|
53
58
|
return Reflect.set(target, prop, value, receiver);
|
|
54
59
|
}
|
|
55
|
-
})
|
|
56
|
-
}
|
|
60
|
+
});
|
|
61
|
+
})();
|
|
57
62
|
|
|
58
63
|
export const runDetached = async <T extends unknown>(cb: () => Promise<T>) => {
|
|
64
|
+
await initEnvStorage();
|
|
65
|
+
|
|
59
66
|
if (${envStorageName} == null) {
|
|
60
67
|
console.warn("Calling \`runDetached\` in a non-Node environment is unsupported.");
|
|
61
68
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preamble.js","sourceRoot":"","sources":["../../../src/generator/preamble.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAE3C,MAAM,QAAQ,GAAG,MAAM,CAAA;;;;;IAKnB;AACA;;qEAEqE,CAAC,EACxE;;;;;;;;;;;;;;;;;;;QAmBM,cAAc
|
|
1
|
+
{"version":3,"file":"preamble.js","sourceRoot":"","sources":["../../../src/generator/preamble.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAE3C,MAAM,QAAQ,GAAG,MAAM,CAAA;;;;;IAKnB;AACA;;qEAEqE,CAAC,EACxE;;;;;;;;;;;;;;;;;;;QAmBM,cAAc;;;;;;;;;MAShB,cAAc;;;;;wBAKI,cAAc;;;;;;;;;;;;;;;;;;;;;UAqB5B,cAAc;;;;;;aAMX,cAAc;;;;;CAK1B,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,EAAG,CAAC;IAEhC,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC,CAAC"}
|