sandlot 0.1.4 → 0.2.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.
Files changed (115) hide show
  1. package/dist/browser/bundler.d.ts +68 -0
  2. package/dist/browser/bundler.d.ts.map +1 -0
  3. package/dist/browser/executor.d.ts +46 -0
  4. package/dist/browser/executor.d.ts.map +1 -0
  5. package/dist/browser/index.d.ts +9 -0
  6. package/dist/browser/index.d.ts.map +1 -0
  7. package/dist/browser/index.js +2692 -0
  8. package/dist/browser/preset.d.ts +63 -0
  9. package/dist/browser/preset.d.ts.map +1 -0
  10. package/dist/commands/index.d.ts +20 -11
  11. package/dist/commands/index.d.ts.map +1 -1
  12. package/dist/commands/types.d.ts +31 -132
  13. package/dist/commands/types.d.ts.map +1 -1
  14. package/dist/core/bundler-utils.d.ts +142 -0
  15. package/dist/core/bundler-utils.d.ts.map +1 -0
  16. package/dist/core/esm-types-resolver.d.ts +125 -0
  17. package/dist/core/esm-types-resolver.d.ts.map +1 -0
  18. package/dist/core/executor.d.ts +35 -0
  19. package/dist/core/executor.d.ts.map +1 -0
  20. package/dist/{fs.d.ts → core/fs.d.ts} +27 -29
  21. package/dist/core/fs.d.ts.map +1 -0
  22. package/dist/core/sandbox.d.ts +30 -0
  23. package/dist/core/sandbox.d.ts.map +1 -0
  24. package/dist/core/sandlot.d.ts +30 -0
  25. package/dist/core/sandlot.d.ts.map +1 -0
  26. package/dist/core/shared-module-registry.d.ts +46 -0
  27. package/dist/core/shared-module-registry.d.ts.map +1 -0
  28. package/dist/core/typechecker.d.ts +60 -0
  29. package/dist/core/typechecker.d.ts.map +1 -0
  30. package/dist/index.d.ts +11 -16
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +1399 -2010
  33. package/dist/node/bundler.d.ts +48 -0
  34. package/dist/node/bundler.d.ts.map +1 -0
  35. package/dist/node/executor.d.ts +48 -0
  36. package/dist/node/executor.d.ts.map +1 -0
  37. package/dist/node/index.d.ts +9 -0
  38. package/dist/node/index.d.ts.map +1 -0
  39. package/dist/node/index.js +2646 -0
  40. package/dist/node/preset.d.ts +62 -0
  41. package/dist/node/preset.d.ts.map +1 -0
  42. package/dist/types.d.ts +525 -0
  43. package/dist/types.d.ts.map +1 -0
  44. package/package.json +16 -6
  45. package/src/browser/bundler.ts +294 -0
  46. package/src/browser/executor.ts +71 -0
  47. package/src/browser/index.ts +57 -0
  48. package/src/browser/preset.ts +179 -0
  49. package/src/commands/index.ts +526 -43
  50. package/src/commands/types.ts +82 -146
  51. package/src/core/bundler-utils.ts +630 -0
  52. package/src/core/esm-types-resolver.ts +432 -0
  53. package/src/core/executor.ts +161 -0
  54. package/src/{fs.ts → core/fs.ts} +59 -37
  55. package/src/core/sandbox.ts +621 -0
  56. package/src/core/sandlot.ts +77 -0
  57. package/src/core/shared-module-registry.ts +138 -0
  58. package/src/core/typechecker.ts +607 -0
  59. package/src/index.ts +104 -139
  60. package/src/node/bundler.ts +194 -0
  61. package/src/node/executor.ts +87 -0
  62. package/src/node/index.ts +39 -0
  63. package/src/node/preset.ts +178 -0
  64. package/src/types.ts +668 -0
  65. package/README.md +0 -243
  66. package/dist/build-emitter.d.ts +0 -47
  67. package/dist/build-emitter.d.ts.map +0 -1
  68. package/dist/builder.d.ts +0 -370
  69. package/dist/builder.d.ts.map +0 -1
  70. package/dist/bundler.d.ts +0 -152
  71. package/dist/bundler.d.ts.map +0 -1
  72. package/dist/commands/compile.d.ts +0 -13
  73. package/dist/commands/compile.d.ts.map +0 -1
  74. package/dist/commands/packages.d.ts +0 -17
  75. package/dist/commands/packages.d.ts.map +0 -1
  76. package/dist/commands/run.d.ts +0 -40
  77. package/dist/commands/run.d.ts.map +0 -1
  78. package/dist/commands.d.ts +0 -179
  79. package/dist/commands.d.ts.map +0 -1
  80. package/dist/fs.d.ts.map +0 -1
  81. package/dist/internal.d.ts +0 -79
  82. package/dist/internal.d.ts.map +0 -1
  83. package/dist/internal.js +0 -1942
  84. package/dist/loader.d.ts +0 -164
  85. package/dist/loader.d.ts.map +0 -1
  86. package/dist/packages.d.ts +0 -199
  87. package/dist/packages.d.ts.map +0 -1
  88. package/dist/runner.d.ts +0 -314
  89. package/dist/runner.d.ts.map +0 -1
  90. package/dist/sandbox-manager.d.ts +0 -261
  91. package/dist/sandbox-manager.d.ts.map +0 -1
  92. package/dist/sandbox.d.ts +0 -267
  93. package/dist/sandbox.d.ts.map +0 -1
  94. package/dist/shared-modules.d.ts +0 -148
  95. package/dist/shared-modules.d.ts.map +0 -1
  96. package/dist/shared-resources.d.ts +0 -102
  97. package/dist/shared-resources.d.ts.map +0 -1
  98. package/dist/ts-libs.d.ts +0 -85
  99. package/dist/ts-libs.d.ts.map +0 -1
  100. package/dist/typechecker.d.ts +0 -127
  101. package/dist/typechecker.d.ts.map +0 -1
  102. package/src/build-emitter.ts +0 -64
  103. package/src/builder.ts +0 -498
  104. package/src/bundler.ts +0 -575
  105. package/src/commands/compile.ts +0 -236
  106. package/src/commands/packages.ts +0 -154
  107. package/src/commands/run.ts +0 -245
  108. package/src/internal.ts +0 -119
  109. package/src/loader.ts +0 -229
  110. package/src/packages.ts +0 -936
  111. package/src/sandbox.ts +0 -398
  112. package/src/shared-modules.ts +0 -280
  113. package/src/shared-resources.ts +0 -166
  114. package/src/ts-libs.ts +0 -218
  115. package/src/typechecker.ts +0 -635
