@ricsam/isolate 0.1.4 → 0.1.6

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.
Files changed (80) hide show
  1. package/README.md +45 -2
  2. package/dist/cjs/internal/async-context/index.cjs +401 -0
  3. package/dist/cjs/internal/async-context/index.cjs.map +10 -0
  4. package/dist/cjs/internal/client/connection.cjs +175 -123
  5. package/dist/cjs/internal/client/connection.cjs.map +3 -3
  6. package/dist/cjs/internal/console/index.cjs +2 -2
  7. package/dist/cjs/internal/console/index.cjs.map +2 -2
  8. package/dist/cjs/internal/core/index.cjs +22 -6
  9. package/dist/cjs/internal/core/index.cjs.map +3 -3
  10. package/dist/cjs/internal/crypto/index.cjs +2 -2
  11. package/dist/cjs/internal/crypto/index.cjs.map +2 -2
  12. package/dist/cjs/internal/daemon/connection.cjs +77 -12
  13. package/dist/cjs/internal/daemon/connection.cjs.map +3 -3
  14. package/dist/cjs/internal/encoding/index.cjs.map +1 -1
  15. package/dist/cjs/internal/fetch/index.cjs +119 -18
  16. package/dist/cjs/internal/fetch/index.cjs.map +3 -3
  17. package/dist/cjs/internal/fetch/stream-state.cjs.map +1 -1
  18. package/dist/cjs/internal/fs/index.cjs +2 -2
  19. package/dist/cjs/internal/fs/index.cjs.map +2 -2
  20. package/dist/cjs/internal/module-loader/bundle.cjs +277 -1
  21. package/dist/cjs/internal/module-loader/bundle.cjs.map +3 -3
  22. package/dist/cjs/internal/path/index.cjs.map +1 -1
  23. package/dist/cjs/internal/playwright/index.cjs +2 -2
  24. package/dist/cjs/internal/playwright/index.cjs.map +2 -2
  25. package/dist/cjs/internal/runtime/index.cjs +78 -6
  26. package/dist/cjs/internal/runtime/index.cjs.map +3 -3
  27. package/dist/cjs/internal/test-environment/index.cjs +2 -2
  28. package/dist/cjs/internal/test-environment/index.cjs.map +2 -2
  29. package/dist/cjs/internal/timers/index.cjs +42 -7
  30. package/dist/cjs/internal/timers/index.cjs.map +3 -3
  31. package/dist/cjs/internal/typecheck/isolate-types.cjs +36 -1
  32. package/dist/cjs/internal/typecheck/isolate-types.cjs.map +3 -3
  33. package/dist/cjs/package.json +1 -1
  34. package/dist/mjs/internal/async-context/index.mjs +361 -0
  35. package/dist/mjs/internal/async-context/index.mjs.map +10 -0
  36. package/dist/mjs/internal/client/connection.mjs +176 -123
  37. package/dist/mjs/internal/client/connection.mjs.map +3 -3
  38. package/dist/mjs/internal/console/index.mjs +2 -2
  39. package/dist/mjs/internal/console/index.mjs.map +2 -2
  40. package/dist/mjs/internal/core/index.mjs +22 -6
  41. package/dist/mjs/internal/core/index.mjs.map +3 -3
  42. package/dist/mjs/internal/crypto/index.mjs +2 -2
  43. package/dist/mjs/internal/crypto/index.mjs.map +2 -2
  44. package/dist/mjs/internal/daemon/connection.mjs +77 -12
  45. package/dist/mjs/internal/daemon/connection.mjs.map +3 -3
  46. package/dist/mjs/internal/encoding/index.mjs.map +1 -1
  47. package/dist/mjs/internal/fetch/index.mjs +119 -18
  48. package/dist/mjs/internal/fetch/index.mjs.map +3 -3
  49. package/dist/mjs/internal/fetch/stream-state.mjs.map +1 -1
  50. package/dist/mjs/internal/fs/index.mjs +2 -2
  51. package/dist/mjs/internal/fs/index.mjs.map +2 -2
  52. package/dist/mjs/internal/module-loader/bundle.mjs +277 -1
  53. package/dist/mjs/internal/module-loader/bundle.mjs.map +3 -3
  54. package/dist/mjs/internal/path/index.mjs.map +1 -1
  55. package/dist/mjs/internal/playwright/index.mjs +2 -2
  56. package/dist/mjs/internal/playwright/index.mjs.map +2 -2
  57. package/dist/mjs/internal/runtime/index.mjs +78 -6
  58. package/dist/mjs/internal/runtime/index.mjs.map +3 -3
  59. package/dist/mjs/internal/test-environment/index.mjs +2 -2
  60. package/dist/mjs/internal/test-environment/index.mjs.map +2 -2
  61. package/dist/mjs/internal/timers/index.mjs +42 -7
  62. package/dist/mjs/internal/timers/index.mjs.map +3 -3
  63. package/dist/mjs/internal/typecheck/isolate-types.mjs +36 -1
  64. package/dist/mjs/internal/typecheck/isolate-types.mjs.map +3 -3
  65. package/dist/mjs/package.json +1 -1
  66. package/dist/types/internal/async-context/index.d.ts +5 -0
  67. package/dist/types/internal/console/index.d.ts +1 -1
  68. package/dist/types/internal/core/index.d.ts +2 -2
  69. package/dist/types/internal/crypto/index.d.ts +1 -1
  70. package/dist/types/internal/daemon/types.d.ts +1 -0
  71. package/dist/types/internal/encoding/index.d.ts +1 -1
  72. package/dist/types/internal/fetch/index.d.ts +1 -1
  73. package/dist/types/internal/fetch/stream-state.d.ts +1 -1
  74. package/dist/types/internal/fs/index.d.ts +1 -1
  75. package/dist/types/internal/path/index.d.ts +1 -1
  76. package/dist/types/internal/playwright/index.d.ts +1 -1
  77. package/dist/types/internal/test-environment/index.d.ts +1 -1
  78. package/dist/types/internal/timers/index.d.ts +1 -1
  79. package/dist/types/internal/typecheck/isolate-types.d.ts +2 -2
  80. package/package.json +8 -3
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/internal/module-loader/bundle.ts"],
4
4
  "sourcesContent": [
5
- "import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { builtinModules, createRequire } from \"node:module\";\nimport { rollup, type Plugin } from \"rollup\";\nimport * as nodeResolveModule from \"@rollup/plugin-node-resolve\";\nimport * as commonjsModule from \"@rollup/plugin-commonjs\";\nimport * as jsonModule from \"@rollup/plugin-json\";\nimport * as replaceModule from \"@rollup/plugin-replace\";\nimport { detectFormat, parseSpecifier } from \"./resolve.mjs\";\nimport { processTypeScript, isTypeScriptFile } from \"./strip-types.mjs\";\nimport type { RollupCommonJSOptions } from \"@rollup/plugin-commonjs\";\nimport type { RollupJsonOptions } from \"@rollup/plugin-json\";\nimport type { RollupReplaceOptions } from \"@rollup/plugin-replace\";\n\n// Handle CJS default exports\nconst nodeResolve = ((nodeResolveModule as any).default ||\n nodeResolveModule) as (typeof nodeResolveModule)[\"nodeResolve\"];\nconst commonjs = ((commonjsModule as any).default || commonjsModule) as (\n options?: RollupCommonJSOptions\n) => Plugin;\nconst json = ((jsonModule as any).default || jsonModule) as (\n options?: RollupJsonOptions\n) => Plugin;\nconst replace = ((replaceModule as any).default || replaceModule) as (\n options?: RollupReplaceOptions\n) => Plugin;\n\nconst commonjsInteropOptions = {\n // External package imports are resolved by later loader calls as ESM bundles,\n // so CommonJS requires need ESM-aware interop instead of default-import assumptions.\n esmExternals: true,\n requireReturnsDefault: \"auto\",\n} satisfies RollupCommonJSOptions;\n\nconst PACKAGE_ENTRY_WRAPPER_PREFIX = \"\\0package-entry-wrapper:\";\nconst INVALID_FUNCTION_EXPORT_NAMES = new Set([\n \"arguments\",\n \"caller\",\n \"length\",\n \"name\",\n \"prototype\",\n]);\n\n/**\n * Set of Node.js built-in module names (e.g. \"fs\", \"path\", \"crypto\").\n */\nconst nodeBuiltins = new Set(builtinModules);\n\n/**\n * Check if a specifier refers to a Node.js built-in module.\n * Handles bare names (\"fs\"), subpaths (\"fs/promises\"), and node: prefix (\"node:fs\").\n */\nfunction isNodeBuiltin(source: string): boolean {\n const name = source.startsWith(\"node:\") ? source.slice(5) : source;\n const topLevel = name.split(\"/\")[0]!;\n return nodeBuiltins.has(topLevel);\n}\n\nconst NODE_BUILTIN_SHIM_PREFIX = \"\\0node-builtin-shim:\";\n\nexport function getNodeBuiltinShimCode(source: string): string {\n if (source === \"ws\" || source === \"node:ws\") {\n return `\nconst WebSocketShim = globalThis.WebSocket;\n\nif (!WebSocketShim) {\n throw new Error(\"The isolate runtime does not provide a global WebSocket implementation.\");\n}\n\nexport { WebSocketShim as WebSocket };\nexport default WebSocketShim;\n`;\n }\n\n return \"export default {};\\n\";\n}\n\n/**\n * Rollup plugin that provides empty shims for Node.js built-in modules.\n * Place after nodeResolve — acts as a catch-all for builtins that the\n * package's browser field didn't map to false.\n */\nfunction shimNodeBuiltinsPlugin(): Plugin {\n return {\n name: \"shim-node-builtins\",\n resolveId(source) {\n if (isNodeBuiltin(source)) {\n return { id: `${NODE_BUILTIN_SHIM_PREFIX}${source}`, moduleSideEffects: false };\n }\n return null;\n },\n load(id) {\n if (id.startsWith(NODE_BUILTIN_SHIM_PREFIX)) {\n return getNodeBuiltinShimCode(id.slice(NODE_BUILTIN_SHIM_PREFIX.length));\n }\n return null;\n },\n };\n}\n\nfunction isValidEsmIdentifier(name: string): boolean {\n return /^[$A-Z_a-z][$\\w]*$/.test(name);\n}\n\nfunction resolvePackageImportPath(specifier: string, rootDir: string): string | null {\n const resolver = createRequire(path.join(rootDir, \"__isolate_module_loader__.js\"));\n\n let resolvedRequirePath: string;\n try {\n resolvedRequirePath = resolver.resolve(specifier);\n } catch {\n return null;\n }\n\n const { packageName, subpath } = parseSpecifier(specifier);\n const packageJsonPath = findPackageJsonPath(resolvedRequirePath, packageName);\n if (!packageJsonPath) {\n return resolvedRequirePath;\n }\n\n let packageJson: Record<string, unknown>;\n try {\n packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\")) as Record<string, unknown>;\n } catch {\n return resolvedRequirePath;\n }\n\n const packageRoot = path.dirname(packageJsonPath);\n const exportPath = resolveImportEntryFromPackageJson(packageJson, subpath);\n\n if (exportPath) {\n return path.resolve(packageRoot, exportPath);\n }\n\n if (!subpath) {\n const moduleEntry = packageJson.module;\n if (typeof moduleEntry === \"string\") {\n return path.resolve(packageRoot, moduleEntry);\n }\n\n const browserEntry = packageJson.browser;\n if (typeof browserEntry === \"string\") {\n return path.resolve(packageRoot, browserEntry);\n }\n }\n\n return resolvedRequirePath;\n}\n\nfunction findPackageJsonPath(resolvedPath: string, packageName: string): string | null {\n let currentDir = path.dirname(resolvedPath);\n let matchedPackageJsonPath: string | null = null;\n\n while (true) {\n const packageJsonPath = path.join(currentDir, \"package.json\");\n\n if (fs.existsSync(packageJsonPath)) {\n try {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\")) as { name?: string };\n if (packageJson.name === packageName) {\n // Keep walking upward: published packages often include nested\n // dist/cjs or dist/mjs package.json files with the same name, but the\n // real package root higher up contains the export map we need.\n matchedPackageJsonPath = packageJsonPath;\n }\n } catch {\n // Keep walking upward if a parent package.json is malformed.\n }\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n return matchedPackageJsonPath;\n }\n currentDir = parentDir;\n }\n}\n\nfunction resolveImportEntryFromPackageJson(\n packageJson: Record<string, unknown>,\n subpath: string\n): string | null {\n const exportsField = packageJson.exports;\n if (exportsField === undefined) {\n return null;\n }\n\n const exportKey = subpath ? `.${subpath}` : \".\";\n\n if (isConditionalExportsObject(exportsField)) {\n if (exportKey !== \".\") {\n return null;\n }\n return pickImportTarget(exportsField);\n }\n\n if (typeof exportsField === \"object\" && exportsField !== null && !Array.isArray(exportsField)) {\n const exportsRecord = exportsField as Record<string, unknown>;\n const directTarget = exportsRecord[exportKey];\n if (directTarget !== undefined) {\n return pickImportTarget(directTarget);\n }\n\n for (const [pattern, target] of Object.entries(exportsRecord)) {\n if (!pattern.includes(\"*\")) {\n continue;\n }\n\n const starIndex = pattern.indexOf(\"*\");\n const prefix = pattern.slice(0, starIndex);\n const suffix = pattern.slice(starIndex + 1);\n\n if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) {\n continue;\n }\n\n const wildcardMatch = exportKey.slice(\n prefix.length,\n suffix.length > 0 ? -suffix.length : undefined,\n );\n\n return pickImportTarget(target, wildcardMatch);\n }\n\n return null;\n }\n\n return exportKey === \".\" ? pickImportTarget(exportsField) : null;\n}\n\nfunction isConditionalExportsObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\"\n && value !== null\n && !Array.isArray(value)\n && Object.keys(value).every((key) => !key.startsWith(\".\"));\n}\n\nfunction pickImportTarget(value: unknown, wildcardMatch?: string): string | null {\n if (typeof value === \"string\") {\n return wildcardMatch === undefined ? value : value.replaceAll(\"*\", wildcardMatch);\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n const target = pickImportTarget(item, wildcardMatch);\n if (target) {\n return target;\n }\n }\n return null;\n }\n\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const record = value as Record<string, unknown>;\n\n for (const key of [\"workerd\", \"worker\", \"edge-light\", \"import\", \"module\", \"default\", \"browser\"]) {\n if (key in record) {\n const target = pickImportTarget(record[key], wildcardMatch);\n if (target) {\n return target;\n }\n }\n }\n\n for (const nestedValue of Object.values(record)) {\n const target = pickImportTarget(nestedValue, wildcardMatch);\n if (target) {\n return target;\n }\n }\n\n return null;\n}\n\nfunction getCommonJsNamedExports(specifier: string, rootDir: string): string[] {\n const resolvedHostPath = resolvePackageImportPath(specifier, rootDir);\n if (!resolvedHostPath) {\n return [];\n }\n\n let code: string;\n try {\n code = fs.readFileSync(resolvedHostPath, \"utf-8\");\n } catch {\n return [];\n }\n\n if (detectFormat(resolvedHostPath, code) !== \"cjs\") {\n return [];\n }\n\n let moduleExports: unknown;\n try {\n moduleExports = createRequire(resolvedHostPath)(resolvedHostPath);\n } catch {\n return [];\n }\n\n if (moduleExports == null || (typeof moduleExports !== \"object\" && typeof moduleExports !== \"function\")) {\n return [];\n }\n\n const names = new Set([\n ...Object.keys(moduleExports),\n ...Object.getOwnPropertyNames(moduleExports),\n ]);\n\n names.delete(\"default\");\n names.delete(\"__esModule\");\n\n if (typeof moduleExports === \"function\") {\n for (const name of INVALID_FUNCTION_EXPORT_NAMES) {\n names.delete(name);\n }\n }\n\n return [...names].filter(isValidEsmIdentifier).sort();\n}\n\nfunction packageEntryWrapperPlugin(specifier: string, namedExports: string[]): Plugin {\n const wrapperId = `${PACKAGE_ENTRY_WRAPPER_PREFIX}${specifier}`;\n\n return {\n name: \"package-entry-wrapper\",\n resolveId(source) {\n if (source === wrapperId) {\n return wrapperId;\n }\n return null;\n },\n load(id) {\n if (id !== wrapperId) {\n return null;\n }\n\n const namedExportLines = namedExports.map(\n (name) => `export const ${name} = __packageDefault.${name};`\n );\n\n return [\n `import __packageDefault from ${JSON.stringify(specifier)};`,\n \"export default __packageDefault;\",\n ...namedExportLines,\n ].join(\"\\n\");\n },\n };\n}\n\n/**\n * Cache for bundled npm packages. Key includes specifier + resolution root.\n */\nconst bundleCache = new Map<string, { code: string }>();\n\n/**\n * In-flight bundle promises to avoid duplicate concurrent bundles.\n */\nconst bundlesInFlight = new Map<string, Promise<{ code: string }>>();\n\n/**\n * Create a Rollup plugin that externalizes all bare specifiers that don't\n * belong to the current package. Internal files of the package are inlined;\n * other npm packages remain as import statements.\n */\nfunction externalizeDepsPlugin(currentPackageName: string): Plugin {\n return {\n name: \"externalize-deps\",\n resolveId(source, importer) {\n // Don't externalize the entry point\n if (!importer) return null;\n\n // Don't externalize relative imports (internal to the package)\n if (source.startsWith(\".\") || source.startsWith(\"/\")) return null;\n\n // Keep package-private imports inside the current bundle so Rollup can\n // resolve them through the importing package's `imports` map.\n if (source.startsWith(\"#\")) return null;\n\n // Don't externalize Node.js builtins — let nodeResolve handle them\n // via the package's browser field (e.g. \"fs\": false → empty module)\n if (isNodeBuiltin(source)) return null;\n\n // Check if this is a different npm package\n const { packageName } = parseSpecifier(source);\n if (packageName !== currentPackageName) {\n return { id: source, external: true };\n }\n\n // Same package — let Rollup resolve it normally\n return null;\n },\n };\n}\n\n/**\n * Bundle a bare specifier (npm package) using Rollup.\n *\n * Each unique bare specifier gets its own bundle with:\n * - node-resolve with worker/server-safe export conditions\n * - commonjs conversion\n * - json support\n * - process.env.NODE_ENV replacement\n * - External deps (other npm packages) left as import statements\n *\n * Results are cached permanently (npm packages are static).\n */\nexport async function bundleSpecifier(\n specifier: string,\n rootDir: string\n): Promise<{ code: string }> {\n const cacheKey = `${specifier}\\0${rootDir}`;\n\n // Check cache\n const cached = bundleCache.get(cacheKey);\n if (cached) return cached;\n\n // Check in-flight\n const inFlight = bundlesInFlight.get(cacheKey);\n if (inFlight) return inFlight;\n\n const promise = doBundleSpecifier(specifier, rootDir);\n bundlesInFlight.set(cacheKey, promise);\n\n try {\n const result = await promise;\n bundleCache.set(cacheKey, result);\n return result;\n } finally {\n bundlesInFlight.delete(cacheKey);\n }\n}\n\nasync function doBundleSpecifier(\n specifier: string,\n rootDir: string\n): Promise<{ code: string }> {\n const { packageName } = parseSpecifier(specifier);\n const namedExports = getCommonJsNamedExports(specifier, rootDir);\n const input = namedExports.length > 0\n ? `${PACKAGE_ENTRY_WRAPPER_PREFIX}${specifier}`\n : specifier;\n\n const bundle = await rollup({\n input,\n // Disable tree-shaking: we're creating a virtual module that must faithfully\n // expose all package exports. We can't predict which ones user code will import.\n // Without this, exports like AWS SDK's ConverseStreamOutput (a namespace with\n // a visit() helper that nothing inside the bundle references) get dropped.\n treeshake: false,\n plugins: [\n packageEntryWrapperPlugin(specifier, namedExports),\n externalizeDepsPlugin(packageName),\n nodeResolve({\n rootDir,\n browser: false,\n exportConditions: [\"workerd\", \"worker\", \"edge-light\"],\n }),\n shimNodeBuiltinsPlugin(),\n commonjs(commonjsInteropOptions),\n json(),\n replace({\n preventAssignment: true,\n values: { \"process.env.NODE_ENV\": JSON.stringify(\"development\") },\n }),\n ],\n onwarn: (warning, warn) => {\n if (warning.code === \"CIRCULAR_DEPENDENCY\") return;\n if (warning.code === \"THIS_IS_UNDEFINED\") return;\n if (warning.code === \"UNUSED_EXTERNAL_IMPORT\") return;\n if (warning.code === \"EMPTY_BUNDLE\") return;\n // Suppress warnings about named imports from shimmed Node.js builtins\n if (warning.code === \"MISSING_EXPORT\" && warning.exporter?.startsWith(NODE_BUILTIN_SHIM_PREFIX)) return;\n warn(warning);\n },\n });\n\n const { output } = await bundle.generate({\n format: \"es\",\n sourcemap: \"inline\",\n inlineDynamicImports: true,\n });\n await bundle.close();\n\n const code = output[0]!.code;\n return { code };\n}\n\n/**\n * Create a Rollup plugin that externalizes ALL bare specifiers.\n * Used for module aliases where the host file's relative imports are bundled\n * but npm package dependencies are left as external imports.\n */\nfunction externalizeAllBareSpecifiersPlugin(): Plugin {\n return {\n name: \"externalize-all-bare-specifiers\",\n resolveId(source, importer) {\n if (!importer) return null;\n if (source.startsWith(\".\") || source.startsWith(\"/\")) return null;\n if (source.startsWith(\"#\")) return null;\n // Don't externalize Node.js builtins — let nodeResolve/shim handle them\n if (isNodeBuiltin(source)) return null;\n return { id: source, external: true };\n },\n };\n}\n\n/**\n * Create a Rollup transform plugin that strips TypeScript types.\n */\nfunction stripTypeScriptPlugin(): Plugin {\n return {\n name: \"strip-typescript\",\n transform(code, id) {\n if (isTypeScriptFile(id)) {\n return { code: processTypeScript(code, id), map: null };\n }\n return null;\n },\n };\n}\n\nconst TS_EXTENSIONS = [\".ts\", \".tsx\", \".mts\", \".cts\"];\n\n/**\n * Bundle a host file using Rollup, inlining its relative imports.\n *\n * - Uses the host file path as Rollup input\n * - Externalizes ALL bare specifiers (npm packages)\n * - Strips TypeScript via processTypeScript\n * - Shares the bundleCache/bundlesInFlight (no key collision since file paths start with `/`)\n *\n * Results are cached permanently.\n */\nexport async function bundleHostFile(\n hostFilePath: string,\n): Promise<{ code: string }> {\n const cached = bundleCache.get(hostFilePath);\n if (cached) return cached;\n\n const inFlight = bundlesInFlight.get(hostFilePath);\n if (inFlight) return inFlight;\n\n const promise = doBundleHostFile(hostFilePath);\n bundlesInFlight.set(hostFilePath, promise);\n\n try {\n const result = await promise;\n bundleCache.set(hostFilePath, result);\n return result;\n } finally {\n bundlesInFlight.delete(hostFilePath);\n }\n}\n\nasync function doBundleHostFile(\n hostFilePath: string,\n): Promise<{ code: string }> {\n const rootDir = path.dirname(hostFilePath);\n\n const bundle = await rollup({\n input: hostFilePath,\n treeshake: false,\n plugins: [\n externalizeAllBareSpecifiersPlugin(),\n stripTypeScriptPlugin(),\n nodeResolve({\n rootDir,\n browser: false,\n exportConditions: [\"workerd\", \"worker\", \"edge-light\"],\n extensions: [\".mjs\", \".js\", \".json\", \".node\", ...TS_EXTENSIONS],\n }),\n shimNodeBuiltinsPlugin(),\n commonjs(commonjsInteropOptions),\n json(),\n replace({\n preventAssignment: true,\n values: { \"process.env.NODE_ENV\": JSON.stringify(\"development\") },\n }),\n ],\n onwarn: (warning, warn) => {\n if (warning.code === \"CIRCULAR_DEPENDENCY\") return;\n if (warning.code === \"THIS_IS_UNDEFINED\") return;\n if (warning.code === \"UNUSED_EXTERNAL_IMPORT\") return;\n if (warning.code === \"EMPTY_BUNDLE\") return;\n // Suppress warnings about named imports from shimmed Node.js builtins\n if (warning.code === \"MISSING_EXPORT\" && warning.exporter?.startsWith(NODE_BUILTIN_SHIM_PREFIX)) return;\n warn(warning);\n },\n });\n\n const { output } = await bundle.generate({\n format: \"es\",\n sourcemap: \"inline\",\n inlineDynamicImports: true,\n });\n await bundle.close();\n\n const code = output[0]!.code;\n return { code };\n}\n\n/**\n * Clear the bundle cache. Useful for testing.\n */\nexport function clearBundleCache(): void {\n bundleCache.clear();\n}\n"
5
+ "import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { asyncWrapProviders as hostAsyncWrapProviders } from \"node:async_hooks\";\nimport { builtinModules, createRequire } from \"node:module\";\nimport { rollup, type Plugin } from \"rollup\";\nimport * as nodeResolveModule from \"@rollup/plugin-node-resolve\";\nimport * as commonjsModule from \"@rollup/plugin-commonjs\";\nimport * as jsonModule from \"@rollup/plugin-json\";\nimport * as replaceModule from \"@rollup/plugin-replace\";\nimport { detectFormat, parseSpecifier } from \"./resolve.mjs\";\nimport { processTypeScript, isTypeScriptFile } from \"./strip-types.mjs\";\nimport type { RollupCommonJSOptions } from \"@rollup/plugin-commonjs\";\nimport type { RollupJsonOptions } from \"@rollup/plugin-json\";\nimport type { RollupReplaceOptions } from \"@rollup/plugin-replace\";\n\n// Handle CJS default exports\nconst nodeResolve = ((nodeResolveModule as any).default ||\n nodeResolveModule) as (typeof nodeResolveModule)[\"nodeResolve\"];\nconst commonjs = ((commonjsModule as any).default || commonjsModule) as (\n options?: RollupCommonJSOptions\n) => Plugin;\nconst json = ((jsonModule as any).default || jsonModule) as (\n options?: RollupJsonOptions\n) => Plugin;\nconst replace = ((replaceModule as any).default || replaceModule) as (\n options?: RollupReplaceOptions\n) => Plugin;\n\nconst commonjsInteropOptions = {\n // External package imports are resolved by later loader calls as ESM bundles,\n // so CommonJS requires need ESM-aware interop instead of default-import assumptions.\n esmExternals: true,\n requireReturnsDefault: \"auto\",\n} satisfies RollupCommonJSOptions;\n\nconst PACKAGE_ENTRY_WRAPPER_PREFIX = \"\\0package-entry-wrapper:\";\nconst INVALID_FUNCTION_EXPORT_NAMES = new Set([\n \"arguments\",\n \"caller\",\n \"length\",\n \"name\",\n \"prototype\",\n]);\n\n/**\n * Set of Node.js built-in module names (e.g. \"fs\", \"path\", \"crypto\").\n */\nconst nodeBuiltins = new Set(builtinModules);\n\n/**\n * Check if a specifier refers to a Node.js built-in module.\n * Handles bare names (\"fs\"), subpaths (\"fs/promises\"), and node: prefix (\"node:fs\").\n */\nfunction isNodeBuiltin(source: string): boolean {\n const name = source.startsWith(\"node:\") ? source.slice(5) : source;\n const topLevel = name.split(\"/\")[0]!;\n return nodeBuiltins.has(topLevel);\n}\n\nconst NODE_BUILTIN_SHIM_PREFIX = \"\\0node-builtin-shim:\";\nconst HOST_ASYNC_WRAP_PROVIDERS_JSON = JSON.stringify(hostAsyncWrapProviders);\n\nexport function getNodeBuiltinShimCode(source: string): string {\n if (source === \"ws\" || source === \"node:ws\") {\n return `\nconst WebSocketShim = globalThis.WebSocket;\n\nif (!WebSocketShim) {\n throw new Error(\"The isolate runtime does not provide a global WebSocket implementation.\");\n}\n\nexport { WebSocketShim as WebSocket };\nexport default WebSocketShim;\n`;\n }\n\n if (source === \"async_hooks\" || source === \"node:async_hooks\") {\n return `\nconst AsyncContextShim = globalThis.AsyncContext;\nconst asyncInternals = globalThis.__isolateAsyncContextInternals;\n\nif (\n !AsyncContextShim\n || !asyncInternals?.AsyncContextFrame\n || typeof asyncInternals.createResource !== \"function\"\n || typeof asyncInternals.runWithResource !== \"function\"\n || typeof asyncInternals.destroyResource !== \"function\"\n || typeof asyncInternals.enableHook !== \"function\"\n || typeof asyncInternals.disableHook !== \"function\"\n) {\n throw new Error(\n \"node:async_hooks requires AsyncContext support in the isolate engine.\"\n );\n}\n\nconst { AsyncContextFrame } = asyncInternals;\nconst NO_STORE = Symbol(\"AsyncLocalStorage.noStore\");\nconst asyncWrapProviders = Object.assign(\n Object.create(null),\n ${HOST_ASYNC_WRAP_PROVIDERS_JSON},\n);\n\nfunction validateHookCallback(name, value) {\n if (value !== undefined && typeof value !== \"function\") {\n throw new TypeError(\"hook.\" + name + \" must be a function\");\n }\n}\n\nclass AsyncHook {\n #callbacks;\n #enabled;\n\n constructor(callbacks) {\n this.#callbacks = callbacks;\n this.#enabled = false;\n }\n\n enable() {\n if (!this.#enabled) {\n this.#enabled = true;\n asyncInternals.enableHook(this, this.#callbacks);\n }\n return this;\n }\n\n disable() {\n if (this.#enabled) {\n this.#enabled = false;\n asyncInternals.disableHook(this);\n }\n return this;\n }\n}\n\nfunction createHook(callbacks) {\n const { init, before, after, destroy, promiseResolve } = callbacks;\n\n validateHookCallback(\"init\", init);\n validateHookCallback(\"before\", before);\n validateHookCallback(\"after\", after);\n validateHookCallback(\"destroy\", destroy);\n validateHookCallback(\"promiseResolve\", promiseResolve);\n\n return new AsyncHook({\n init,\n before,\n after,\n destroy,\n promiseResolve,\n });\n}\n\nfunction executionAsyncId() {\n return asyncInternals.executionAsyncId();\n}\n\nfunction triggerAsyncId() {\n return asyncInternals.triggerAsyncId();\n}\n\nfunction executionAsyncResource() {\n return asyncInternals.executionAsyncResource();\n}\n\nclass AsyncResource {\n #snapshot;\n #resourceState;\n\n constructor(type, options = {}) {\n const normalizedOptions =\n options && typeof options === \"object\" ? options : {};\n\n this.#snapshot = new AsyncContextShim.Snapshot();\n this.#resourceState = asyncInternals.createResource(\n String(type),\n this,\n {\n triggerAsyncId: normalizedOptions.triggerAsyncId,\n },\n );\n }\n\n runInAsyncScope(fn, thisArg, ...args) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"AsyncResource.runInAsyncScope requires a function\");\n }\n return this.#snapshot.run(\n () => asyncInternals.runWithResource(\n this.#resourceState,\n fn,\n thisArg,\n args,\n ),\n );\n }\n\n bind(fn, thisArg) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"AsyncResource.bind requires a function\");\n }\n const resource = this;\n return function bound(...args) {\n return resource.runInAsyncScope(\n fn,\n thisArg === undefined ? this : thisArg,\n ...args,\n );\n };\n }\n\n emitDestroy() {\n if (!asyncInternals.destroyResource(this.#resourceState)) {\n throw new Error(\"AsyncResource.emitDestroy() must only be called once\");\n }\n return this;\n }\n\n asyncId() {\n return this.#resourceState.asyncId;\n }\n\n triggerAsyncId() {\n return this.#resourceState.triggerAsyncId;\n }\n\n static bind(fn, type, thisArg) {\n return new AsyncResource(type).bind(fn, thisArg);\n }\n}\n\nclass AsyncLocalStorage {\n #variable;\n #defaultValue;\n #token;\n #disabled;\n\n constructor(options = {}) {\n const normalizedOptions =\n options && typeof options === \"object\" ? options : {};\n\n this.#defaultValue = normalizedOptions.defaultValue;\n this.#token = Symbol(\"AsyncLocalStorage.token\");\n this.#disabled = false;\n this.#variable = new AsyncContextShim.Variable({\n defaultValue: NO_STORE,\n name: normalizedOptions.name,\n });\n }\n\n get name() {\n return this.#variable.name;\n }\n\n disable() {\n this.#token = Symbol(\"AsyncLocalStorage.token\");\n this.#disabled = true;\n AsyncContextFrame.disable(this.#variable);\n }\n\n enterWith(store) {\n this.#disabled = false;\n AsyncContextFrame.set(\n new AsyncContextFrame(this.#variable, {\n token: this.#token,\n hasValue: true,\n store,\n }),\n );\n }\n\n run(store, callback, ...args) {\n if (typeof callback !== \"function\") {\n throw new TypeError(\"AsyncLocalStorage.run requires a function\");\n }\n this.#disabled = false;\n return this.#variable.run(\n {\n token: this.#token,\n hasValue: true,\n store,\n },\n callback,\n ...args,\n );\n }\n\n exit(callback, ...args) {\n if (typeof callback !== \"function\") {\n throw new TypeError(\"AsyncLocalStorage.exit requires a function\");\n }\n return this.#variable.run(\n {\n token: this.#token,\n hasValue: false,\n store: undefined,\n },\n callback,\n ...args,\n );\n }\n\n getStore() {\n const entry = this.#variable.get();\n if (entry === NO_STORE) {\n return this.#disabled ? undefined : this.#defaultValue;\n }\n if (!entry || entry.token !== this.#token) {\n return undefined;\n }\n if (!entry.hasValue) {\n return undefined;\n }\n return entry.store;\n }\n\n static bind(fn) {\n return AsyncResource.bind(fn, \"AsyncLocalStorage.bind\");\n }\n\n static snapshot() {\n const snapshot = new AsyncContextShim.Snapshot();\n return function runInAsyncScope(fn, ...args) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"AsyncLocalStorage.snapshot requires a function\");\n }\n return snapshot.run(fn, ...args);\n };\n }\n}\n\nexport {\n AsyncLocalStorage,\n AsyncResource,\n asyncWrapProviders,\n createHook,\n executionAsyncId,\n executionAsyncResource,\n triggerAsyncId,\n};\nexport default {\n AsyncLocalStorage,\n AsyncResource,\n asyncWrapProviders,\n createHook,\n executionAsyncId,\n executionAsyncResource,\n triggerAsyncId,\n};\n`;\n }\n\n return \"export default {};\\n\";\n}\n\n/**\n * Rollup plugin that provides empty shims for Node.js built-in modules.\n * Place after nodeResolve — acts as a catch-all for builtins that the\n * package's browser field didn't map to false.\n */\nfunction shimNodeBuiltinsPlugin(): Plugin {\n return {\n name: \"shim-node-builtins\",\n resolveId(source) {\n if (isNodeBuiltin(source)) {\n return { id: `${NODE_BUILTIN_SHIM_PREFIX}${source}`, moduleSideEffects: false };\n }\n return null;\n },\n load(id) {\n if (id.startsWith(NODE_BUILTIN_SHIM_PREFIX)) {\n return getNodeBuiltinShimCode(id.slice(NODE_BUILTIN_SHIM_PREFIX.length));\n }\n return null;\n },\n };\n}\n\nfunction isValidEsmIdentifier(name: string): boolean {\n return /^[$A-Z_a-z][$\\w]*$/.test(name);\n}\n\nfunction resolvePackageImportPath(specifier: string, rootDir: string): string | null {\n const resolver = createRequire(path.join(rootDir, \"__isolate_module_loader__.js\"));\n\n let resolvedRequirePath: string;\n try {\n resolvedRequirePath = resolver.resolve(specifier);\n } catch {\n return null;\n }\n\n const { packageName, subpath } = parseSpecifier(specifier);\n const packageJsonPath = findPackageJsonPath(resolvedRequirePath, packageName);\n if (!packageJsonPath) {\n return resolvedRequirePath;\n }\n\n let packageJson: Record<string, unknown>;\n try {\n packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\")) as Record<string, unknown>;\n } catch {\n return resolvedRequirePath;\n }\n\n const packageRoot = path.dirname(packageJsonPath);\n const exportPath = resolveImportEntryFromPackageJson(packageJson, subpath);\n\n if (exportPath) {\n return path.resolve(packageRoot, exportPath);\n }\n\n if (!subpath) {\n const moduleEntry = packageJson.module;\n if (typeof moduleEntry === \"string\") {\n return path.resolve(packageRoot, moduleEntry);\n }\n\n const browserEntry = packageJson.browser;\n if (typeof browserEntry === \"string\") {\n return path.resolve(packageRoot, browserEntry);\n }\n }\n\n return resolvedRequirePath;\n}\n\nfunction findPackageJsonPath(resolvedPath: string, packageName: string): string | null {\n let currentDir = path.dirname(resolvedPath);\n let matchedPackageJsonPath: string | null = null;\n\n while (true) {\n const packageJsonPath = path.join(currentDir, \"package.json\");\n\n if (fs.existsSync(packageJsonPath)) {\n try {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\")) as { name?: string };\n if (packageJson.name === packageName) {\n // Keep walking upward: published packages often include nested\n // dist/cjs or dist/mjs package.json files with the same name, but the\n // real package root higher up contains the export map we need.\n matchedPackageJsonPath = packageJsonPath;\n }\n } catch {\n // Keep walking upward if a parent package.json is malformed.\n }\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n return matchedPackageJsonPath;\n }\n currentDir = parentDir;\n }\n}\n\nfunction resolveImportEntryFromPackageJson(\n packageJson: Record<string, unknown>,\n subpath: string\n): string | null {\n const exportsField = packageJson.exports;\n if (exportsField === undefined) {\n return null;\n }\n\n const exportKey = subpath ? `.${subpath}` : \".\";\n\n if (isConditionalExportsObject(exportsField)) {\n if (exportKey !== \".\") {\n return null;\n }\n return pickImportTarget(exportsField);\n }\n\n if (typeof exportsField === \"object\" && exportsField !== null && !Array.isArray(exportsField)) {\n const exportsRecord = exportsField as Record<string, unknown>;\n const directTarget = exportsRecord[exportKey];\n if (directTarget !== undefined) {\n return pickImportTarget(directTarget);\n }\n\n for (const [pattern, target] of Object.entries(exportsRecord)) {\n if (!pattern.includes(\"*\")) {\n continue;\n }\n\n const starIndex = pattern.indexOf(\"*\");\n const prefix = pattern.slice(0, starIndex);\n const suffix = pattern.slice(starIndex + 1);\n\n if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) {\n continue;\n }\n\n const wildcardMatch = exportKey.slice(\n prefix.length,\n suffix.length > 0 ? -suffix.length : undefined,\n );\n\n return pickImportTarget(target, wildcardMatch);\n }\n\n return null;\n }\n\n return exportKey === \".\" ? pickImportTarget(exportsField) : null;\n}\n\nfunction isConditionalExportsObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\"\n && value !== null\n && !Array.isArray(value)\n && Object.keys(value).every((key) => !key.startsWith(\".\"));\n}\n\nfunction pickImportTarget(value: unknown, wildcardMatch?: string): string | null {\n if (typeof value === \"string\") {\n return wildcardMatch === undefined ? value : value.replaceAll(\"*\", wildcardMatch);\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n const target = pickImportTarget(item, wildcardMatch);\n if (target) {\n return target;\n }\n }\n return null;\n }\n\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const record = value as Record<string, unknown>;\n\n for (const key of [\"workerd\", \"worker\", \"edge-light\", \"import\", \"module\", \"default\", \"browser\"]) {\n if (key in record) {\n const target = pickImportTarget(record[key], wildcardMatch);\n if (target) {\n return target;\n }\n }\n }\n\n for (const nestedValue of Object.values(record)) {\n const target = pickImportTarget(nestedValue, wildcardMatch);\n if (target) {\n return target;\n }\n }\n\n return null;\n}\n\nfunction getCommonJsNamedExports(specifier: string, rootDir: string): string[] {\n const resolvedHostPath = resolvePackageImportPath(specifier, rootDir);\n if (!resolvedHostPath) {\n return [];\n }\n\n let code: string;\n try {\n code = fs.readFileSync(resolvedHostPath, \"utf-8\");\n } catch {\n return [];\n }\n\n if (detectFormat(resolvedHostPath, code) !== \"cjs\") {\n return [];\n }\n\n let moduleExports: unknown;\n try {\n moduleExports = createRequire(resolvedHostPath)(resolvedHostPath);\n } catch {\n return [];\n }\n\n if (moduleExports == null || (typeof moduleExports !== \"object\" && typeof moduleExports !== \"function\")) {\n return [];\n }\n\n const names = new Set([\n ...Object.keys(moduleExports),\n ...Object.getOwnPropertyNames(moduleExports),\n ]);\n\n names.delete(\"default\");\n names.delete(\"__esModule\");\n\n if (typeof moduleExports === \"function\") {\n for (const name of INVALID_FUNCTION_EXPORT_NAMES) {\n names.delete(name);\n }\n }\n\n return [...names].filter(isValidEsmIdentifier).sort();\n}\n\nfunction packageEntryWrapperPlugin(specifier: string, namedExports: string[]): Plugin {\n const wrapperId = `${PACKAGE_ENTRY_WRAPPER_PREFIX}${specifier}`;\n\n return {\n name: \"package-entry-wrapper\",\n resolveId(source) {\n if (source === wrapperId) {\n return wrapperId;\n }\n return null;\n },\n load(id) {\n if (id !== wrapperId) {\n return null;\n }\n\n const namedExportLines = namedExports.map(\n (name) => `export const ${name} = __packageDefault.${name};`\n );\n\n return [\n `import __packageDefault from ${JSON.stringify(specifier)};`,\n \"export default __packageDefault;\",\n ...namedExportLines,\n ].join(\"\\n\");\n },\n };\n}\n\n/**\n * Cache for bundled npm packages. Key includes specifier + resolution root.\n */\nconst bundleCache = new Map<string, { code: string }>();\n\n/**\n * In-flight bundle promises to avoid duplicate concurrent bundles.\n */\nconst bundlesInFlight = new Map<string, Promise<{ code: string }>>();\n\n/**\n * Create a Rollup plugin that externalizes all bare specifiers that don't\n * belong to the current package. Internal files of the package are inlined;\n * other npm packages remain as import statements.\n */\nfunction externalizeDepsPlugin(currentPackageName: string): Plugin {\n return {\n name: \"externalize-deps\",\n resolveId(source, importer) {\n // Don't externalize the entry point\n if (!importer) return null;\n\n // Don't externalize relative imports (internal to the package)\n if (source.startsWith(\".\") || source.startsWith(\"/\")) return null;\n\n // Keep package-private imports inside the current bundle so Rollup can\n // resolve them through the importing package's `imports` map.\n if (source.startsWith(\"#\")) return null;\n\n // Don't externalize Node.js builtins — let nodeResolve handle them\n // via the package's browser field (e.g. \"fs\": false → empty module)\n if (isNodeBuiltin(source)) return null;\n\n // Check if this is a different npm package\n const { packageName } = parseSpecifier(source);\n if (packageName !== currentPackageName) {\n return { id: source, external: true };\n }\n\n // Same package — let Rollup resolve it normally\n return null;\n },\n };\n}\n\n/**\n * Bundle a bare specifier (npm package) using Rollup.\n *\n * Each unique bare specifier gets its own bundle with:\n * - node-resolve with worker/server-safe export conditions\n * - commonjs conversion\n * - json support\n * - process.env.NODE_ENV replacement\n * - External deps (other npm packages) left as import statements\n *\n * Results are cached permanently (npm packages are static).\n */\nexport async function bundleSpecifier(\n specifier: string,\n rootDir: string\n): Promise<{ code: string }> {\n const cacheKey = `${specifier}\\0${rootDir}`;\n\n // Check cache\n const cached = bundleCache.get(cacheKey);\n if (cached) return cached;\n\n // Check in-flight\n const inFlight = bundlesInFlight.get(cacheKey);\n if (inFlight) return inFlight;\n\n const promise = doBundleSpecifier(specifier, rootDir);\n bundlesInFlight.set(cacheKey, promise);\n\n try {\n const result = await promise;\n bundleCache.set(cacheKey, result);\n return result;\n } finally {\n bundlesInFlight.delete(cacheKey);\n }\n}\n\nasync function doBundleSpecifier(\n specifier: string,\n rootDir: string\n): Promise<{ code: string }> {\n const { packageName } = parseSpecifier(specifier);\n const namedExports = getCommonJsNamedExports(specifier, rootDir);\n const input = namedExports.length > 0\n ? `${PACKAGE_ENTRY_WRAPPER_PREFIX}${specifier}`\n : specifier;\n\n const bundle = await rollup({\n input,\n // Disable tree-shaking: we're creating a virtual module that must faithfully\n // expose all package exports. We can't predict which ones user code will import.\n // Without this, exports like AWS SDK's ConverseStreamOutput (a namespace with\n // a visit() helper that nothing inside the bundle references) get dropped.\n treeshake: false,\n plugins: [\n packageEntryWrapperPlugin(specifier, namedExports),\n externalizeDepsPlugin(packageName),\n nodeResolve({\n rootDir,\n browser: false,\n exportConditions: [\"workerd\", \"worker\", \"edge-light\"],\n }),\n shimNodeBuiltinsPlugin(),\n commonjs(commonjsInteropOptions),\n json(),\n replace({\n preventAssignment: true,\n values: { \"process.env.NODE_ENV\": JSON.stringify(\"development\") },\n }),\n ],\n onwarn: (warning, warn) => {\n if (warning.code === \"CIRCULAR_DEPENDENCY\") return;\n if (warning.code === \"THIS_IS_UNDEFINED\") return;\n if (warning.code === \"UNUSED_EXTERNAL_IMPORT\") return;\n if (warning.code === \"EMPTY_BUNDLE\") return;\n // Suppress warnings about named imports from shimmed Node.js builtins\n if (warning.code === \"MISSING_EXPORT\" && warning.exporter?.startsWith(NODE_BUILTIN_SHIM_PREFIX)) return;\n warn(warning);\n },\n });\n\n const { output } = await bundle.generate({\n format: \"es\",\n sourcemap: \"inline\",\n inlineDynamicImports: true,\n });\n await bundle.close();\n\n const code = output[0]!.code;\n return { code };\n}\n\n/**\n * Create a Rollup plugin that externalizes ALL bare specifiers.\n * Used for module aliases where the host file's relative imports are bundled\n * but npm package dependencies are left as external imports.\n */\nfunction externalizeAllBareSpecifiersPlugin(): Plugin {\n return {\n name: \"externalize-all-bare-specifiers\",\n resolveId(source, importer) {\n if (!importer) return null;\n if (source.startsWith(\".\") || source.startsWith(\"/\")) return null;\n if (source.startsWith(\"#\")) return null;\n // Don't externalize Node.js builtins — let nodeResolve/shim handle them\n if (isNodeBuiltin(source)) return null;\n return { id: source, external: true };\n },\n };\n}\n\n/**\n * Create a Rollup transform plugin that strips TypeScript types.\n */\nfunction stripTypeScriptPlugin(): Plugin {\n return {\n name: \"strip-typescript\",\n transform(code, id) {\n if (isTypeScriptFile(id)) {\n return { code: processTypeScript(code, id), map: null };\n }\n return null;\n },\n };\n}\n\nconst TS_EXTENSIONS = [\".ts\", \".tsx\", \".mts\", \".cts\"];\n\n/**\n * Bundle a host file using Rollup, inlining its relative imports.\n *\n * - Uses the host file path as Rollup input\n * - Externalizes ALL bare specifiers (npm packages)\n * - Strips TypeScript via processTypeScript\n * - Shares the bundleCache/bundlesInFlight (no key collision since file paths start with `/`)\n *\n * Results are cached permanently.\n */\nexport async function bundleHostFile(\n hostFilePath: string,\n): Promise<{ code: string }> {\n const cached = bundleCache.get(hostFilePath);\n if (cached) return cached;\n\n const inFlight = bundlesInFlight.get(hostFilePath);\n if (inFlight) return inFlight;\n\n const promise = doBundleHostFile(hostFilePath);\n bundlesInFlight.set(hostFilePath, promise);\n\n try {\n const result = await promise;\n bundleCache.set(hostFilePath, result);\n return result;\n } finally {\n bundlesInFlight.delete(hostFilePath);\n }\n}\n\nasync function doBundleHostFile(\n hostFilePath: string,\n): Promise<{ code: string }> {\n const rootDir = path.dirname(hostFilePath);\n\n const bundle = await rollup({\n input: hostFilePath,\n treeshake: false,\n plugins: [\n externalizeAllBareSpecifiersPlugin(),\n stripTypeScriptPlugin(),\n nodeResolve({\n rootDir,\n browser: false,\n exportConditions: [\"workerd\", \"worker\", \"edge-light\"],\n extensions: [\".mjs\", \".js\", \".json\", \".node\", ...TS_EXTENSIONS],\n }),\n shimNodeBuiltinsPlugin(),\n commonjs(commonjsInteropOptions),\n json(),\n replace({\n preventAssignment: true,\n values: { \"process.env.NODE_ENV\": JSON.stringify(\"development\") },\n }),\n ],\n onwarn: (warning, warn) => {\n if (warning.code === \"CIRCULAR_DEPENDENCY\") return;\n if (warning.code === \"THIS_IS_UNDEFINED\") return;\n if (warning.code === \"UNUSED_EXTERNAL_IMPORT\") return;\n if (warning.code === \"EMPTY_BUNDLE\") return;\n // Suppress warnings about named imports from shimmed Node.js builtins\n if (warning.code === \"MISSING_EXPORT\" && warning.exporter?.startsWith(NODE_BUILTIN_SHIM_PREFIX)) return;\n warn(warning);\n },\n });\n\n const { output } = await bundle.generate({\n format: \"es\",\n sourcemap: \"inline\",\n inlineDynamicImports: true,\n });\n await bundle.close();\n\n const code = output[0]!.code;\n return { code };\n}\n\n/**\n * Clear the bundle cache. Useful for testing.\n */\nexport function clearBundleCache(): void {\n bundleCache.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AA,MAC/B,KAAK;AAAA,MACL,QAAQ;AAAA,QACN,mBAAmB;AAAA,QACnB,QAAQ,EAAE,wBAAwB,KAAK,UAAU,aAAa,EAAE;AAAA,MAClE,CAAC;AAAA,IACH;AAAA,IACA,QAAQ,CAAC,SAAS,SAAS;AAAA,MACzB,IAAI,QAAQ,SAAS;AAAA,QAAuB;AAAA,MAC5C,IAAI,QAAQ,SAAS;AAAA,QAAqB;AAAA,MAC1C,IAAI,QAAQ,SAAS;AAAA,QAA0B;AAAA,MAC/C,IAAI,QAAQ,SAAS;AAAA,QAAgB;AAAA,MAErC,IAAI,QAAQ,SAAS,oBAAoB,QAAQ,UAAU,WAAW,wBAAwB;AAAA,QAAG;AAAA,MACjG,KAAK,OAAO;AAAA;AAAA,EAEhB,CAAC;AAAA,EAED,QAAQ,WAAW,MAAM,OAAO,SAAS;AAAA,IACvC,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,sBAAsB;AAAA,EACxB,CAAC;AAAA,EACD,MAAM,OAAO,MAAM;AAAA,EAEnB,MAAM,OAAO,OAAO,GAAI;AAAA,EACxB,OAAO,EAAE,KAAK;AAAA;AAMT,SAAS,gBAAgB,GAAS;AAAA,EACvC,YAAY,MAAM;AAAA;",
8
+ "debugId": "F7B021707E1572B264756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -2,7 +2,7 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/internal/path/index.ts"],
4
4
  "sourcesContent": [
5
- "import type ivm from \"isolated-vm\";\n\nexport interface PathOptions {\n /** Current working directory for path.resolve(). Defaults to \"/\" */\n cwd?: string;\n}\n\nexport interface PathHandle {\n dispose(): void;\n}\n\n/**\n * Generate the path module code with optional cwd configuration.\n */\nfunction generatePathCode(cwd: string): string {\n return `\n(function() {\n const sep = '/';\n const delimiter = ':';\n\n /**\n * Normalize a path by resolving '.' and '..' segments and removing redundant separators\n */\n function normalize(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n if (p.length === 0) {\n return '.';\n }\n\n const isAbsolutePath = p.charCodeAt(0) === 47; // '/'\n const trailingSlash = p.charCodeAt(p.length - 1) === 47; // '/'\n\n // Split by separator and filter empty segments\n const segments = p.split('/');\n const result = [];\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n\n // Skip empty segments (from consecutive slashes) and '.'\n if (segment === '' || segment === '.') {\n continue;\n }\n\n if (segment === '..') {\n // For absolute paths, don't go above root\n // For relative paths, keep '..' if we can't go up further\n if (result.length > 0 && result[result.length - 1] !== '..') {\n result.pop();\n } else if (!isAbsolutePath) {\n result.push('..');\n }\n } else {\n result.push(segment);\n }\n }\n\n let normalized = result.join('/');\n\n if (isAbsolutePath) {\n normalized = '/' + normalized;\n }\n\n if (trailingSlash && normalized.length > 1 && !normalized.endsWith('/')) {\n normalized += '/';\n }\n\n if (!normalized) {\n return isAbsolutePath ? '/' : '.';\n }\n\n return normalized;\n }\n\n /**\n * Join path segments together and normalize the result\n */\n function join(...segments) {\n if (segments.length === 0) {\n return '.';\n }\n\n let joined = '';\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n if (typeof segment !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof segment);\n }\n if (segment.length > 0) {\n if (joined.length === 0) {\n joined = segment;\n } else {\n joined += '/' + segment;\n }\n }\n }\n\n if (joined.length === 0) {\n return '.';\n }\n\n return normalize(joined);\n }\n\n /**\n * Get the directory name of a path\n */\n function dirname(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n if (p.length === 0) {\n return '.';\n }\n\n const isAbsolutePath = p.charCodeAt(0) === 47;\n let end = -1;\n let matchedSlash = true;\n\n for (let i = p.length - 1; i >= 1; i--) {\n if (p.charCodeAt(i) === 47) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n matchedSlash = false;\n }\n }\n\n if (end === -1) {\n return isAbsolutePath ? '/' : '.';\n }\n\n if (isAbsolutePath && end === 1) {\n return '/';\n }\n\n return p.slice(0, end);\n }\n\n /**\n * Get the last portion of a path, optionally removing a suffix\n */\n function basename(p, ext) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n if (ext !== undefined && typeof ext !== 'string') {\n throw new TypeError('ext must be a string');\n }\n\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n\n for (let i = p.length - 1; i >= 0; i--) {\n if (p.charCodeAt(i) === 47) {\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (matchedSlash) {\n end = i + 1;\n matchedSlash = false;\n }\n }\n }\n\n if (end === -1) {\n return '';\n }\n\n const base = p.slice(start, end);\n\n if (ext !== undefined && base.endsWith(ext)) {\n return base.slice(0, base.length - ext.length);\n }\n\n return base;\n }\n\n /**\n * Get the extension of a path\n */\n function extname(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let preDotState = 0;\n\n for (let i = p.length - 1; i >= 0; i--) {\n const code = p.charCodeAt(i);\n if (code === 47) {\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n\n if (end === -1) {\n matchedSlash = false;\n end = i + 1;\n }\n\n if (code === 46) { // '.'\n if (startDot === -1) {\n startDot = i;\n } else if (preDotState !== 1) {\n preDotState = 1;\n }\n } else if (startDot !== -1) {\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n preDotState === 0 ||\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {\n return '';\n }\n\n return p.slice(startDot, end);\n }\n\n /**\n * Check if a path is absolute\n */\n function isAbsolute(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n return p.length > 0 && p.charCodeAt(0) === 47;\n }\n\n /**\n * Resolve a sequence of paths to an absolute path\n */\n function resolve(...segments) {\n let resolvedPath = '';\n let resolvedAbsolute = false;\n\n for (let i = segments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n let path;\n if (i >= 0) {\n path = segments[i];\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof path);\n }\n } else {\n // Use configured cwd\n path = ${JSON.stringify(cwd)};\n }\n\n if (path.length === 0) {\n continue;\n }\n\n if (resolvedPath.length > 0) {\n resolvedPath = path + '/' + resolvedPath;\n } else {\n resolvedPath = path;\n }\n resolvedAbsolute = path.charCodeAt(0) === 47;\n }\n\n resolvedPath = normalize(resolvedPath);\n\n // Remove trailing slash unless it's just root\n if (resolvedPath.length > 1 && resolvedPath.endsWith('/')) {\n resolvedPath = resolvedPath.slice(0, -1);\n }\n\n if (resolvedAbsolute) {\n return resolvedPath.length > 0 ? resolvedPath : '/';\n }\n\n return resolvedPath.length > 0 ? resolvedPath : '.';\n }\n\n /**\n * Get the relative path from 'from' to 'to'\n */\n function relative(from, to) {\n if (typeof from !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof from);\n }\n if (typeof to !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof to);\n }\n\n if (from === to) {\n return '';\n }\n\n from = resolve(from);\n to = resolve(to);\n\n if (from === to) {\n return '';\n }\n\n const fromParts = from.split('/').filter(Boolean);\n const toParts = to.split('/').filter(Boolean);\n\n // Find common prefix\n let commonLength = 0;\n const minLength = Math.min(fromParts.length, toParts.length);\n for (let i = 0; i < minLength; i++) {\n if (fromParts[i] !== toParts[i]) {\n break;\n }\n commonLength++;\n }\n\n // Build relative path\n const upCount = fromParts.length - commonLength;\n const result = [];\n\n for (let i = 0; i < upCount; i++) {\n result.push('..');\n }\n\n for (let i = commonLength; i < toParts.length; i++) {\n result.push(toParts[i]);\n }\n\n return result.join('/');\n }\n\n /**\n * Parse a path into its components\n */\n function parse(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\n if (p.length === 0) {\n return ret;\n }\n\n const isAbsolutePath = p.charCodeAt(0) === 47;\n if (isAbsolutePath) {\n ret.root = '/';\n }\n\n let start = isAbsolutePath ? 1 : 0;\n let end = -1;\n let matchedSlash = true;\n let startDot = -1;\n let preDotState = 0;\n\n // Get base and dir\n for (let i = p.length - 1; i >= start; i--) {\n const code = p.charCodeAt(i);\n if (code === 47) {\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (matchedSlash) {\n end = i + 1;\n matchedSlash = false;\n }\n\n if (code === 46) { // '.'\n if (startDot === -1) {\n startDot = i;\n } else if (preDotState !== 1) {\n preDotState = 1;\n }\n } else if (startDot !== -1) {\n preDotState = -1;\n }\n }\n }\n\n if (end !== -1) {\n ret.base = p.slice(start, end);\n\n // Determine extension\n if (startDot !== -1 && startDot >= start &&\n preDotState !== 0 &&\n !(preDotState === 1 && startDot === end - 1 && startDot === start + 1)) {\n ret.ext = p.slice(startDot, end);\n ret.name = p.slice(start, startDot);\n } else {\n ret.name = ret.base;\n }\n }\n\n if (start > (isAbsolutePath ? 1 : 0)) {\n ret.dir = p.slice(0, start - 1);\n } else if (isAbsolutePath) {\n ret.dir = '/';\n }\n\n return ret;\n }\n\n /**\n * Format a path object into a path string\n */\n function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError(\"Parameter 'pathObject' must be an object, not \" + typeof pathObject);\n }\n\n const dir = pathObject.dir || pathObject.root || '';\n const base = pathObject.base ||\n ((pathObject.name || '') + (pathObject.ext || ''));\n\n if (!dir) {\n return base;\n }\n\n if (dir === pathObject.root) {\n return dir + base;\n }\n\n return dir + '/' + base;\n }\n\n // Create path object with posix namespace (for compatibility)\n const pathModule = {\n sep,\n delimiter,\n normalize,\n join,\n dirname,\n basename,\n extname,\n isAbsolute,\n resolve,\n relative,\n parse,\n format,\n };\n\n // posix is the same as the main module since we only support POSIX\n pathModule.posix = pathModule;\n\n globalThis.path = pathModule;\n})();\n`;\n}\n\n/**\n * Setup path utilities in an isolated-vm context\n *\n * Provides path manipulation utilities similar to Node.js path module\n * Uses POSIX-style paths only (always uses '/' as separator)\n *\n * @example\n * const handle = await setupPath(context, { cwd: \"/home/user\" });\n * await context.eval(\\`\n * const joined = path.join(\"/foo\", \"bar\", \"baz\");\n * const dir = path.dirname(\"/foo/bar/baz.txt\");\n * const resolved = path.resolve(\"relative\"); // Uses configured cwd\n * \\`);\n */\nexport async function setupPath(\n context: ivm.Context,\n options?: PathOptions\n): Promise<PathHandle> {\n const cwd = options?.cwd ?? \"/\";\n const pathCode = generatePathCode(cwd);\n context.evalSync(pathCode);\n return {\n dispose() {\n // No resources to cleanup for pure JS injection\n },\n };\n}\n"
5
+ "import type ivm from \"@ricsam/isolated-vm\";\n\nexport interface PathOptions {\n /** Current working directory for path.resolve(). Defaults to \"/\" */\n cwd?: string;\n}\n\nexport interface PathHandle {\n dispose(): void;\n}\n\n/**\n * Generate the path module code with optional cwd configuration.\n */\nfunction generatePathCode(cwd: string): string {\n return `\n(function() {\n const sep = '/';\n const delimiter = ':';\n\n /**\n * Normalize a path by resolving '.' and '..' segments and removing redundant separators\n */\n function normalize(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n if (p.length === 0) {\n return '.';\n }\n\n const isAbsolutePath = p.charCodeAt(0) === 47; // '/'\n const trailingSlash = p.charCodeAt(p.length - 1) === 47; // '/'\n\n // Split by separator and filter empty segments\n const segments = p.split('/');\n const result = [];\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n\n // Skip empty segments (from consecutive slashes) and '.'\n if (segment === '' || segment === '.') {\n continue;\n }\n\n if (segment === '..') {\n // For absolute paths, don't go above root\n // For relative paths, keep '..' if we can't go up further\n if (result.length > 0 && result[result.length - 1] !== '..') {\n result.pop();\n } else if (!isAbsolutePath) {\n result.push('..');\n }\n } else {\n result.push(segment);\n }\n }\n\n let normalized = result.join('/');\n\n if (isAbsolutePath) {\n normalized = '/' + normalized;\n }\n\n if (trailingSlash && normalized.length > 1 && !normalized.endsWith('/')) {\n normalized += '/';\n }\n\n if (!normalized) {\n return isAbsolutePath ? '/' : '.';\n }\n\n return normalized;\n }\n\n /**\n * Join path segments together and normalize the result\n */\n function join(...segments) {\n if (segments.length === 0) {\n return '.';\n }\n\n let joined = '';\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n if (typeof segment !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof segment);\n }\n if (segment.length > 0) {\n if (joined.length === 0) {\n joined = segment;\n } else {\n joined += '/' + segment;\n }\n }\n }\n\n if (joined.length === 0) {\n return '.';\n }\n\n return normalize(joined);\n }\n\n /**\n * Get the directory name of a path\n */\n function dirname(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n if (p.length === 0) {\n return '.';\n }\n\n const isAbsolutePath = p.charCodeAt(0) === 47;\n let end = -1;\n let matchedSlash = true;\n\n for (let i = p.length - 1; i >= 1; i--) {\n if (p.charCodeAt(i) === 47) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n matchedSlash = false;\n }\n }\n\n if (end === -1) {\n return isAbsolutePath ? '/' : '.';\n }\n\n if (isAbsolutePath && end === 1) {\n return '/';\n }\n\n return p.slice(0, end);\n }\n\n /**\n * Get the last portion of a path, optionally removing a suffix\n */\n function basename(p, ext) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n if (ext !== undefined && typeof ext !== 'string') {\n throw new TypeError('ext must be a string');\n }\n\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n\n for (let i = p.length - 1; i >= 0; i--) {\n if (p.charCodeAt(i) === 47) {\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (matchedSlash) {\n end = i + 1;\n matchedSlash = false;\n }\n }\n }\n\n if (end === -1) {\n return '';\n }\n\n const base = p.slice(start, end);\n\n if (ext !== undefined && base.endsWith(ext)) {\n return base.slice(0, base.length - ext.length);\n }\n\n return base;\n }\n\n /**\n * Get the extension of a path\n */\n function extname(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let preDotState = 0;\n\n for (let i = p.length - 1; i >= 0; i--) {\n const code = p.charCodeAt(i);\n if (code === 47) {\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n\n if (end === -1) {\n matchedSlash = false;\n end = i + 1;\n }\n\n if (code === 46) { // '.'\n if (startDot === -1) {\n startDot = i;\n } else if (preDotState !== 1) {\n preDotState = 1;\n }\n } else if (startDot !== -1) {\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n preDotState === 0 ||\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {\n return '';\n }\n\n return p.slice(startDot, end);\n }\n\n /**\n * Check if a path is absolute\n */\n function isAbsolute(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n return p.length > 0 && p.charCodeAt(0) === 47;\n }\n\n /**\n * Resolve a sequence of paths to an absolute path\n */\n function resolve(...segments) {\n let resolvedPath = '';\n let resolvedAbsolute = false;\n\n for (let i = segments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n let path;\n if (i >= 0) {\n path = segments[i];\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof path);\n }\n } else {\n // Use configured cwd\n path = ${JSON.stringify(cwd)};\n }\n\n if (path.length === 0) {\n continue;\n }\n\n if (resolvedPath.length > 0) {\n resolvedPath = path + '/' + resolvedPath;\n } else {\n resolvedPath = path;\n }\n resolvedAbsolute = path.charCodeAt(0) === 47;\n }\n\n resolvedPath = normalize(resolvedPath);\n\n // Remove trailing slash unless it's just root\n if (resolvedPath.length > 1 && resolvedPath.endsWith('/')) {\n resolvedPath = resolvedPath.slice(0, -1);\n }\n\n if (resolvedAbsolute) {\n return resolvedPath.length > 0 ? resolvedPath : '/';\n }\n\n return resolvedPath.length > 0 ? resolvedPath : '.';\n }\n\n /**\n * Get the relative path from 'from' to 'to'\n */\n function relative(from, to) {\n if (typeof from !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof from);\n }\n if (typeof to !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof to);\n }\n\n if (from === to) {\n return '';\n }\n\n from = resolve(from);\n to = resolve(to);\n\n if (from === to) {\n return '';\n }\n\n const fromParts = from.split('/').filter(Boolean);\n const toParts = to.split('/').filter(Boolean);\n\n // Find common prefix\n let commonLength = 0;\n const minLength = Math.min(fromParts.length, toParts.length);\n for (let i = 0; i < minLength; i++) {\n if (fromParts[i] !== toParts[i]) {\n break;\n }\n commonLength++;\n }\n\n // Build relative path\n const upCount = fromParts.length - commonLength;\n const result = [];\n\n for (let i = 0; i < upCount; i++) {\n result.push('..');\n }\n\n for (let i = commonLength; i < toParts.length; i++) {\n result.push(toParts[i]);\n }\n\n return result.join('/');\n }\n\n /**\n * Parse a path into its components\n */\n function parse(p) {\n if (typeof p !== 'string') {\n throw new TypeError('Path must be a string. Received ' + typeof p);\n }\n\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\n if (p.length === 0) {\n return ret;\n }\n\n const isAbsolutePath = p.charCodeAt(0) === 47;\n if (isAbsolutePath) {\n ret.root = '/';\n }\n\n let start = isAbsolutePath ? 1 : 0;\n let end = -1;\n let matchedSlash = true;\n let startDot = -1;\n let preDotState = 0;\n\n // Get base and dir\n for (let i = p.length - 1; i >= start; i--) {\n const code = p.charCodeAt(i);\n if (code === 47) {\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (matchedSlash) {\n end = i + 1;\n matchedSlash = false;\n }\n\n if (code === 46) { // '.'\n if (startDot === -1) {\n startDot = i;\n } else if (preDotState !== 1) {\n preDotState = 1;\n }\n } else if (startDot !== -1) {\n preDotState = -1;\n }\n }\n }\n\n if (end !== -1) {\n ret.base = p.slice(start, end);\n\n // Determine extension\n if (startDot !== -1 && startDot >= start &&\n preDotState !== 0 &&\n !(preDotState === 1 && startDot === end - 1 && startDot === start + 1)) {\n ret.ext = p.slice(startDot, end);\n ret.name = p.slice(start, startDot);\n } else {\n ret.name = ret.base;\n }\n }\n\n if (start > (isAbsolutePath ? 1 : 0)) {\n ret.dir = p.slice(0, start - 1);\n } else if (isAbsolutePath) {\n ret.dir = '/';\n }\n\n return ret;\n }\n\n /**\n * Format a path object into a path string\n */\n function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError(\"Parameter 'pathObject' must be an object, not \" + typeof pathObject);\n }\n\n const dir = pathObject.dir || pathObject.root || '';\n const base = pathObject.base ||\n ((pathObject.name || '') + (pathObject.ext || ''));\n\n if (!dir) {\n return base;\n }\n\n if (dir === pathObject.root) {\n return dir + base;\n }\n\n return dir + '/' + base;\n }\n\n // Create path object with posix namespace (for compatibility)\n const pathModule = {\n sep,\n delimiter,\n normalize,\n join,\n dirname,\n basename,\n extname,\n isAbsolute,\n resolve,\n relative,\n parse,\n format,\n };\n\n // posix is the same as the main module since we only support POSIX\n pathModule.posix = pathModule;\n\n globalThis.path = pathModule;\n})();\n`;\n}\n\n/**\n * Setup path utilities in an isolated-vm context\n *\n * Provides path manipulation utilities similar to Node.js path module\n * Uses POSIX-style paths only (always uses '/' as separator)\n *\n * @example\n * const handle = await setupPath(context, { cwd: \"/home/user\" });\n * await context.eval(\\`\n * const joined = path.join(\"/foo\", \"bar\", \"baz\");\n * const dir = path.dirname(\"/foo/bar/baz.txt\");\n * const resolved = path.resolve(\"relative\"); // Uses configured cwd\n * \\`);\n */\nexport async function setupPath(\n context: ivm.Context,\n options?: PathOptions\n): Promise<PathHandle> {\n const cwd = options?.cwd ?? \"/\";\n const pathCode = generatePathCode(cwd);\n context.evalSync(pathCode);\n return {\n dispose() {\n // No resources to cleanup for pure JS injection\n },\n };\n}\n"
6
6
  ],
7
7
  "mappings": ";AAcA,SAAS,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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsNnC,eAAsB,SAAS,CAC7B,SACA,SACqB;AAAA,EACrB,MAAM,MAAM,SAAS,OAAO;AAAA,EAC5B,MAAM,WAAW,iBAAiB,GAAG;AAAA,EACrC,QAAQ,SAAS,QAAQ;AAAA,EACzB,OAAO;AAAA,IACL,OAAO,GAAG;AAAA,EAGZ;AAAA;",
8
8
  "debugId": "0B8F9B625867A91564756E2164756E21",
@@ -1,5 +1,5 @@
1
1
  // src/internal/playwright/index.ts
2
- import ivm from "isolated-vm";
2
+ import ivm from "@ricsam/isolated-vm";
3
3
  import {
4
4
  DEFAULT_PLAYWRIGHT_HANDLER_META
5
5
  } from "./types.mjs";
@@ -1231,4 +1231,4 @@ export {
1231
1231
  DEFAULT_PLAYWRIGHT_HANDLER_META
1232
1232
  };
1233
1233
 
1234
- //# debugId=E669EBDC7B4C7F3264756E2164756E21
1234
+ //# debugId=D072F79E375B765364756E2164756E21