zero-com 1.9.1 → 1.10.2
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/lib/rollup.js +1 -1
- package/lib/runtime.js +7 -3
- package/package.json +1 -1
package/lib/rollup.js
CHANGED
|
@@ -74,7 +74,7 @@ function zeroComRollupPlugin(options = {}) {
|
|
|
74
74
|
var _a;
|
|
75
75
|
if (!isVite)
|
|
76
76
|
return null;
|
|
77
|
-
if (id.includes('node_modules') || !/\.(ts|tsx|js|jsx|mjs)$/.test(id))
|
|
77
|
+
if (id[0] === '\0' || id.includes('node_modules') || !/\.(ts|tsx|js|jsx|mjs)$/.test(id))
|
|
78
78
|
return null;
|
|
79
79
|
// Derive effective target: explicit option takes precedence, otherwise infer from Vite's ssr flag
|
|
80
80
|
const ssr = typeof viteOptions === 'object' && viteOptions !== null && 'ssr' in viteOptions
|
package/lib/runtime.js
CHANGED
|
@@ -8,9 +8,13 @@ exports.func = func;
|
|
|
8
8
|
function getContextStorage() {
|
|
9
9
|
if (!globalThis.ZERO_COM_CONTEXT_STORAGE) {
|
|
10
10
|
try {
|
|
11
|
-
// Dynamic
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// Dynamic require to avoid bundling async_hooks for browser.
|
|
12
|
+
// Falls back to process.getBuiltinModule() for ESM contexts (e.g. Vite SSR)
|
|
13
|
+
// where require() is not available.
|
|
14
|
+
const mod = typeof require === 'function'
|
|
15
|
+
? require('async_hooks')
|
|
16
|
+
: process.getBuiltinModule('node:async_hooks');
|
|
17
|
+
globalThis.ZERO_COM_CONTEXT_STORAGE = new mod.AsyncLocalStorage();
|
|
14
18
|
}
|
|
15
19
|
catch (_a) {
|
|
16
20
|
// Browser environment - context storage not available
|