package/src/index.ts CHANGED
@@ -1,171 +1,136 @@
1
1
  // =============================================================================
2
- // Browser polyfills - inject before anything else loads
2
+ // Sandlot v2 - Core Entry Point
3
3
  // =============================================================================
4
-
5
- // Some dependencies (like just-bash) reference Node.js globals.
6
- // Provide shims so they work in the browser without user configuration.
7
- if (typeof window !== "undefined" && typeof globalThis.process === "undefined") {
8
- (globalThis as Record<string, unknown>).process = {
9
- env: {},
10
- platform: "browser",
11
- version: "v20.0.0",
12
- browser: true,
13
- cwd: () => "/",
14
- nextTick: (fn: () => void) => setTimeout(fn, 0),
15
- };
16
- }
17
-
18
- // =============================================================================
19
- // CORE API - Most users only need these
4
+ //
5
+ // This module exports the core interfaces and factory function.
6
+ // It is context-agnostic - no browser or Node.js specific code.
7
+ //
8
+ // For context-specific implementations, import from:
9
+ // - "sandlot/browser" - Browser implementations (esbuild-wasm, etc.)
10
+ // - "sandlot/node" - Node/Bun implementations (native esbuild, etc.)
11
+ //
20
12
  // =============================================================================
21
13
 
