@ricsam/isolate 0.0.1 → 0.1.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/dist/cjs/bridge/diagnostics.cjs +58 -0
- package/dist/cjs/bridge/diagnostics.cjs.map +10 -0
- package/dist/cjs/bridge/legacy-adapters.cjs +242 -0
- package/dist/cjs/bridge/legacy-adapters.cjs.map +10 -0
- package/dist/cjs/bridge/request-context.cjs +59 -0
- package/dist/cjs/bridge/request-context.cjs.map +10 -0
- package/dist/cjs/bridge/runtime-bindings.cjs +367 -0
- package/dist/cjs/bridge/runtime-bindings.cjs.map +10 -0
- package/dist/cjs/browser/browser-runtime.cjs +157 -0
- package/dist/cjs/browser/browser-runtime.cjs.map +10 -0
- package/dist/cjs/daemon.cjs +91 -0
- package/dist/cjs/daemon.cjs.map +10 -0
- package/dist/cjs/files/index.cjs +140 -0
- package/dist/cjs/files/index.cjs.map +10 -0
- package/dist/cjs/host/create-isolate-host.cjs +235 -0
- package/dist/cjs/host/create-isolate-host.cjs.map +10 -0
- package/dist/cjs/host/index.cjs +47 -0
- package/dist/cjs/host/index.cjs.map +10 -0
- package/dist/cjs/index.cjs +55 -0
- package/dist/cjs/index.cjs.map +10 -0
- package/dist/cjs/internal/client/connection.cjs +1919 -0
- package/dist/cjs/internal/client/connection.cjs.map +10 -0
- package/dist/cjs/internal/client/index.cjs +48 -0
- package/dist/cjs/internal/client/index.cjs.map +10 -0
- package/dist/cjs/internal/client/types.cjs +30 -0
- package/dist/cjs/internal/client/types.cjs.map +9 -0
- package/dist/cjs/internal/console/index.cjs +506 -0
- package/dist/cjs/internal/console/index.cjs.map +10 -0
- package/dist/cjs/internal/console/utils.cjs +70 -0
- package/dist/cjs/internal/console/utils.cjs.map +10 -0
- package/dist/cjs/internal/core/index.cjs +2745 -0
- package/dist/cjs/internal/core/index.cjs.map +10 -0
- package/dist/cjs/internal/crypto/index.cjs +470 -0
- package/dist/cjs/internal/crypto/index.cjs.map +10 -0
- package/dist/cjs/internal/daemon/callback-fs-handler.cjs +355 -0
- package/dist/cjs/internal/daemon/callback-fs-handler.cjs.map +10 -0
- package/dist/cjs/internal/daemon/connection.cjs +1952 -0
- package/dist/cjs/internal/daemon/connection.cjs.map +10 -0
- package/dist/cjs/internal/daemon/daemon.cjs +98 -0
- package/dist/cjs/internal/daemon/daemon.cjs.map +10 -0
- package/dist/cjs/internal/daemon/index.cjs +145 -0
- package/dist/cjs/internal/daemon/index.cjs.map +10 -0
- package/dist/cjs/internal/daemon/runtime-pool.cjs +106 -0
- package/dist/cjs/internal/daemon/runtime-pool.cjs.map +10 -0
- package/dist/cjs/internal/daemon/types.cjs +30 -0
- package/dist/cjs/internal/daemon/types.cjs.map +9 -0
- package/dist/cjs/internal/encoding/index.cjs +419 -0
- package/dist/cjs/internal/encoding/index.cjs.map +10 -0
- package/dist/cjs/internal/fetch/consistency/origins.cjs +598 -0
- package/dist/cjs/internal/fetch/consistency/origins.cjs.map +10 -0
- package/dist/cjs/internal/fetch/index.cjs +2640 -0
- package/dist/cjs/internal/fetch/index.cjs.map +10 -0
- package/dist/cjs/internal/fetch/stream-state.cjs +256 -0
- package/dist/cjs/internal/fetch/stream-state.cjs.map +10 -0
- package/dist/cjs/internal/fs/index.cjs +847 -0
- package/dist/cjs/internal/fs/index.cjs.map +10 -0
- package/dist/cjs/internal/fs/node-adapter.cjs +254 -0
- package/dist/cjs/internal/fs/node-adapter.cjs.map +10 -0
- package/dist/cjs/internal/module-loader/bundle.cjs +482 -0
- package/dist/cjs/internal/module-loader/bundle.cjs.map +10 -0
- package/dist/cjs/internal/module-loader/index.cjs +240 -0
- package/dist/cjs/internal/module-loader/index.cjs.map +10 -0
- package/dist/cjs/internal/module-loader/mappings.cjs +120 -0
- package/dist/cjs/internal/module-loader/mappings.cjs.map +10 -0
- package/dist/cjs/internal/module-loader/resolve.cjs +177 -0
- package/dist/cjs/internal/module-loader/resolve.cjs.map +10 -0
- package/dist/cjs/internal/module-loader/strip-types.cjs +236 -0
- package/dist/cjs/internal/module-loader/strip-types.cjs.map +10 -0
- package/dist/cjs/internal/path/index.cjs +503 -0
- package/dist/cjs/internal/path/index.cjs.map +10 -0
- package/dist/cjs/internal/playwright/client.cjs +49 -0
- package/dist/cjs/internal/playwright/client.cjs.map +10 -0
- package/dist/cjs/internal/playwright/handler.cjs +1416 -0
- package/dist/cjs/internal/playwright/handler.cjs.map +10 -0
- package/dist/cjs/internal/playwright/index.cjs +1289 -0
- package/dist/cjs/internal/playwright/index.cjs.map +10 -0
- package/dist/cjs/internal/playwright/types.cjs +47 -0
- package/dist/cjs/internal/playwright/types.cjs.map +10 -0
- package/dist/cjs/internal/protocol/codec.cjs +510 -0
- package/dist/cjs/internal/protocol/codec.cjs.map +10 -0
- package/dist/cjs/internal/protocol/framing.cjs +141 -0
- package/dist/cjs/internal/protocol/framing.cjs.map +10 -0
- package/dist/cjs/internal/protocol/index.cjs +110 -0
- package/dist/cjs/internal/protocol/index.cjs.map +10 -0
- package/dist/cjs/internal/protocol/marshalValue.cjs +518 -0
- package/dist/cjs/internal/protocol/marshalValue.cjs.map +10 -0
- package/dist/cjs/internal/protocol/serialization.cjs +109 -0
- package/dist/cjs/internal/protocol/serialization.cjs.map +10 -0
- package/dist/cjs/internal/protocol/types.cjs +181 -0
- package/dist/cjs/internal/protocol/types.cjs.map +10 -0
- package/dist/cjs/internal/runtime/index.cjs +1235 -0
- package/dist/cjs/internal/runtime/index.cjs.map +10 -0
- package/dist/cjs/internal/server/index.cjs +223 -0
- package/dist/cjs/internal/server/index.cjs.map +10 -0
- package/dist/cjs/internal/test-environment/index.cjs +1415 -0
- package/dist/cjs/internal/test-environment/index.cjs.map +10 -0
- package/dist/cjs/internal/timers/index.cjs +200 -0
- package/dist/cjs/internal/timers/index.cjs.map +10 -0
- package/dist/cjs/internal/transform/index.cjs +361 -0
- package/dist/cjs/internal/transform/index.cjs.map +10 -0
- package/dist/cjs/internal/typecheck/index.cjs +60 -0
- package/dist/cjs/internal/typecheck/index.cjs.map +10 -0
- package/dist/cjs/internal/typecheck/isolate-types.cjs +2614 -0
- package/dist/cjs/internal/typecheck/isolate-types.cjs.map +10 -0
- package/dist/cjs/internal/typecheck/typecheck.cjs +131 -0
- package/dist/cjs/internal/typecheck/typecheck.cjs.map +10 -0
- package/dist/cjs/modules/index.cjs +160 -0
- package/dist/cjs/modules/index.cjs.map +10 -0
- package/dist/cjs/package.json +5 -0
- package/dist/cjs/runtime/script-runtime.cjs +97 -0
- package/dist/cjs/runtime/script-runtime.cjs.map +10 -0
- package/dist/cjs/server/app-server.cjs +158 -0
- package/dist/cjs/server/app-server.cjs.map +10 -0
- package/dist/cjs/testing/integration-helpers.cjs +127 -0
- package/dist/cjs/testing/integration-helpers.cjs.map +10 -0
- package/dist/cjs/typecheck/index.cjs +96 -0
- package/dist/cjs/typecheck/index.cjs.map +10 -0
- package/dist/cjs/types.cjs +30 -0
- package/dist/cjs/types.cjs.map +9 -0
- package/dist/mjs/bridge/diagnostics.mjs +18 -0
- package/dist/mjs/bridge/diagnostics.mjs.map +10 -0
- package/dist/mjs/bridge/legacy-adapters.mjs +178 -0
- package/dist/mjs/bridge/legacy-adapters.mjs.map +10 -0
- package/dist/mjs/bridge/request-context.mjs +19 -0
- package/dist/mjs/bridge/request-context.mjs.map +10 -0
- package/dist/mjs/bridge/runtime-bindings.mjs +303 -0
- package/dist/mjs/bridge/runtime-bindings.mjs.map +10 -0
- package/dist/mjs/browser/browser-runtime.mjs +93 -0
- package/dist/mjs/browser/browser-runtime.mjs.map +10 -0
- package/dist/mjs/daemon.mjs +91 -0
- package/dist/mjs/daemon.mjs.map +10 -0
- package/dist/mjs/files/index.mjs +76 -0
- package/dist/mjs/files/index.mjs.map +10 -0
- package/dist/mjs/host/create-isolate-host.mjs +171 -0
- package/dist/mjs/host/create-isolate-host.mjs.map +10 -0
- package/dist/mjs/host/index.mjs +7 -0
- package/dist/mjs/host/index.mjs.map +10 -0
- package/dist/mjs/index.mjs +15 -0
- package/dist/mjs/index.mjs.map +10 -0
- package/dist/mjs/internal/client/connection.mjs +1872 -0
- package/dist/mjs/internal/client/connection.mjs.map +10 -0
- package/dist/mjs/internal/client/index.mjs +8 -0
- package/dist/mjs/internal/client/index.mjs.map +10 -0
- package/dist/mjs/internal/client/types.mjs +2 -0
- package/dist/mjs/internal/client/types.mjs.map +9 -0
- package/dist/mjs/internal/console/index.mjs +442 -0
- package/dist/mjs/internal/console/index.mjs.map +10 -0
- package/dist/mjs/internal/console/utils.mjs +30 -0
- package/dist/mjs/internal/console/utils.mjs.map +10 -0
- package/dist/mjs/internal/core/index.mjs +2681 -0
- package/dist/mjs/internal/core/index.mjs.map +10 -0
- package/dist/mjs/internal/crypto/index.mjs +406 -0
- package/dist/mjs/internal/crypto/index.mjs.map +10 -0
- package/dist/mjs/internal/daemon/callback-fs-handler.mjs +315 -0
- package/dist/mjs/internal/daemon/callback-fs-handler.mjs.map +10 -0
- package/dist/mjs/internal/daemon/connection.mjs +1931 -0
- package/dist/mjs/internal/daemon/connection.mjs.map +10 -0
- package/dist/mjs/internal/daemon/daemon.mjs +98 -0
- package/dist/mjs/internal/daemon/daemon.mjs.map +10 -0
- package/dist/mjs/internal/daemon/index.mjs +105 -0
- package/dist/mjs/internal/daemon/index.mjs.map +10 -0
- package/dist/mjs/internal/daemon/runtime-pool.mjs +66 -0
- package/dist/mjs/internal/daemon/runtime-pool.mjs.map +10 -0
- package/dist/mjs/internal/daemon/types.mjs +2 -0
- package/dist/mjs/internal/daemon/types.mjs.map +9 -0
- package/dist/mjs/internal/encoding/index.mjs +379 -0
- package/dist/mjs/internal/encoding/index.mjs.map +10 -0
- package/dist/mjs/internal/fetch/consistency/origins.mjs +558 -0
- package/dist/mjs/internal/fetch/consistency/origins.mjs.map +10 -0
- package/dist/mjs/internal/fetch/index.mjs +2580 -0
- package/dist/mjs/internal/fetch/index.mjs.map +10 -0
- package/dist/mjs/internal/fetch/stream-state.mjs +216 -0
- package/dist/mjs/internal/fetch/stream-state.mjs.map +10 -0
- package/dist/mjs/internal/fs/index.mjs +783 -0
- package/dist/mjs/internal/fs/index.mjs.map +10 -0
- package/dist/mjs/internal/fs/node-adapter.mjs +190 -0
- package/dist/mjs/internal/fs/node-adapter.mjs.map +10 -0
- package/dist/mjs/internal/module-loader/bundle.mjs +418 -0
- package/dist/mjs/internal/module-loader/bundle.mjs.map +10 -0
- package/dist/mjs/internal/module-loader/index.mjs +185 -0
- package/dist/mjs/internal/module-loader/index.mjs.map +10 -0
- package/dist/mjs/internal/module-loader/mappings.mjs +80 -0
- package/dist/mjs/internal/module-loader/mappings.mjs.map +10 -0
- package/dist/mjs/internal/module-loader/resolve.mjs +113 -0
- package/dist/mjs/internal/module-loader/resolve.mjs.map +10 -0
- package/dist/mjs/internal/module-loader/strip-types.mjs +172 -0
- package/dist/mjs/internal/module-loader/strip-types.mjs.map +10 -0
- package/dist/mjs/internal/path/index.mjs +463 -0
- package/dist/mjs/internal/path/index.mjs.map +10 -0
- package/dist/mjs/internal/playwright/client.mjs +13 -0
- package/dist/mjs/internal/playwright/client.mjs.map +10 -0
- package/dist/mjs/internal/playwright/handler.mjs +1378 -0
- package/dist/mjs/internal/playwright/handler.mjs.map +10 -0
- package/dist/mjs/internal/playwright/index.mjs +1234 -0
- package/dist/mjs/internal/playwright/index.mjs.map +10 -0
- package/dist/mjs/internal/playwright/types.mjs +7 -0
- package/dist/mjs/internal/playwright/types.mjs.map +10 -0
- package/dist/mjs/internal/protocol/codec.mjs +470 -0
- package/dist/mjs/internal/protocol/codec.mjs.map +10 -0
- package/dist/mjs/internal/protocol/framing.mjs +101 -0
- package/dist/mjs/internal/protocol/framing.mjs.map +10 -0
- package/dist/mjs/internal/protocol/index.mjs +98 -0
- package/dist/mjs/internal/protocol/index.mjs.map +10 -0
- package/dist/mjs/internal/protocol/marshalValue.mjs +494 -0
- package/dist/mjs/internal/protocol/marshalValue.mjs.map +10 -0
- package/dist/mjs/internal/protocol/serialization.mjs +69 -0
- package/dist/mjs/internal/protocol/serialization.mjs.map +10 -0
- package/dist/mjs/internal/protocol/types.mjs +141 -0
- package/dist/mjs/internal/protocol/types.mjs.map +10 -0
- package/dist/mjs/internal/runtime/index.mjs +1198 -0
- package/dist/mjs/internal/runtime/index.mjs.map +10 -0
- package/dist/mjs/internal/server/index.mjs +183 -0
- package/dist/mjs/internal/server/index.mjs.map +10 -0
- package/dist/mjs/internal/test-environment/index.mjs +1351 -0
- package/dist/mjs/internal/test-environment/index.mjs.map +10 -0
- package/dist/mjs/internal/timers/index.mjs +136 -0
- package/dist/mjs/internal/timers/index.mjs.map +10 -0
- package/dist/mjs/internal/transform/index.mjs +321 -0
- package/dist/mjs/internal/transform/index.mjs.map +10 -0
- package/dist/mjs/internal/typecheck/index.mjs +35 -0
- package/dist/mjs/internal/typecheck/index.mjs.map +10 -0
- package/dist/mjs/internal/typecheck/isolate-types.mjs +2574 -0
- package/dist/mjs/internal/typecheck/isolate-types.mjs.map +10 -0
- package/dist/mjs/internal/typecheck/typecheck.mjs +91 -0
- package/dist/mjs/internal/typecheck/typecheck.mjs.map +10 -0
- package/dist/mjs/modules/index.mjs +96 -0
- package/dist/mjs/modules/index.mjs.map +10 -0
- package/dist/mjs/package.json +5 -0
- package/dist/mjs/runtime/script-runtime.mjs +57 -0
- package/dist/mjs/runtime/script-runtime.mjs.map +10 -0
- package/dist/mjs/server/app-server.mjs +118 -0
- package/dist/mjs/server/app-server.mjs.map +10 -0
- package/dist/mjs/testing/integration-helpers.mjs +63 -0
- package/dist/mjs/testing/integration-helpers.mjs.map +10 -0
- package/dist/mjs/typecheck/index.mjs +56 -0
- package/dist/mjs/typecheck/index.mjs.map +10 -0
- package/dist/mjs/types.mjs +2 -0
- package/dist/mjs/types.mjs.map +9 -0
- package/dist/types/bridge/diagnostics.d.ts +12 -0
- package/dist/types/bridge/legacy-adapters.d.ts +14 -0
- package/dist/types/bridge/request-context.d.ts +10 -0
- package/dist/types/bridge/runtime-bindings.d.ts +14 -0
- package/dist/types/browser/browser-runtime.d.ts +3 -0
- package/dist/types/daemon.d.ts +2 -0
- package/dist/types/files/index.d.ts +5 -0
- package/dist/types/host/create-isolate-host.d.ts +2 -0
- package/dist/types/host/index.d.ts +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/internal/client/connection.d.ts +9 -0
- package/dist/types/internal/client/index.d.ts +8 -0
- package/dist/types/internal/client/types.d.ts +198 -0
- package/dist/types/internal/console/index.d.ts +108 -0
- package/dist/types/internal/console/utils.d.ts +27 -0
- package/dist/types/internal/core/index.d.ts +119 -0
- package/dist/types/internal/crypto/index.d.ts +18 -0
- package/dist/types/internal/daemon/callback-fs-handler.d.ts +28 -0
- package/dist/types/internal/daemon/connection.d.ts +9 -0
- package/dist/types/internal/daemon/daemon.d.ts +2 -0
- package/dist/types/internal/daemon/index.d.ts +14 -0
- package/dist/types/internal/daemon/runtime-pool.d.ts +16 -0
- package/dist/types/internal/daemon/types.d.ts +211 -0
- package/dist/types/internal/encoding/index.d.ts +21 -0
- package/dist/types/internal/fetch/consistency/origins.d.ts +179 -0
- package/dist/types/internal/fetch/index.d.ts +93 -0
- package/dist/types/internal/fetch/stream-state.d.ts +65 -0
- package/dist/types/internal/fs/index.d.ts +70 -0
- package/dist/types/internal/fs/node-adapter.d.ts +24 -0
- package/dist/types/internal/module-loader/bundle.d.ts +33 -0
- package/dist/types/internal/module-loader/index.d.ts +30 -0
- package/dist/types/internal/module-loader/mappings.d.ts +47 -0
- package/dist/types/internal/module-loader/resolve.d.ts +26 -0
- package/dist/types/internal/module-loader/strip-types.d.ts +19 -0
- package/dist/types/internal/path/index.d.ts +23 -0
- package/dist/types/internal/playwright/client.d.ts +7 -0
- package/dist/types/internal/playwright/handler.d.ts +44 -0
- package/dist/types/internal/playwright/index.d.ts +14 -0
- package/dist/types/internal/playwright/types.d.ts +145 -0
- package/dist/types/internal/protocol/codec.d.ts +242 -0
- package/dist/types/internal/protocol/framing.d.ts +89 -0
- package/dist/types/internal/protocol/index.d.ts +10 -0
- package/dist/types/internal/protocol/marshalValue.d.ts +79 -0
- package/dist/types/internal/protocol/serialization.d.ts +23 -0
- package/dist/types/internal/protocol/types.d.ts +996 -0
- package/dist/types/internal/runtime/index.d.ts +200 -0
- package/dist/types/internal/server/index.d.ts +42 -0
- package/dist/types/internal/test-environment/index.d.ts +112 -0
- package/dist/types/internal/timers/index.d.ts +22 -0
- package/dist/types/internal/transform/index.d.ts +36 -0
- package/dist/types/internal/typecheck/index.d.ts +7 -0
- package/dist/types/internal/typecheck/isolate-types.d.ts +94 -0
- package/dist/types/internal/typecheck/typecheck.d.ts +148 -0
- package/dist/types/modules/index.d.ts +2 -0
- package/dist/types/runtime/script-runtime.d.ts +6 -0
- package/dist/types/server/app-server.d.ts +3 -0
- package/dist/types/testing/integration-helpers.d.ts +9 -0
- package/dist/types/typecheck/index.d.ts +8 -0
- package/dist/types/types.d.ts +233 -0
- package/package.json +74 -6
- package/README.md +0 -45
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/module-loader/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport type {\n ModuleLoaderCallback,\n ModuleLoaderResult,\n} from \"../protocol/index.mjs\";\nimport {\n parseMappings,\n virtualToHost,\n findNodeModulesMapping,\n findModuleAlias,\n type MappingConfig,\n type PathMapping,\n} from \"./mappings.mjs\";\nimport {\n resolveFilePath,\n parseSpecifier,\n isBareSpecifier,\n} from \"./resolve.mjs\";\nimport { bundleSpecifier, bundleHostFile } from \"./bundle.mjs\";\nimport { isTypeScriptFile, processTypeScript } from \"./strip-types.mjs\";\n\nexport { parseMappings, virtualToHost, findNodeModulesMapping, findModuleAlias } from \"./mappings.mjs\";\nexport type { MappingConfig, PathMapping } from \"./mappings.mjs\";\nexport { resolveFilePath, detectFormat, parseSpecifier, isBareSpecifier } from \"./resolve.mjs\";\nexport { bundleSpecifier, bundleHostFile, clearBundleCache } from \"./bundle.mjs\";\nexport { isTypeScriptFile, processTypeScript } from \"./strip-types.mjs\";\n\n/**\n * Create a module loader callback that handles common patterns:\n * - Mapping host filesystem paths to virtual isolate paths\n * - Bundling npm packages with Rollup (ESM-first, browser conditions)\n * - Reading user files directly from the host filesystem\n *\n * Each npm package subpath is bundled independently and cached as static.\n *\n * @example\n * ```typescript\n * import { defaultModuleLoader } from './index.mjs';\n *\n * const loader = defaultModuleLoader(\n * { from: '/host/project/node_modules', to: '/node_modules' },\n * { from: '/host/project/src/entry.ts', to: '/app/entry.ts' }\n * );\n *\n * const runtime = await createRuntime({\n * moduleLoader: loader,\n * });\n * ```\n */\nexport function defaultModuleLoader(\n ...paths: MappingConfig[]\n): ModuleLoaderCallback {\n const mappings = parseMappings(paths);\n const nodeModulesMapping = findNodeModulesMapping(mappings);\n const importerHostPathByVirtualPath = new Map<string, string>();\n\n const loader: ModuleLoaderCallback = async (\n moduleName: string,\n importer: { path: string; resolveDir: string },\n ): Promise<ModuleLoaderResult> => {\n // A. Bare specifiers: module aliases or npm packages\n if (isBareSpecifier(moduleName)) {\n const alias = findModuleAlias(moduleName, mappings);\n if (alias) {\n return handleModuleAlias(alias, importerHostPathByVirtualPath);\n }\n return handleBareSpecifier(\n moduleName,\n importer,\n nodeModulesMapping,\n mappings,\n importerHostPathByVirtualPath,\n );\n }\n\n // B. Relative/absolute paths: user files or intra-package files\n return handlePathSpecifier(\n moduleName,\n importer,\n mappings,\n importerHostPathByVirtualPath,\n );\n };\n\n return loader;\n}\n\n/**\n * Handle bare specifiers (npm packages) by bundling with Rollup.\n */\nasync function handleBareSpecifier(\n specifier: string,\n importer: { path: string; resolveDir: string },\n nodeModulesMapping: PathMapping | undefined,\n mappings: PathMapping[],\n importerHostPathByVirtualPath: Map<string, string>,\n): Promise<ModuleLoaderResult> {\n if (!nodeModulesMapping) {\n throw new Error(\n `Cannot resolve bare specifier \"${specifier}\": no node_modules mapping configured. ` +\n `Add a mapping like { from: '/path/to/node_modules', to: '/node_modules' }.`\n );\n }\n\n const importerHostPath = resolveImporterHostPath(\n importer,\n mappings,\n importerHostPathByVirtualPath,\n );\n const fallbackImporterHostPath = path.join(\n path.dirname(nodeModulesMapping.hostBase),\n \"__isolate_module_loader__.js\",\n );\n const effectiveImporterHostPath = importerHostPath ?? fallbackImporterHostPath;\n const importerResolutionPath = toRealPath(effectiveImporterHostPath);\n const resolvedHostPath = resolveBareSpecifierWithNode(\n specifier,\n importerResolutionPath,\n );\n\n if (!resolvedHostPath) {\n throw new Error(\n `Cannot resolve bare specifier \"${specifier}\" from importer \"${importer.path}\" ` +\n `(host importer: ${effectiveImporterHostPath}).`\n );\n }\n\n const rootDir = path.dirname(importerResolutionPath);\n\n const { code } = await bundleSpecifier(specifier, rootDir);\n\n const { packageName, subpath } = parseSpecifier(specifier);\n const filename = subpath\n ? `${packageName}${subpath}.bundled.js`\n .split(\"/\")\n .pop()!\n : `${packageName}.bundled.js`\n .split(\"/\")\n .pop()!;\n\n const result: ModuleLoaderResult = {\n code,\n filename,\n resolveDir: nodeModulesMapping.virtualMount,\n static: true,\n };\n\n // Keep host importer context so transitive bare imports resolve like Node:\n // from the importing package location (realpath by default).\n registerImporterHostPath(result, toRealPath(resolvedHostPath), importerHostPathByVirtualPath);\n\n return result;\n}\n\n/**\n * Handle module alias specifiers by bundling the host file with Rollup.\n */\nasync function handleModuleAlias(\n alias: PathMapping,\n importerHostPathByVirtualPath: Map<string, string>,\n): Promise<ModuleLoaderResult> {\n const { code } = await bundleHostFile(alias.hostBase);\n\n // Sanitize the alias name into a filename (e.g. \"@/custom-module\" -> \"custom-module.bundled.js\")\n const filename = alias.to\n .replace(/^@[^/]*\\//, \"\") // strip scope prefix\n .replace(/[^a-zA-Z0-9_.-]/g, \"-\") // replace non-safe chars\n + \".bundled.js\";\n\n const result: ModuleLoaderResult = {\n code,\n filename,\n resolveDir: \"/\",\n };\n\n registerImporterHostPath(result, toRealPath(alias.hostBase), importerHostPathByVirtualPath);\n\n return result;\n}\n\n/**\n * Handle relative/absolute path specifiers by resolving to host files.\n */\nasync function handlePathSpecifier(\n specifier: string,\n importer: { path: string; resolveDir: string },\n mappings: PathMapping[],\n importerHostPathByVirtualPath: Map<string, string>,\n): Promise<ModuleLoaderResult> {\n // Resolve virtual path relative to importer's resolveDir\n let virtualPath: string;\n if (specifier.startsWith(\"/\")) {\n virtualPath = specifier;\n } else {\n virtualPath = path.posix.normalize(\n path.posix.join(importer.resolveDir, specifier)\n );\n }\n\n // Map virtual path -> host path\n const hostBasePath = virtualToHost(virtualPath, mappings);\n if (!hostBasePath) {\n throw new Error(\n `Cannot resolve \"${specifier}\" (virtual: ${virtualPath}): no mapping matches this path. ` +\n `Importer: ${importer.path}`\n );\n }\n\n // Probe extensions and index files\n const resolvedHostPath = resolveFilePath(hostBasePath);\n if (!resolvedHostPath) {\n throw new Error(\n `Cannot resolve \"${specifier}\" (host: ${hostBasePath}): file not found after extension probing. ` +\n `Importer: ${importer.path}`\n );\n }\n\n // Read the file\n let code = fs.readFileSync(resolvedHostPath, \"utf-8\");\n\n // Process TypeScript files: strip types, elide unused imports, add placeholders\n let resolvedFilename = path.basename(resolvedHostPath);\n if (isTypeScriptFile(resolvedHostPath)) {\n code = processTypeScript(code, resolvedHostPath);\n // Change extension to .js so V8 treats it as JavaScript\n resolvedFilename = resolvedFilename.replace(/\\.(tsx?|mts|cts)$/, \".js\");\n }\n // The host file may have a different name (due to extension probing), so rebuild virtual path\n const hostDir = path.dirname(resolvedHostPath);\n\n // Map the resolved host directory back to a virtual path for resolveDir\n // We need to find which mapping contains this host path\n let virtualDir: string | null = null;\n for (const mapping of mappings) {\n if (mapping.isGlob) {\n if (hostDir === mapping.hostBase || hostDir.startsWith(mapping.hostBase + \"/\")) {\n const relativePart = hostDir.slice(mapping.hostBase.length);\n virtualDir = mapping.virtualMount + relativePart;\n break;\n }\n } else {\n const mappedHostDir = path.dirname(mapping.hostBase);\n if (hostDir === mappedHostDir) {\n virtualDir = path.posix.dirname(mapping.virtualMount);\n break;\n }\n }\n }\n\n if (!virtualDir) {\n // Fallback: use the importer's resolveDir combined with the specifier's directory\n virtualDir = path.posix.dirname(virtualPath);\n }\n\n const result: ModuleLoaderResult = {\n code,\n filename: resolvedFilename,\n resolveDir: virtualDir,\n // User files are NOT static — they can change between evaluations\n };\n\n registerImporterHostPath(result, toRealPath(resolvedHostPath), importerHostPathByVirtualPath);\n\n return result;\n}\n\nfunction resolveImporterHostPath(\n importer: { path: string; resolveDir: string },\n mappings: PathMapping[],\n importerHostPathByVirtualPath: Map<string, string>,\n): string | null {\n const cached = importerHostPathByVirtualPath.get(importer.path);\n if (cached) {\n return cached;\n }\n\n const mappedHostPath = virtualToHost(importer.path, mappings);\n if (!mappedHostPath) {\n return null;\n }\n\n const resolvedMappedPath = resolveFilePath(mappedHostPath);\n if (resolvedMappedPath) {\n return resolvedMappedPath;\n }\n\n if (exists(mappedHostPath)) {\n return mappedHostPath;\n }\n\n return null;\n}\n\nfunction resolveBareSpecifierWithNode(\n specifier: string,\n importerHostPath: string,\n): string | null {\n try {\n const req = createRequire(importerHostPath);\n return req.resolve(specifier);\n } catch {\n return null;\n }\n}\n\nfunction registerImporterHostPath(\n moduleResult: ModuleLoaderResult,\n hostPath: string,\n importerHostPathByVirtualPath: Map<string, string>,\n): void {\n const virtualModulePath = path.posix.join(\n moduleResult.resolveDir,\n moduleResult.filename,\n );\n importerHostPathByVirtualPath.set(virtualModulePath, hostPath);\n}\n\nfunction toRealPath(inputPath: string): string {\n try {\n return fs.realpathSync(inputPath);\n } catch {\n return inputPath;\n }\n}\n\nfunction exists(filePath: string): boolean {\n try {\n fs.accessSync(filePath);\n return true;\n } catch {\n return false;\n }\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAAA;AACA;AACA;AAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AAAA;AAAA;AAAA;AAAA;AAK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gB;AAAA,IACnB,OAAO;AAAA,EACT;AAAA,EAEA,MAAM,qBAAqB,gBAAgB,cAAc;AAAA,EACzD,IAAI,oBAAoB;AAAA,IACtB,OAAO;AAAA,EACT;AAAA,EAEA,IAAI,OAAO,cAAc,GAAG;AAAA,IAC1B,OAAO;AAAA,EACT;AAAA,EAEA,OAAO;AAAA;AAGT,SAAS,4BAA4B,CACnC,WACA,kBACe;AAAA,EACf,IAAI;AAAA,IACF,MAAM,MAAM,cAAc,gBAAgB;AAAA,IAC1C,OAAO,IAAI,QAAQ,SAAS;AAAA,IAC5B,MAAM;AAAA,IACN,OAAO;AAAA;AAAA;AAIX,SAAS,wBAAwB,CAC/B,cACA,UACA,+BACM;AAAA,EACN,MAAM,oBAAoB,KAAK,MAAM,KACnC,aAAa,YACb,aAAa,QACf;AAAA,EACA,8BAA8B,IAAI,mBAAmB,QAAQ;AAAA;AAG/D,SAAS,UAAU,CAAC,WAA2B;AAAA,EAC7C,IAAI;AAAA,IACF,OAAO,GAAG,aAAa,SAAS;AAAA,IAChC,MAAM;AAAA,IACN,OAAO;AAAA;AAAA;AAIX,SAAS,MAAM,CAAC,UAA2B;AAAA,EACzC,IAAI;AAAA,IACF,GAAG,WAAW,QAAQ;AAAA,IACtB,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA;AAAA;",
|
|
8
|
+
"debugId": "703089DD6D245FDA64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// packages/isolate/src/internal/module-loader/mappings.ts
|
|
2
|
+
function parseMappings(configs) {
|
|
3
|
+
return configs.map((config) => {
|
|
4
|
+
const isGlob = config.from.includes("*");
|
|
5
|
+
const isModuleAlias = !config.to.startsWith("/");
|
|
6
|
+
if (isModuleAlias && isGlob) {
|
|
7
|
+
throw new Error(`Module alias "${config.to}" cannot use a glob pattern in "from" ("${config.from}"). ` + `Module aliases must map a single host file.`);
|
|
8
|
+
}
|
|
9
|
+
let hostBase;
|
|
10
|
+
if (isGlob) {
|
|
11
|
+
const parts = config.from.split("/");
|
|
12
|
+
const baseSegments = [];
|
|
13
|
+
for (const part of parts) {
|
|
14
|
+
if (part.includes("*"))
|
|
15
|
+
break;
|
|
16
|
+
baseSegments.push(part);
|
|
17
|
+
}
|
|
18
|
+
hostBase = baseSegments.join("/");
|
|
19
|
+
} else {
|
|
20
|
+
hostBase = config.from;
|
|
21
|
+
}
|
|
22
|
+
hostBase = hostBase.replace(/\/+$/, "");
|
|
23
|
+
const virtualMount = isModuleAlias ? config.to : config.to.replace(/\/+$/, "");
|
|
24
|
+
const isNodeModules = hostBase.endsWith("/node_modules") || hostBase === "node_modules";
|
|
25
|
+
return {
|
|
26
|
+
from: config.from,
|
|
27
|
+
to: config.to,
|
|
28
|
+
isGlob,
|
|
29
|
+
hostBase,
|
|
30
|
+
virtualMount,
|
|
31
|
+
isNodeModules,
|
|
32
|
+
isModuleAlias
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function virtualToHost(virtualPath, mappings) {
|
|
37
|
+
for (const mapping of mappings) {
|
|
38
|
+
if (mapping.isGlob) {
|
|
39
|
+
if (virtualPath === mapping.virtualMount || virtualPath.startsWith(mapping.virtualMount + "/")) {
|
|
40
|
+
const relativePart = virtualPath.slice(mapping.virtualMount.length);
|
|
41
|
+
return mapping.hostBase + relativePart;
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
if (virtualPath === mapping.virtualMount) {
|
|
45
|
+
return mapping.hostBase;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function hostToVirtual(hostPath, mappings) {
|
|
52
|
+
for (const mapping of mappings) {
|
|
53
|
+
if (mapping.isGlob) {
|
|
54
|
+
if (hostPath === mapping.hostBase || hostPath.startsWith(mapping.hostBase + "/")) {
|
|
55
|
+
const relativePart = hostPath.slice(mapping.hostBase.length);
|
|
56
|
+
return mapping.virtualMount + relativePart;
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
if (hostPath === mapping.hostBase) {
|
|
60
|
+
return mapping.virtualMount;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
function findNodeModulesMapping(mappings) {
|
|
67
|
+
return mappings.find((m) => m.isNodeModules);
|
|
68
|
+
}
|
|
69
|
+
function findModuleAlias(specifier, mappings) {
|
|
70
|
+
return mappings.find((m) => m.isModuleAlias && m.to === specifier);
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
virtualToHost,
|
|
74
|
+
parseMappings,
|
|
75
|
+
hostToVirtual,
|
|
76
|
+
findNodeModulesMapping,
|
|
77
|
+
findModuleAlias
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//# debugId=8539B8CCFEFCAF4C64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/module-loader/mappings.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import path from \"node:path\";\n\nexport interface PathMapping {\n /** Original 'from' path (host) */\n from: string;\n /** Original 'to' path (virtual) */\n to: string;\n /** Whether this is a glob pattern */\n isGlob: boolean;\n /** For globs: the base path before the glob (host-side) */\n hostBase: string;\n /** For globs: the virtual mount point */\n virtualMount: string;\n /** Whether the host base ends with node_modules */\n isNodeModules: boolean;\n /** Whether this mapping is a module alias (to doesn't start with '/') */\n isModuleAlias: boolean;\n}\n\nexport interface MappingConfig {\n from: string;\n to: string;\n}\n\n/**\n * Parse {from, to} pairs into structured PathMapping objects.\n *\n * - Glob patterns (contain `*`): extract base path before glob -> prefix mapping\n * - Direct file paths (no glob): 1:1 mapping\n * - Node modules detection: if base path ends with `node_modules`, flag as isNodeModules\n */\nexport function parseMappings(configs: MappingConfig[]): PathMapping[] {\n return configs.map((config) => {\n const isGlob = config.from.includes(\"*\");\n const isModuleAlias = !config.to.startsWith(\"/\");\n\n if (isModuleAlias && isGlob) {\n throw new Error(\n `Module alias \"${config.to}\" cannot use a glob pattern in \"from\" (\"${config.from}\"). ` +\n `Module aliases must map a single host file.`\n );\n }\n\n let hostBase: string;\n if (isGlob) {\n // Extract base path before the first glob segment\n const parts = config.from.split(\"/\");\n const baseSegments: string[] = [];\n for (const part of parts) {\n if (part.includes(\"*\")) break;\n baseSegments.push(part);\n }\n hostBase = baseSegments.join(\"/\");\n } else {\n hostBase = config.from;\n }\n\n // Normalize trailing slashes\n hostBase = hostBase.replace(/\\/+$/, \"\");\n const virtualMount = isModuleAlias ? config.to : config.to.replace(/\\/+$/, \"\");\n\n const isNodeModules = hostBase.endsWith(\"/node_modules\") || hostBase === \"node_modules\";\n\n return {\n from: config.from,\n to: config.to,\n isGlob,\n hostBase,\n virtualMount,\n isNodeModules,\n isModuleAlias,\n };\n });\n}\n\n/**\n * Map a virtual path to a host path using the configured mappings.\n * Returns null if no mapping matches.\n */\nexport function virtualToHost(virtualPath: string, mappings: PathMapping[]): string | null {\n for (const mapping of mappings) {\n if (mapping.isGlob) {\n // Prefix matching: virtual path must start with the virtual mount\n if (virtualPath === mapping.virtualMount || virtualPath.startsWith(mapping.virtualMount + \"/\")) {\n const relativePart = virtualPath.slice(mapping.virtualMount.length);\n return mapping.hostBase + relativePart;\n }\n } else {\n // Direct file mapping\n if (virtualPath === mapping.virtualMount) {\n return mapping.hostBase;\n }\n }\n }\n return null;\n}\n\n/**\n * Map a host path to a virtual path using the configured mappings.\n * Returns null if no mapping matches.\n */\nexport function hostToVirtual(hostPath: string, mappings: PathMapping[]): string | null {\n for (const mapping of mappings) {\n if (mapping.isGlob) {\n if (hostPath === mapping.hostBase || hostPath.startsWith(mapping.hostBase + \"/\")) {\n const relativePart = hostPath.slice(mapping.hostBase.length);\n return mapping.virtualMount + relativePart;\n }\n } else {\n if (hostPath === mapping.hostBase) {\n return mapping.virtualMount;\n }\n }\n }\n return null;\n}\n\n/**\n * Find the node_modules mapping (if any).\n */\nexport function findNodeModulesMapping(mappings: PathMapping[]): PathMapping | undefined {\n return mappings.find((m) => m.isNodeModules);\n}\n\n/**\n * Find a module alias mapping that matches the given bare specifier.\n * Returns undefined if no module alias matches.\n */\nexport function findModuleAlias(specifier: string, mappings: PathMapping[]): PathMapping | undefined {\n return mappings.find((m) => m.isModuleAlias && m.to === specifier);\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AA+BO,SAAS,aAAa,CAAC,SAAyC;AAAA,EACrE,OAAO,QAAQ,IAAI,CAAC,WAAW;AAAA,IAC7B,MAAM,SAAS,OAAO,KAAK,SAAS,GAAG;AAAA,IACvC,MAAM,gBAAgB,CAAC,OAAO,GAAG,WAAW,GAAG;AAAA,IAE/C,IAAI,iBAAiB,QAAQ;AAAA,MAC3B,MAAM,IAAI,MACR,iBAAiB,OAAO,6CAA6C,OAAO,aAC5E,6CACF;AAAA,IACF;AAAA,IAEA,IAAI;AAAA,IACJ,IAAI,QAAQ;AAAA,MAEV,MAAM,QAAQ,OAAO,KAAK,MAAM,GAAG;AAAA,MACnC,MAAM,eAAyB,CAAC;AAAA,MAChC,WAAW,QAAQ,OAAO;AAAA,QACxB,IAAI,KAAK,SAAS,GAAG;AAAA,UAAG;AAAA,QACxB,aAAa,KAAK,IAAI;AAAA,MACxB;AAAA,MACA,WAAW,aAAa,KAAK,GAAG;AAAA,IAClC,EAAO;AAAA,MACL,WAAW,OAAO;AAAA;AAAA,IAIpB,WAAW,SAAS,QAAQ,QAAQ,EAAE;AAAA,IACtC,MAAM,eAAe,gBAAgB,OAAO,KAAK,OAAO,GAAG,QAAQ,QAAQ,EAAE;AAAA,IAE7E,MAAM,gBAAgB,SAAS,SAAS,eAAe,KAAK,aAAa;AAAA,IAEzE,OAAO;AAAA,MACL,MAAM,OAAO;AAAA,MACb,IAAI,OAAO;AAAA,MACX;AAAA,MACA;AAAA,MACA;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ader/resolve.ts
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
var EXTENSIONS = [
|
|
5
|
+
".tsx",
|
|
6
|
+
".jsx",
|
|
7
|
+
".ts",
|
|
8
|
+
".mjs",
|
|
9
|
+
".js",
|
|
10
|
+
".cjs",
|
|
11
|
+
".json"
|
|
12
|
+
];
|
|
13
|
+
function resolveFilePath(basePath) {
|
|
14
|
+
if (isFile(basePath))
|
|
15
|
+
return basePath;
|
|
16
|
+
const dir = path.dirname(basePath);
|
|
17
|
+
const ext = path.extname(basePath);
|
|
18
|
+
const nameWithoutExt = path.basename(basePath, ext);
|
|
19
|
+
if (ext) {
|
|
20
|
+
const browserPath = path.join(dir, `${nameWithoutExt}.browser${ext}`);
|
|
21
|
+
if (isFile(browserPath))
|
|
22
|
+
return browserPath;
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
for (const probeExt of EXTENSIONS) {
|
|
26
|
+
const browserPath = path.join(dir, `${nameWithoutExt}.browser${probeExt}`);
|
|
27
|
+
if (isFile(browserPath))
|
|
28
|
+
return browserPath;
|
|
29
|
+
const probePath = basePath + probeExt;
|
|
30
|
+
if (isFile(probePath))
|
|
31
|
+
return probePath;
|
|
32
|
+
}
|
|
33
|
+
if (isDirectory(basePath)) {
|
|
34
|
+
for (const probeExt of EXTENSIONS) {
|
|
35
|
+
const browserIndex = path.join(basePath, `index.browser${probeExt}`);
|
|
36
|
+
if (isFile(browserIndex))
|
|
37
|
+
return browserIndex;
|
|
38
|
+
const indexPath = path.join(basePath, `index${probeExt}`);
|
|
39
|
+
if (isFile(indexPath))
|
|
40
|
+
return indexPath;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function detectFormat(filePath, code) {
|
|
46
|
+
const ext = path.extname(filePath);
|
|
47
|
+
if (ext === ".json")
|
|
48
|
+
return "json";
|
|
49
|
+
if (ext === ".cjs")
|
|
50
|
+
return "cjs";
|
|
51
|
+
if (ext === ".mjs")
|
|
52
|
+
return "esm";
|
|
53
|
+
if (hasESMSyntax(code))
|
|
54
|
+
return "esm";
|
|
55
|
+
if (hasCJSSyntax(code))
|
|
56
|
+
return "cjs";
|
|
57
|
+
return "esm";
|
|
58
|
+
}
|
|
59
|
+
function hasESMSyntax(code) {
|
|
60
|
+
return /\b(import\s+|export\s+(default\s+|{|const\s|let\s|var\s|function\s|class\s|async\s))/m.test(code);
|
|
61
|
+
}
|
|
62
|
+
function hasCJSSyntax(code) {
|
|
63
|
+
return /\b(module\.exports|exports\.\w+\s*=|require\s*\()/m.test(code);
|
|
64
|
+
}
|
|
65
|
+
function parseSpecifier(specifier) {
|
|
66
|
+
if (specifier.startsWith("@")) {
|
|
67
|
+
const slashIndex2 = specifier.indexOf("/");
|
|
68
|
+
if (slashIndex2 === -1) {
|
|
69
|
+
return { packageName: specifier, subpath: "" };
|
|
70
|
+
}
|
|
71
|
+
const secondSlash = specifier.indexOf("/", slashIndex2 + 1);
|
|
72
|
+
if (secondSlash === -1) {
|
|
73
|
+
return { packageName: specifier, subpath: "" };
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
packageName: specifier.slice(0, secondSlash),
|
|
77
|
+
subpath: specifier.slice(secondSlash)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const slashIndex = specifier.indexOf("/");
|
|
81
|
+
if (slashIndex === -1) {
|
|
82
|
+
return { packageName: specifier, subpath: "" };
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
packageName: specifier.slice(0, slashIndex),
|
|
86
|
+
subpath: specifier.slice(slashIndex)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function isBareSpecifier(specifier) {
|
|
90
|
+
return !specifier.startsWith(".") && !specifier.startsWith("/");
|
|
91
|
+
}
|
|
92
|
+
function isFile(p) {
|
|
93
|
+
try {
|
|
94
|
+
return fs.statSync(p).isFile();
|
|
95
|
+
} catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function isDirectory(p) {
|
|
100
|
+
try {
|
|
101
|
+
return fs.statSync(p).isDirectory();
|
|
102
|
+
} catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
resolveFilePath,
|
|
108
|
+
parseSpecifier,
|
|
109
|
+
isBareSpecifier,
|
|
110
|
+
detectFormat
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
//# debugId=7B11F9EF267E122A64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/module-loader/resolve.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import fs from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Extensions to probe for module resolution, in order of priority.\n */\nconst EXTENSIONS = [\n \".tsx\",\n \".jsx\",\n \".ts\",\n \".mjs\",\n \".js\",\n \".cjs\",\n \".json\",\n];\n\n/**\n * Resolve a file path with extension probing, index fallback, and browser variant probing.\n * Returns the resolved absolute path, or null if not found.\n */\nexport function resolveFilePath(basePath: string): string | null {\n // Try exact path first\n if (isFile(basePath)) return basePath;\n\n // Try browser variant (e.g., file.browser.ts before file.ts)\n const dir = path.dirname(basePath);\n const ext = path.extname(basePath);\n const nameWithoutExt = path.basename(basePath, ext);\n\n if (ext) {\n // Has extension — try browser variant\n const browserPath = path.join(dir, `${nameWithoutExt}.browser${ext}`);\n if (isFile(browserPath)) return browserPath;\n\n // Exact extension didn't work and file doesn't exist\n return null;\n }\n\n // No extension — probe extensions\n for (const probeExt of EXTENSIONS) {\n // Try browser variant first\n const browserPath = path.join(dir, `${nameWithoutExt}.browser${probeExt}`);\n if (isFile(browserPath)) return browserPath;\n\n const probePath = basePath + probeExt;\n if (isFile(probePath)) return probePath;\n }\n\n // Try as directory with index file\n if (isDirectory(basePath)) {\n for (const probeExt of EXTENSIONS) {\n const browserIndex = path.join(basePath, `index.browser${probeExt}`);\n if (isFile(browserIndex)) return browserIndex;\n\n const indexPath = path.join(basePath, `index${probeExt}`);\n if (isFile(indexPath)) return indexPath;\n }\n }\n\n return null;\n}\n\n/**\n * Detect the format of a file based on its extension and content.\n */\nexport function detectFormat(filePath: string, code: string): \"cjs\" | \"esm\" | \"json\" {\n const ext = path.extname(filePath);\n\n if (ext === \".json\") return \"json\";\n if (ext === \".cjs\") return \"cjs\";\n if (ext === \".mjs\") return \"esm\";\n\n // Heuristic: check for CJS patterns vs ESM patterns\n if (hasESMSyntax(code)) return \"esm\";\n if (hasCJSSyntax(code)) return \"cjs\";\n\n // Default to ESM\n return \"esm\";\n}\n\n/**\n * Check if code has ES module syntax.\n */\nfunction hasESMSyntax(code: string): boolean {\n // import ... from or export ...\n return /\\b(import\\s+|export\\s+(default\\s+|{|const\\s|let\\s|var\\s|function\\s|class\\s|async\\s))/m.test(code);\n}\n\n/**\n * Check if code has CommonJS syntax.\n */\nfunction hasCJSSyntax(code: string): boolean {\n return /\\b(module\\.exports|exports\\.\\w+\\s*=|require\\s*\\()/m.test(code);\n}\n\n/**\n * Parse a bare specifier into package name and subpath.\n *\n * Examples:\n * \"lodash\" -> { packageName: \"lodash\", subpath: \"\" }\n * \"lodash/chunk\" -> { packageName: \"lodash\", subpath: \"/chunk\" }\n * \"@scope/pkg\" -> { packageName: \"@scope/pkg\", subpath: \"\" }\n * \"@scope/pkg/sub/path\" -> { packageName: \"@scope/pkg\", subpath: \"/sub/path\" }\n */\nexport function parseSpecifier(specifier: string): { packageName: string; subpath: string } {\n if (specifier.startsWith(\"@\")) {\n // Scoped package: @scope/name or @scope/name/subpath\n const slashIndex = specifier.indexOf(\"/\");\n if (slashIndex === -1) {\n return { packageName: specifier, subpath: \"\" };\n }\n const secondSlash = specifier.indexOf(\"/\", slashIndex + 1);\n if (secondSlash === -1) {\n return { packageName: specifier, subpath: \"\" };\n }\n return {\n packageName: specifier.slice(0, secondSlash),\n subpath: specifier.slice(secondSlash),\n };\n }\n\n // Non-scoped: name or name/subpath\n const slashIndex = specifier.indexOf(\"/\");\n if (slashIndex === -1) {\n return { packageName: specifier, subpath: \"\" };\n }\n return {\n packageName: specifier.slice(0, slashIndex),\n subpath: specifier.slice(slashIndex),\n };\n}\n\n/**\n * Check if a specifier is a bare specifier (npm package name, not relative/absolute).\n */\nexport function isBareSpecifier(specifier: string): boolean {\n return !specifier.startsWith(\".\") && !specifier.startsWith(\"/\");\n}\n\nfunction isFile(p: string): boolean {\n try {\n return fs.statSync(p).isFile();\n } catch {\n return false;\n }\n}\n\nfunction isDirectory(p: string): boolean {\n try {\n return fs.statSync(p).isDirectory();\n } catch {\n return false;\n }\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAAA;AACA;AAKA,IAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAMO,SAAS,eAAe,CAAC,UAAiC;AAAA,EAE/D,IAAI,OAAO,QAAQ;AAAA,IAAG,OAAO;AAAA,EAG7B,MAAM,MAAM,KAAK,QAAQ,QAAQ;AAAA,EACjC,MAAM,MAAM,KAAK,QAAQ,QAAQ;AAAA,EACjC,MAAM,iBAAiB,KAAK,SAAS,UAAU,GAAG;AAAA,EAElD,IAAI,KAAK;AAAA,IAEP,MAAM,cAAc,KAAK,KAAK,KAAK,GAAG,yBAAyB,KAAK;AAAA,IACpE,IAAI,OAAO,WAAW;AAAA,MAAG,OAAO;AAAA,IAGhC,OAAO;AAAA,EACT;AAAA,EAGA,WAAW,YAAY,YAAY;AAAA,IAEjC,MAAM,cAAc,KAAK,KAAK,KAAK,GAAG,yBAAyB,UAAU;AAAA,IACzE,IAAI,OAAO,WAAW;AAAA,MAAG,OAAO;AAAA,IAEhC,MAAM,YAAY,WAAW;AAAA,IAC7B,IAAI,OAAO,SAAS;AAAA,MAAG,OAAO;AAAA,EAChC;AAAA,E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;AAAA,MAC3C,SAAS,UAAU,MAAM,WAAW;AAAA,IACtC;AAAA,EACF;AAAA,EAGA,MAAM,aAAa,UAAU,QAAQ,GAAG;AAAA,EACxC,IAAI,eAAe,IAAI;AAAA,IACrB,OAAO,EAAE,aAAa,WAAW,SAAS,GAAG;AAAA,EAC/C;AAAA,EACA,OAAO;AAAA,IACL,aAAa,UAAU,MAAM,GAAG,UAAU;AAAA,IAC1C,SAAS,UAAU,MAAM,UAAU;AAAA,EACrC;AAAA;AAMK,SAAS,eAAe,CAAC,WAA4B;AAAA,EAC1D,OAAO,CAAC,UAAU,WAAW,GAAG,KAAK,CAAC,UAAU,WAAW,GAAG;AAAA;AAGhE,SAAS,MAAM,CAAC,GAAoB;AAAA,EAClC,IAAI;AAAA,IACF,OAAO,GAAG,SAAS,CAAC,EAAE,OAAO;AAAA,IAC7B,MAAM;AAAA,IACN,OAAO;AAAA;AAAA;AAIX,SAAS,WAAW,CAAC,GAAoB;AAAA,EACvC,IAAI;AAAA,IACF,OAAO,GAAG,SAAS,CAAC,EAAE,YAAY;AAAA,IAClC,MAAM;AAAA,IACN,OAAO;AAAA;AAAA;",
|
|
8
|
+
"debugId": "7B11F9EF267E122A64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// packages/isolate/src/internal/module-loader/strip-types.ts
|
|
2
|
+
import Module from "node:module";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
var _stripTypeScriptTypes;
|
|
5
|
+
var bunTranspilerCache = {};
|
|
6
|
+
function getStripTypeScriptTypes() {
|
|
7
|
+
const strip = Module.stripTypeScriptTypes;
|
|
8
|
+
if (typeof strip !== "function") {
|
|
9
|
+
_stripTypeScriptTypes = undefined;
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (_stripTypeScriptTypes !== strip) {
|
|
13
|
+
_stripTypeScriptTypes = strip;
|
|
14
|
+
}
|
|
15
|
+
return _stripTypeScriptTypes;
|
|
16
|
+
}
|
|
17
|
+
function getBunTranspiler(loader) {
|
|
18
|
+
const cached = bunTranspilerCache[loader];
|
|
19
|
+
if (cached)
|
|
20
|
+
return cached;
|
|
21
|
+
const bunGlobal = globalThis.Bun;
|
|
22
|
+
if (!bunGlobal?.Transpiler) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const transpiler = new bunGlobal.Transpiler({ loader });
|
|
26
|
+
bunTranspilerCache[loader] = transpiler;
|
|
27
|
+
return transpiler;
|
|
28
|
+
}
|
|
29
|
+
function transpileWithBunFallback(code, filename) {
|
|
30
|
+
const loader = path.extname(filename) === ".tsx" ? "tsx" : "ts";
|
|
31
|
+
const transpiler = getBunTranspiler(loader);
|
|
32
|
+
if (!transpiler) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return transpiler.transformSync(code, { loader });
|
|
36
|
+
}
|
|
37
|
+
var TS_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
38
|
+
function isTypeScriptFile(filePath) {
|
|
39
|
+
return TS_EXTENSIONS.has(path.extname(filePath));
|
|
40
|
+
}
|
|
41
|
+
function processTypeScript(code, filename) {
|
|
42
|
+
const typeExportNames = findTypeOnlyExports(code);
|
|
43
|
+
const stripTypes = getStripTypeScriptTypes();
|
|
44
|
+
let stripped;
|
|
45
|
+
if (stripTypes) {
|
|
46
|
+
try {
|
|
47
|
+
stripped = stripTypes(code, {
|
|
48
|
+
mode: "transform",
|
|
49
|
+
sourceMap: false
|
|
50
|
+
});
|
|
51
|
+
} catch {
|
|
52
|
+
stripped = stripTypes(code, {
|
|
53
|
+
mode: "strip"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
const bunTranspiled = transpileWithBunFallback(code, filename);
|
|
58
|
+
if (bunTranspiled === null) {
|
|
59
|
+
throw new Error("TypeScript processing is unavailable in this runtime. " + "Requires Node.js >= 22.7.0 (Module.stripTypeScriptTypes) " + "or Bun.Transpiler.");
|
|
60
|
+
}
|
|
61
|
+
stripped = bunTranspiled;
|
|
62
|
+
}
|
|
63
|
+
stripped = elideUnusedImports(stripped);
|
|
64
|
+
if (typeExportNames.length > 0) {
|
|
65
|
+
const needsPlaceholder = typeExportNames.filter((name) => !isValueExported(name, stripped));
|
|
66
|
+
if (needsPlaceholder.length > 0) {
|
|
67
|
+
const vars = needsPlaceholder.map((n) => `var ${n} = undefined;`).join(" ");
|
|
68
|
+
stripped += `
|
|
69
|
+
` + vars + `
|
|
70
|
+
export { ` + needsPlaceholder.join(", ") + ` };
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return stripped;
|
|
75
|
+
}
|
|
76
|
+
var NAMED_IMPORT_RE = /import\s+([\w$]+\s*,\s*)?\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"];?/g;
|
|
77
|
+
function getImportedLocalName(specifier) {
|
|
78
|
+
const trimmed = specifier.trim();
|
|
79
|
+
const asMatch = trimmed.match(/^(.+?)\s+as\s+([A-Za-z_$][\w$]*)$/);
|
|
80
|
+
return asMatch ? asMatch[2] : trimmed;
|
|
81
|
+
}
|
|
82
|
+
function createImportedNameReferenceRegex(localName) {
|
|
83
|
+
const escaped = escapeRegExp(localName);
|
|
84
|
+
return new RegExp(`(?<![\\w$])${escaped}(?![\\w$])`);
|
|
85
|
+
}
|
|
86
|
+
function elideUnusedImports(code) {
|
|
87
|
+
const entries = [];
|
|
88
|
+
NAMED_IMPORT_RE.lastIndex = 0;
|
|
89
|
+
let m;
|
|
90
|
+
while ((m = NAMED_IMPORT_RE.exec(code)) !== null) {
|
|
91
|
+
entries.push({
|
|
92
|
+
fullMatch: m[0],
|
|
93
|
+
start: m.index,
|
|
94
|
+
end: m.index + m[0].length,
|
|
95
|
+
defaultPart: m[1] ?? "",
|
|
96
|
+
specifiers: m[2].split(",").map((s) => s.trim()).filter((s) => s.length > 0),
|
|
97
|
+
modulePath: m[3]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (entries.length === 0)
|
|
101
|
+
return code;
|
|
102
|
+
let body = code;
|
|
103
|
+
for (let i = entries.length - 1;i >= 0; i--) {
|
|
104
|
+
const { start, end } = entries[i];
|
|
105
|
+
body = body.slice(0, start) + " ".repeat(end - start) + body.slice(end);
|
|
106
|
+
}
|
|
107
|
+
let result = code;
|
|
108
|
+
for (let i = entries.length - 1;i >= 0; i--) {
|
|
109
|
+
const entry = entries[i];
|
|
110
|
+
const kept = [];
|
|
111
|
+
for (const spec of entry.specifiers) {
|
|
112
|
+
const localName = getImportedLocalName(spec);
|
|
113
|
+
if (createImportedNameReferenceRegex(localName).test(body)) {
|
|
114
|
+
kept.push(spec);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (kept.length === entry.specifiers.length)
|
|
118
|
+
continue;
|
|
119
|
+
let replacement;
|
|
120
|
+
if (kept.length === 0 && !entry.defaultPart) {
|
|
121
|
+
replacement = "";
|
|
122
|
+
} else if (kept.length === 0) {
|
|
123
|
+
const def = entry.defaultPart.replace(/\s*,\s*$/, "").trim();
|
|
124
|
+
replacement = `import ${def} from '${entry.modulePath}';`;
|
|
125
|
+
} else {
|
|
126
|
+
replacement = `import ${entry.defaultPart}{ ${kept.join(", ")} } from '${entry.modulePath}';`;
|
|
127
|
+
}
|
|
128
|
+
result = result.slice(0, entry.start) + replacement + result.slice(entry.end);
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
function findTypeOnlyExports(code) {
|
|
133
|
+
const names = new Set;
|
|
134
|
+
let m;
|
|
135
|
+
const iface = /\bexport\s+interface\s+(\w+)/g;
|
|
136
|
+
while ((m = iface.exec(code)) !== null)
|
|
137
|
+
names.add(m[1]);
|
|
138
|
+
const alias = /\bexport\s+type\s+(\w+)\s*[=<]/g;
|
|
139
|
+
while ((m = alias.exec(code)) !== null)
|
|
140
|
+
names.add(m[1]);
|
|
141
|
+
const reExport = /\bexport\s+type\s*\{([^}]+)\}/g;
|
|
142
|
+
while ((m = reExport.exec(code)) !== null) {
|
|
143
|
+
for (const item of m[1].split(",")) {
|
|
144
|
+
const trimmed = item.trim();
|
|
145
|
+
const asMatch = trimmed.match(/\w+\s+as\s+(\w+)/);
|
|
146
|
+
if (asMatch)
|
|
147
|
+
names.add(asMatch[1]);
|
|
148
|
+
else if (/^\w+$/.test(trimmed))
|
|
149
|
+
names.add(trimmed);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return [...names];
|
|
153
|
+
}
|
|
154
|
+
function isValueExported(name, code) {
|
|
155
|
+
const e = escapeRegExp(name);
|
|
156
|
+
if (new RegExp(`\\bexport\\s+(?:var|let|const|function|class|async\\s+function)\\s+${e}\\b`).test(code))
|
|
157
|
+
return true;
|
|
158
|
+
if (new RegExp(`\\bexport\\s*\\{[^}]*\\b${e}\\b[^}]*\\}`).test(code))
|
|
159
|
+
return true;
|
|
160
|
+
if (name === "default" && /\bexport\s+default\b/.test(code))
|
|
161
|
+
return true;
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
function escapeRegExp(s) {
|
|
165
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
processTypeScript,
|
|
169
|
+
isTypeScriptFile
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
//# debugId=B176F605C44FE67E64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/module-loader/strip-types.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import Module from \"node:module\";\nimport path from \"node:path\";\n\ntype StripTypeScriptTypesFn = NonNullable<typeof Module.stripTypeScriptTypes>;\ntype TsLoader = \"ts\" | \"tsx\";\ntype BunTranspilerLike = {\n transformSync(code: string, options?: { loader?: TsLoader }): string;\n};\ntype BunGlobalLike = {\n Transpiler?: new (options: { loader: TsLoader }) => BunTranspilerLike;\n};\n\nlet _stripTypeScriptTypes: StripTypeScriptTypesFn | undefined;\nconst bunTranspilerCache: Partial<Record<TsLoader, BunTranspilerLike>> = {};\n\nfunction getStripTypeScriptTypes(): StripTypeScriptTypesFn | undefined {\n const strip = Module.stripTypeScriptTypes;\n if (typeof strip !== \"function\") {\n _stripTypeScriptTypes = undefined;\n return undefined;\n }\n\n if (_stripTypeScriptTypes !== strip) {\n _stripTypeScriptTypes = strip;\n }\n\n return _stripTypeScriptTypes;\n}\n\nfunction getBunTranspiler(loader: TsLoader): BunTranspilerLike | undefined {\n const cached = bunTranspilerCache[loader];\n if (cached) return cached;\n\n const bunGlobal = (globalThis as { Bun?: BunGlobalLike }).Bun;\n if (!bunGlobal?.Transpiler) {\n return undefined;\n }\n\n const transpiler = new bunGlobal.Transpiler({ loader });\n bunTranspilerCache[loader] = transpiler;\n return transpiler;\n}\n\nfunction transpileWithBunFallback(code: string, filename: string): string | null {\n const loader: TsLoader = path.extname(filename) === \".tsx\" ? \"tsx\" : \"ts\";\n const transpiler = getBunTranspiler(loader);\n if (!transpiler) {\n return null;\n }\n\n return transpiler.transformSync(code, { loader });\n}\n\nconst TS_EXTENSIONS = new Set([\".ts\", \".tsx\", \".mts\", \".cts\"]);\n\n/**\n * Check if a file path is a TypeScript file that needs type processing.\n */\nexport function isTypeScriptFile(filePath: string): boolean {\n return TS_EXTENSIONS.has(path.extname(filePath));\n}\n\n/**\n * Process a TypeScript file for isolate use:\n *\n * 1. Strip TypeScript types\n * 2. Elide import specifiers no longer referenced in the code body\n * (handles: `import { SomeType } from 'pkg'` where SomeType was only\n * used in type positions — the import survives stripping but the\n * usage doesn't, so V8 demands an export that doesn't exist in the bundle)\n * 3. Add placeholder exports for type-only export names\n * (handles: `export interface Foo {}` disappears after stripping,\n * but other files may `import { Foo }` from this module)\n *\n * Returns valid JavaScript.\n */\nexport function processTypeScript(code: string, filename: string): string {\n // Find type-only export names BEFORE stripping\n const typeExportNames = findTypeOnlyExports(code);\n\n // Prefer Node's native strip API when available.\n // Fall back to Bun.Transpiler for Bun-hosted callbacks.\n const stripTypes = getStripTypeScriptTypes();\n let stripped: string;\n if (stripTypes) {\n try {\n stripped = stripTypes(code, {\n mode: \"transform\",\n sourceMap: false,\n });\n } catch {\n stripped = stripTypes(code, {\n mode: \"strip\",\n });\n }\n } else {\n const bunTranspiled = transpileWithBunFallback(code, filename);\n if (bunTranspiled === null) {\n throw new Error(\n \"TypeScript processing is unavailable in this runtime. \" +\n \"Requires Node.js >= 22.7.0 (Module.stripTypeScriptTypes) \" +\n \"or Bun.Transpiler.\"\n );\n }\n stripped = bunTranspiled;\n }\n\n // Elide unused import specifiers\n stripped = elideUnusedImports(stripped);\n\n // Add placeholder exports for type-only names not already value-exported\n if (typeExportNames.length > 0) {\n const needsPlaceholder = typeExportNames.filter(\n (name) => !isValueExported(name, stripped),\n );\n if (needsPlaceholder.length > 0) {\n const vars = needsPlaceholder.map((n) => `var ${n} = undefined;`).join(\" \");\n stripped += \"\\n\" + vars + \"\\nexport { \" + needsPlaceholder.join(\", \") + \" };\\n\";\n }\n }\n\n return stripped;\n}\n\n// ─── Import elision ──────────────────────────────────────────────────────────\n\n/**\n * Named import regex (handles single-line and multi-line).\n * Captures: [1] optional default part, [2] specifier list, [3] module path\n */\nconst NAMED_IMPORT_RE =\n /import\\s+([\\w$]+\\s*,\\s*)?\\{([\\s\\S]*?)\\}\\s*from\\s*['\"]([^'\"]+)['\"];?/g;\n\nfunction getImportedLocalName(specifier: string): string {\n const trimmed = specifier.trim();\n const asMatch = trimmed.match(/^(.+?)\\s+as\\s+([A-Za-z_$][\\w$]*)$/);\n return asMatch ? asMatch[2]! : trimmed;\n}\n\nfunction createImportedNameReferenceRegex(localName: string): RegExp {\n const escaped = escapeRegExp(localName);\n return new RegExp(`(?<![\\\\w$])${escaped}(?![\\\\w$])`);\n}\n\n/**\n * After type stripping, imported names that were only used in type positions\n * are unreferenced in the code body. Remove them from import statements\n * so V8's module linker doesn't demand them from the resolved module.\n */\nfunction elideUnusedImports(code: string): string {\n // Collect all named-import regions\n const entries: Array<{\n fullMatch: string;\n start: number;\n end: number;\n defaultPart: string;\n specifiers: string[];\n modulePath: string;\n }> = [];\n\n NAMED_IMPORT_RE.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = NAMED_IMPORT_RE.exec(code)) !== null) {\n entries.push({\n fullMatch: m[0],\n start: m.index,\n end: m.index + m[0].length,\n defaultPart: m[1] ?? \"\",\n specifiers: m[2]!\n .split(\",\")\n .map((s) => s.trim())\n .filter((s) => s.length > 0),\n modulePath: m[3]!,\n });\n }\n\n if (entries.length === 0) return code;\n\n // Build \"body\" = code with all import declarations blanked out\n let body = code;\n for (let i = entries.length - 1; i >= 0; i--) {\n const { start, end } = entries[i]!;\n body = body.slice(0, start) + \" \".repeat(end - start) + body.slice(end);\n }\n\n // Process imports in reverse order to preserve string indices\n let result = code;\n for (let i = entries.length - 1; i >= 0; i--) {\n const entry = entries[i]!;\n const kept: string[] = [];\n\n for (const spec of entry.specifiers) {\n // \"A as B\" → local name is B; \"A\" → local name is A\n const localName = getImportedLocalName(spec);\n\n // Keep if referenced anywhere in the body as a whole word\n if (createImportedNameReferenceRegex(localName).test(body)) {\n kept.push(spec);\n }\n }\n\n // Nothing changed for this import\n if (kept.length === entry.specifiers.length) continue;\n\n let replacement: string;\n if (kept.length === 0 && !entry.defaultPart) {\n // All named specifiers gone, no default → remove entire import\n replacement = \"\";\n } else if (kept.length === 0) {\n // Default import survives, named specifiers all gone\n const def = entry.defaultPart.replace(/\\s*,\\s*$/, \"\").trim();\n replacement = `import ${def} from '${entry.modulePath}';`;\n } else {\n replacement = `import ${entry.defaultPart}{ ${kept.join(\", \")} } from '${entry.modulePath}';`;\n }\n\n result = result.slice(0, entry.start) + replacement + result.slice(entry.end);\n }\n\n return result;\n}\n\n// ─── Type-only export placeholders ───────────────────────────────────────────\n\n/**\n * Find export names that are type-only (will vanish after stripping).\n */\nfunction findTypeOnlyExports(code: string): string[] {\n const names = new Set<string>();\n let m: RegExpExecArray | null;\n\n // export interface Name / export interface Name<T>\n const iface = /\\bexport\\s+interface\\s+(\\w+)/g;\n while ((m = iface.exec(code)) !== null) names.add(m[1]!);\n\n // export type Name = ... / export type Name<T> = ...\n // (but NOT `export type { ... }`)\n const alias = /\\bexport\\s+type\\s+(\\w+)\\s*[=<]/g;\n while ((m = alias.exec(code)) !== null) names.add(m[1]!);\n\n // export type { A, B } / export type { A } from './mod.mjs'\n const reExport = /\\bexport\\s+type\\s*\\{([^}]+)\\}/g;\n while ((m = reExport.exec(code)) !== null) {\n for (const item of m[1]!.split(\",\")) {\n const trimmed = item.trim();\n const asMatch = trimmed.match(/\\w+\\s+as\\s+(\\w+)/);\n if (asMatch) names.add(asMatch[1]!);\n else if (/^\\w+$/.test(trimmed)) names.add(trimmed);\n }\n }\n\n return [...names];\n}\n\n/**\n * Check if a name is still exported as a runtime value in the stripped code.\n */\nfunction isValueExported(name: string, code: string): boolean {\n const e = escapeRegExp(name);\n if (new RegExp(`\\\\bexport\\\\s+(?:var|let|const|function|class|async\\\\s+function)\\\\s+${e}\\\\b`).test(code)) return true;\n if (new RegExp(`\\\\bexport\\\\s*\\\\{[^}]*\\\\b${e}\\\\b[^}]*\\\\}`).test(code)) return true;\n if (name === \"default\" && /\\bexport\\s+default\\b/.test(code)) return true;\n return false;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAAA;AACA;AAWA,IAAI;AACJ,IAAM,qBAAmE,CAAC;AAE1E,SAAS,uBAAuB,GAAuC;AAAA,EACrE,MAAM,QAAQ,OAAO;AAAA,EACrB,IAAI,OAAO,UAAU,YAAY;AAAA,IAC/B,wBAAwB;AAAA,IACxB;AAAA,EACF;AAAA,EAEA,IAAI,0BAA0B,OAAO;AAAA,IACnC,wBAAwB;AAA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