22
14
  // -----------------------------------------------------------------------------
23
- // Sandbox API
24
- // -----------------------------------------------------------------------------
25
-
26
- export {
27
- createSandbox,
28
- type Sandbox,
29
- type SandboxOptions,
30
- type SandboxState,
31
- type SandboxBashOptions,
32
- } from "./sandbox";
33
-
34
- // -----------------------------------------------------------------------------
35
- // Builder (recommended for agent workflows)
15
+ // Factory Function
36
16
  // -----------------------------------------------------------------------------
37
17
 
38
- export {
39
- createBuilder,
40
- type BuildResult,
41
- type CreateBuilderOptions,
42
- type BuildCallOptions,
43
- type BuilderFn,
44
- } from "./builder";
18
+ export { createSandlot } from "./core/sandlot";
45
19
 
46
20
  // -----------------------------------------------------------------------------
47
- // Module Loading (use after build to get exports)
21
+ // Filesystem
48
22
  // -----------------------------------------------------------------------------
49
23
 
50
24
  export {
51
- loadModule,
52
- loadExport,
53
- loadDefault,
54
- getExportNames,
55
- hasExport,
56
- ModuleLoadError,
57
- ExportNotFoundError,
58
- } from "./loader";
59
-
60
- // -----------------------------------------------------------------------------
61
- // Shared Modules (for React/library sharing with host)
62
- // -----------------------------------------------------------------------------
63
-
64
- export {
65
- registerSharedModules,
66
- unregisterSharedModule,
67
- clearSharedModules,
68
- } from "./shared-modules";
69
-
70
- // -----------------------------------------------------------------------------
71
- // Common Types
72
- // -----------------------------------------------------------------------------
73
-
74
- export type { BundleResult } from "./bundler";
75
- export type { BuildOutput, ValidateFn } from "./commands/types";
76
- export type { TypecheckResult, Diagnostic } from "./typechecker";
77
- export type { PackageManifest, InstallResult } from "./packages";
78
-
79
-
80
- // =============================================================================
81
- // ADVANCED API - For power users and custom integrations
82
- // =============================================================================
25
+ Filesystem,
26
+ createFilesystem,
27
+ wrapFilesystemForJustBash,
28
+ } from "./core/fs";
29
+ export type { FilesystemOptions } from "./core/fs";
83
30
 
84
31
  // -----------------------------------------------------------------------------
85
- // Direct Bundler Access
32
+ // Shared Module Registry
86
33
  // -----------------------------------------------------------------------------
87
34
 
88
35
  export {
89
- initBundler,
90
- bundle,
91
- bundleToUrl,
92
- bundleAndImport,
93
- type BundleOptions,
94
- type NpmImportsMode,
95
- } from "./bundler";
36
+ SharedModuleRegistry,
37
+ createSharedModuleRegistry,
38
+ } from "./core/shared-module-registry";
96
39
 
97
40
  // -----------------------------------------------------------------------------
98
- // Direct Typechecker Access
41
+ // Commands (for extending the shell with custom commands)
99
42
  // -----------------------------------------------------------------------------
100
43
 
101
44
  export {
102
- typecheck,
45
+ createSandlotCommand,
46
+ createDefaultCommands,
47
+ formatSize,
103
48
  formatDiagnostics,
104
- formatDiagnosticsForAgent,
105
- type TypecheckOptions,
106
- } from "./typechecker";
107
-
108
- // -----------------------------------------------------------------------------
109
- // Package Management
110
- // -----------------------------------------------------------------------------
111
-
112
- export {
113
- installPackage,
114
- uninstallPackage,
115
- listPackages,
116
- getPackageManifest,
117
- type InstallOptions,
118
- } from "./packages";
119
-
120
- // -----------------------------------------------------------------------------
121
- // Shared Resources (for custom resource management)
122
- // -----------------------------------------------------------------------------
123
-
124
- export {
125
- createSharedResources,
126
- getDefaultResources,
127
- clearDefaultResources,
128
- hasDefaultResources,
129
- type SharedResourcesOptions,
130
- type SharedResources,
131
- type TypesCache,
132
- } from "./shared-resources";
49
+ formatBundleErrors,
50
+ } from "./commands";
51
+ export type { SandboxRef } from "./commands";
133
52
 
134
53
  // -----------------------------------------------------------------------------
135
- // Filesystem (for custom VFS usage)
54
+ // Typechecker (platform-independent, fetches TS libs from CDN)
136
55
  // -----------------------------------------------------------------------------
137
56
 
138
- export {
139
- Filesystem,
140
- createFilesystem,
141
- type FilesystemOptions,
142
- } from "./fs";
143
-
144
- export type { IFileSystem, FsEntry } from "just-bash/browser";
57
+ export { Typechecker, createTypechecker } from "./core/typechecker";
58
+ export type { TypecheckerOptions } from "./core/typechecker";
145
59
 
146
60
  // -----------------------------------------------------------------------------
147
- // TypeScript Library Utilities
61
+ // Types Resolver (platform-independent, works anywhere with fetch)
148
62
  // -----------------------------------------------------------------------------
149
63
 
150
64
  export {
151
- getDefaultBrowserLibs,
152
- fetchAndCacheLibs,
153
- } from "./ts-libs";
154
-
155
- // -----------------------------------------------------------------------------
156
- // Command Factories (for custom sandbox commands)
157
- // -----------------------------------------------------------------------------
158
-
159
- export {
160
- createTscCommand,
161
- createBuildCommand,
162
- createInstallCommand,
163
- createUninstallCommand,
164
- createListCommand,
165
- createRunCommand,
166
- createDefaultCommands,
167
- type CommandDeps,
168
- type RunContext,
169
- type RunOptions,
170
- type RunResult,
171
- } from "./commands/index";
65
+ EsmTypesResolver,
66
+ InMemoryTypesCache,
67
+ } from "./core/esm-types-resolver";
68
+ export type {
69
+ EsmTypesResolverOptions,
70
+ ResolvedTypes,
71
+ ITypesCache,
72
+ } from "./core/esm-types-resolver";
73
+
74
+ // -----------------------------------------------------------------------------
75
+ // Types - Interfaces
76
+ // -----------------------------------------------------------------------------
77
+
78
+ export type {
79
+ // Core interfaces (for implementing your own)
80
+ IBundler,
81
+ ITypechecker,
82
+ ITypesResolver,
83
+ ISharedModuleRegistry,
84
+ IExecutor,
85
+
86
+ // Main API types
87
+ Sandlot,
88
+ SandlotOptions,
89
+ Sandbox,
90
+ SandboxOptions,
91
+ SandboxState,
92
+
93
+ // Build types
94
+ BuildPhase,
95
+ BuildResult,
96
+ BuildSuccess,
97
+ BuildFailure,
98
+ SandboxBuildOptions,
99
+
100
+ // Install/Uninstall types
101
+ InstallResult,
102
+ UninstallResult,
103
+
104
+ // Typecheck types
105
+ SandboxTypecheckOptions,
106
+
107
+ // Run types
108
+ RunOptions,
109
+ RunResult,
110
+
111
+ // Executor types
112
+ ExecuteOptions,
113
+ ExecuteResult,
114
+
115
+ // Bundler types
116
+ BundleOptions,
117
+ BundleResult,
118
+ BundleSuccess,
119
+ BundleFailure,
120
+ BundleWarning,
121
+ BundleError,
122
+ BundleLocation,
123
+
124
+ // Typechecker types
125
+ TypecheckOptions,
126
+ TypecheckResult,
127
+ Diagnostic,
128
+
129
+ // Shell execution types
130
+ ExecResult,
131
+
132
+ // Filesystem types
133
+ IFileSystem,
134
+ FsEntry,
135
+ FsStat,
136
+ } from "./types";
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Node/Bun/Deno bundler implementation using native esbuild.
3
+ *
4
+ * This is significantly faster than esbuild-wasm as it uses the native
5
+ * esbuild binary instead of WebAssembly.
6
+ */
7
+
8
+ import type * as EsbuildTypes from "esbuild";
9
+ import type {
10
+ IBundler,
11
+ BundleOptions,
12
+ BundleResult,
13
+ BundleWarning,
14
+ BundleError,
15
+ } from "../types";
16
+ import {
17
+ createVfsPlugin,
18
+ isEsbuildBuildFailure,
19
+ convertEsbuildMessage,
20
+ } from "../core/bundler-utils";
21
+
22
+ export interface EsbuildNativeBundlerOptions {
23
+ /**
24
+ * Base URL for CDN imports.
25
+ * npm imports like "lodash" are rewritten to "{cdnBaseUrl}/lodash@{version}".
26
+ * @default "https://esm.sh"
27
+ */
28
+ cdnBaseUrl?: string;
29
+ }
30
+
31
+ /**
32
+ * Bundler implementation using native esbuild.
33
+ *
34
+ * Uses the native esbuild binary for maximum performance.
35
+ * Works with Node.js, Bun, and Deno.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const bundler = new EsbuildNativeBundler();
40
+ *
41
+ * const result = await bundler.bundle({
42
+ * fs: myFilesystem,
43
+ * entryPoint: "/src/index.ts",
44
+ * });
45
+ * ```
46
+ */
47
+ export class EsbuildNativeBundler implements IBundler {
48
+ private options: EsbuildNativeBundlerOptions;
49
+ private esbuild: typeof EsbuildTypes | null = null;
50
+
51
+ constructor(options: EsbuildNativeBundlerOptions = {}) {
52
+ this.options = {
53
+ cdnBaseUrl: "https://esm.sh",
54
+ ...options,
55
+ };
56
+ }
57
+
58
+ /**
59
+ * Initialize the bundler by loading native esbuild.
60
+ * Called automatically on first bundle() if not already initialized.
61
+ */
62
+ async initialize(): Promise<void> {
63
+ if (this.esbuild) {
64
+ return;
65
+ }
66
+
67
+ // Dynamic import of native esbuild
68
+ // This works in Node.js, Bun, and Deno
69
+ this.esbuild = await import("esbuild");
70
+ }
71
+
72
+ private getEsbuild(): typeof EsbuildTypes {
73
+ if (!this.esbuild) {
74
+ throw new Error("esbuild not initialized - call initialize() first");
75
+ }
76
+ return this.esbuild;
77
+ }
78
+
79
+ async bundle(options: BundleOptions): Promise<BundleResult> {
80
+ await this.initialize();
81
+
82
+ const esbuild = this.getEsbuild();
83
+
84
+ const {
85
+ fs,
86
+ entryPoint,
87
+ installedPackages = {},
88
+ sharedModules = [],
89
+ sharedModuleRegistry,
90
+ external = [],
91
+ format = "esm",
92
+ minify = false,
93
+ sourcemap = false,
94
+ target = ["es2020"],
95
+ } = options;
96
+
97
+ // Normalize entry point to absolute path
98
+ const normalizedEntry = entryPoint.startsWith("/")
99
+ ? entryPoint
100
+ : `/${entryPoint}`;
101
+
102
+ // Verify entry point exists
103
+ if (!fs.exists(normalizedEntry)) {
104
+ return {
105
+ success: false,
106
+ errors: [{ text: `Entry point not found: ${normalizedEntry}` }],
107
+ warnings: [],
108
+ };
109
+ }
110
+
111
+ // Track files included in the bundle
112
+ const includedFiles = new Set<string>();
113
+
114
+ // Create the VFS plugin
115
+ // Note: bundleCdnImports is true for Node/Bun because they cannot
116
+ // resolve HTTP imports at runtime - native esbuild will fetch and bundle them
117
+ const plugin = createVfsPlugin({
118
+ fs,
119
+ entryPoint: normalizedEntry,
120
+ installedPackages,
121
+ sharedModules: new Set(sharedModules),
122
+ sharedModuleRegistry: sharedModuleRegistry ?? null,
123
+ cdnBaseUrl: this.options.cdnBaseUrl!,
124
+ includedFiles,
125
+ bundleCdnImports: true,
126
+ });
127
+
128
+ try {
129
+ // Run esbuild
130
+ // Note: We do NOT mark http/https as external here because Node/Bun
131
+ // cannot resolve HTTP imports at runtime. Instead, bundleCdnImports: true
132
+ // tells the VFS plugin to let native esbuild fetch and bundle CDN imports.
133
+ const result = await esbuild.build({
134
+ entryPoints: [normalizedEntry],
135
+ bundle: true,
136
+ write: false,
137
+ format,
138
+ minify,
139
+ sourcemap: sourcemap ? "inline" : false,
140
+ target,
141
+ external,
142
+ // Cast to esbuild's Plugin type since our minimal interface is compatible
143
+ plugins: [plugin as EsbuildTypes.Plugin],
144
+ jsx: "automatic",
145
+ });
146
+
147
+ const code = result.outputFiles?.[0]?.text ?? "";
148
+
149
+ // Convert esbuild warnings to our format
150
+ const warnings: BundleWarning[] = result.warnings.map((w) =>
151
+ convertEsbuildMessage(w)
152
+ );
153
+
154
+ return {
155
+ success: true,
156
+ code,
157
+ warnings,
158
+ includedFiles: Array.from(includedFiles),
159
+ };
160
+ } catch (err) {
161
+ // esbuild throws BuildFailure with .errors array
162
+ if (isEsbuildBuildFailure(err)) {
163
+ const errors: BundleError[] = err.errors.map((e) =>
164
+ convertEsbuildMessage(e)
165
+ );
166
+ const warnings: BundleWarning[] = err.warnings.map((w) =>
167
+ convertEsbuildMessage(w)
168
+ );
169
+ return {
170
+ success: false,
171
+ errors,
172
+ warnings,
173
+ };
174
+ }
175
+
176
+ // Unknown error - wrap it
177
+ const message = err instanceof Error ? err.message : String(err);
178
+ return {
179
+ success: false,
180
+ errors: [{ text: message }],
181
+ warnings: [],
182
+ };
183
+ }
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Create a native esbuild bundler.
189
+ */
190
+ export function createEsbuildNativeBundler(
191
+ options?: EsbuildNativeBundlerOptions
192
+ ): EsbuildNativeBundler {
193
+ return new EsbuildNativeBundler(options);
194
+ }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Node/Bun/Deno executor implementation.
3
+ *
4
+ * Executes bundled JavaScript code using temp files and dynamic import.
5
+ * This provides basic execution without full isolation.
6
+ *
7
+ * For isolated execution, consider using Node's vm module or worker threads.
8
+ */
9
+
10
+ import type { IExecutor } from "../types";
11
+ import { createBasicExecutor, type BasicExecutorOptions } from "../core/executor";
12
+ import { writeFileSync, unlinkSync, mkdtempSync } from "fs";
13
+ import { join } from "path";
14
+ import { tmpdir } from "os";
15
+
16
+ /**
17
+ * Options for creating a NodeExecutor.
18
+ */
19
+ export type NodeExecutorOptions = BasicExecutorOptions;
20
+
21
+ /**
22
+ * Load a module from code using a temp file.
23
+ * This works in Node.js, Bun, and Deno, and properly supports HTTP imports.
24
+ */
25
+ async function loadModuleFromTempFile(code: string): Promise<Record<string, unknown>> {
26
+ // Create a temp directory and file
27
+ const tempDir = mkdtempSync(join(tmpdir(), "sandlot-"));
28
+ const tempFile = join(tempDir, `module-${Date.now()}.mjs`);
29
+
30
+ try {
31
+ // Write the code to a temp file
32
+ writeFileSync(tempFile, code, "utf-8");
33
+
34
+ // Import from the temp file - this allows HTTP imports to work
35
+ // Use file:// URL for cross-platform compatibility
36
+ const fileUrl = `file://${tempFile}`;
37
+ return await import(/* @vite-ignore */ fileUrl);
38
+ } finally {
39
+ // Clean up temp file
40
+ try {
41
+ unlinkSync(tempFile);
42
+ } catch {
43
+ // Ignore cleanup errors
44
+ }
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Executor that runs code in Node.js/Bun/Deno.
50
+ *
51
+ * Uses data URLs with dynamic import for execution.
52
+ * This approach works across Node.js, Bun, and Deno.
53
+ *
54
+ * WARNING: This executor provides NO isolation. The executed code has
55
+ * full access to the process environment, file system, and network.
56
+ * Only use for trusted code.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const executor = createNodeExecutor();
61
+ * const result = await executor.execute(bundledCode, {
62
+ * entryExport: 'main',
63
+ * context: { args: ['--verbose'] },
64
+ * timeout: 5000,
65
+ * });
66
+ * console.log(result.logs);
67
+ * ```
68
+ */
69
+ export class NodeExecutor implements IExecutor {
70
+ private executor: IExecutor;
71
+
72
+ constructor(options: NodeExecutorOptions = {}) {
73
+ this.executor = createBasicExecutor(loadModuleFromTempFile, options);
74
+ }
75
+
76
+ execute: IExecutor["execute"] = (...args) => this.executor.execute(...args);
77
+ }
78
+
79
+ /**
80
+ * Create a Node executor.
81
+ *
82
+ * @param options - Executor options
83
+ * @returns A new NodeExecutor instance
84
+ */
85
+ export function createNodeExecutor(options?: NodeExecutorOptions): NodeExecutor {
86
+ return new NodeExecutor(options);
87
+ }
@@ -0,0 +1,39 @@
1
+ // =============================================================================
2
+ // Sandlot v2 - Node/Bun/Deno Entry Point
3
+ // =============================================================================
4
+ //
5
+ // Server-side implementations for Sandlot.
6
+ // Uses native esbuild for bundling (much faster than esbuild-wasm).
7
+ //
8
+ // Note: The Typechecker and EsmTypesResolver are platform-independent and
9
+ // exported from the main "sandlot" entry point.
10
+ //
11
+ // =============================================================================
12
+
13
+ // -----------------------------------------------------------------------------
14
+ // Bundler (node-specific: uses native esbuild)
15
+ // -----------------------------------------------------------------------------
16
+
17
+ export { EsbuildNativeBundler, createEsbuildNativeBundler } from "./bundler";
18
+ export type { EsbuildNativeBundlerOptions } from "./bundler";
19
+
20
+ // -----------------------------------------------------------------------------
21
+ // Typechecker (platform-agnostic: re-exported for convenience)
22
+ // -----------------------------------------------------------------------------
23
+
24
+ export { Typechecker, createTypechecker } from "../core/typechecker";
25
+ export type { TypecheckerOptions } from "../core/typechecker";
26
+
27
+ // -----------------------------------------------------------------------------
28
+ // Executor (node-specific: uses data URLs)
29
+ // -----------------------------------------------------------------------------
30
+
31
+ export { NodeExecutor, createNodeExecutor } from "./executor";
32
+ export type { NodeExecutorOptions } from "./executor";
33
+
34
+ // -----------------------------------------------------------------------------
35
+ // Convenience Preset
36
+ // -----------------------------------------------------------------------------
37
+
38
+ export { createNodeSandlot } from "./preset";
39
+ export type { CreateNodeSandlotOptions } from "./preset";