@seedprotocol/sdk 0.4.0 → 0.4.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAA;AAMlD,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IAEtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAkDD,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,MAAM,EAAE,CA+e5E;AAED;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAI/C;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;KAC9B;CACF;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAA;AAMlD,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IAEtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAkDD,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,MAAM,EAAE,CAqlB5E;AAED;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAI/C;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;KAC9B;CACF;AAED,eAAe,cAAc,CAAA"}
@@ -228,8 +228,102 @@ function seedVitePlugin(options = {}) {
228
228
  // Preserve existing entries even if none provided
229
229
  optimizeDepsConfig.entries = existingEntries;
230
230
  }
231
+ // Configure build externals to prevent bundling Node.js-only packages
232
+ // These packages should not be bundled for browser builds
233
+ const nodeOnlyPackages = [
234
+ 'drizzle-kit',
235
+ '@electric-sql/pglite',
236
+ 'pg',
237
+ 'postgres',
238
+ '@vercel/postgres',
239
+ '@neondatabase/serverless',
240
+ 'mysql2',
241
+ 'mysql2/promise',
242
+ '@planetscale/database',
243
+ 'better-sqlite3',
244
+ 'nunjucks',
245
+ 'fsevents',
246
+ ];
247
+ // Node.js built-in modules that should be externalized
248
+ const nodeBuiltins = [
249
+ 'url',
250
+ 'path',
251
+ 'http',
252
+ 'http2',
253
+ 'stream',
254
+ 'crypto',
255
+ 'net',
256
+ 'https',
257
+ 'zlib',
258
+ 'child_process',
259
+ 'fs',
260
+ 'fs/promises',
261
+ 'node:fs',
262
+ 'node:fs/promises',
263
+ 'node:url',
264
+ 'node:path',
265
+ 'node:http',
266
+ 'node:http2',
267
+ 'node:stream',
268
+ 'node:crypto',
269
+ 'node:net',
270
+ 'node:https',
271
+ 'node:zlib',
272
+ 'node:child_process',
273
+ ];
274
+ const existingExternal = userConfig.build?.rollupOptions?.external;
275
+ const existingExternalArray = Array.isArray(existingExternal)
276
+ ? existingExternal
277
+ : typeof existingExternal === 'string'
278
+ ? [existingExternal]
279
+ : [];
280
+ // Merge with existing externals, avoiding duplicates
281
+ const allExternals = [
282
+ ...new Set([
283
+ ...existingExternalArray,
284
+ ...nodeOnlyPackages,
285
+ ...nodeBuiltins,
286
+ ]),
287
+ ];
288
+ // Create external function that checks both our list and user's function
289
+ const externalFunction = (id, importer, isResolved) => {
290
+ // Check if it's a node-only package (exact match or subpath)
291
+ if (nodeOnlyPackages.some(pkg => id === pkg || id.startsWith(`${pkg}/`))) {
292
+ if (debug) {
293
+ log(`[build] Externalizing node-only package: ${id}`);
294
+ }
295
+ return true;
296
+ }
297
+ // Check if it's a Node.js built-in
298
+ if (nodeBuiltins.includes(id)) {
299
+ if (debug) {
300
+ log(`[build] Externalizing Node.js built-in: ${id}`);
301
+ }
302
+ return true;
303
+ }
304
+ // If user provided a function, call it first
305
+ if (typeof existingExternal === 'function') {
306
+ const userResult = existingExternal(id, importer, isResolved);
307
+ if (userResult)
308
+ return true;
309
+ }
310
+ // Otherwise check if it's in the array
311
+ return allExternals.includes(id);
312
+ };
231
313
  return {
232
314
  optimizeDeps: optimizeDepsConfig,
315
+ build: {
316
+ rollupOptions: {
317
+ // Always use the function if we have node-only packages to externalize
318
+ // or if the user provided an external function
319
+ // Otherwise, use the array if we have externals
320
+ external: nodeOnlyPackages.length > 0 || typeof existingExternal === 'function'
321
+ ? externalFunction
322
+ : allExternals.length > 0
323
+ ? allExternals
324
+ : undefined,
325
+ },
326
+ },
233
327
  };
234
328
  },
235
329
  async resolveId(source, importer, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/vite/index.ts"],"sourcesContent":["import type { Plugin, ResolvedConfig } from 'vite'\n\n// Get the plugin file's URL to use as importer context for resolving SDK dependencies\n// @ts-expect-error - import.meta.url is valid in ESM but TypeScript config may not recognize it\nconst PLUGIN_FILE_URL = import.meta.url\n\nexport interface SeedVitePluginOptions {\n /**\n * Custom ZenFS configuration to apply on initialization\n */\n zenfsConfig?: Record<string, unknown>\n \n /**\n * Additional modules to alias to ZenFS equivalents\n * @default ['fs', 'fs/promises', 'node:fs', 'node:fs/promises']\n */\n fsModules?: string[]\n \n /**\n * Whether to inject automatic ZenFS initialization\n * @default true\n */\n autoInit?: boolean\n \n /**\n * Enable debug logging\n * @default false\n */\n debug?: boolean\n \n /**\n * Entry points to scan for dependencies during initial optimization.\n * This helps prevent incremental dependency discovery and multiple reloads.\n * Can be file paths or glob patterns relative to the project root.\n * If not provided, the plugin will attempt to auto-detect SDK entry points.\n */\n entryPoints?: string[]\n \n /**\n * Whether to automatically include common SDK dependencies in optimizeDeps.include.\n * Set to false if these dependencies are not installed in your project.\n * @default false\n */\n autoIncludeDeps?: boolean\n}\n\nconst DEFAULT_FS_MODULES = [\n 'fs',\n 'fs/promises',\n 'node:fs',\n 'node:fs/promises',\n]\n\n// Modules that other polyfill plugins commonly alias fs to\nconst KNOWN_POLYFILL_TARGETS = [\n 'memfs',\n 'browserfs',\n 'rollup-plugin-node-polyfills/polyfills/fs',\n 'vite-plugin-node-polyfills/shims/fs',\n 'node-stdlib-browser/esm/mock/empty',\n 'node-stdlib-browser/esm/mock/empty.js',\n '\\0vite/node-polyfills/fs',\n '\\0node-polyfills:fs',\n 'empty',\n '\\0empty',\n '__vite-browser-external',\n]\n\n// Common dependencies that are frequently used by the SDK and should be pre-optimized\n// to prevent incremental discovery and multiple reloads\n// Note: Only include these if autoIncludeDeps is enabled, as they might not be\n// installed in the consuming project (they're in the SDK's node_modules)\nconst COMMON_DEPENDENCIES = [\n '@zenfs/core',\n '@zenfs/dom',\n 'path-browserify',\n 'graphql-request',\n 'tslib',\n 'reflect-metadata',\n '@sinclair/typebox',\n '@sinclair/typebox/value',\n 'immer',\n 'rxjs',\n 'xstate',\n 'lodash-es',\n 'use-immer',\n '@xstate/react',\n 'ethers',\n 'eventemitter3',\n '@statelyai/inspect',\n 'arweave',\n // Note: node:crypto is a Node.js built-in and cannot be optimized\n]\n\nexport function seedVitePlugin(options: SeedVitePluginOptions = {}): Plugin[] {\n const {\n fsModules = DEFAULT_FS_MODULES,\n autoInit = true,\n debug = false,\n entryPoints,\n autoIncludeDeps = false,\n } = options\n\n const log = (...args: unknown[]) => {\n if (debug) console.log('[seed-vite-plugin]', ...args)\n }\n\n let config: ResolvedConfig\n\n // Track what other plugins have done to fs\n const interceptedResolutions = new Map<string, string>()\n\n /**\n * First plugin: runs early to observe what other plugins do and set up aliases\n */\n const observerPlugin: Plugin = {\n name: 'seed-protocol:observer',\n enforce: 'pre',\n\n config(userConfig) {\n // Set up aliases early to override other plugins' fs polyfills\n const aliases: Array<{ find: string | RegExp; replacement: string }> = []\n \n for (const fsModule of fsModules) {\n const isPromiseVariant = fsModule.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n aliases.push({\n find: new RegExp(`^${fsModule.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}$`),\n replacement: zenfsModule,\n })\n }\n \n // Also alias the node-stdlib-browser empty mock to @zenfs/core\n // This ensures Vite can resolve it properly without needing manual resolution\n aliases.push(\n {\n find: /^node-stdlib-browser\\/esm\\/mock\\/empty(\\.js)?$/,\n replacement: '@zenfs/core',\n },\n {\n find: /node-stdlib-browser\\/esm\\/mock\\/empty(\\.js)?$/,\n replacement: '@zenfs/core',\n }\n )\n\n return {\n resolve: {\n alias: aliases,\n },\n optimizeDeps: {\n exclude: [\n 'fs', \n 'node:fs', \n 'fs/promises', \n 'node:fs/promises',\n // Also exclude the empty mock to prevent it from being cached\n 'node-stdlib-browser/esm/mock/empty',\n 'node-stdlib-browser/esm/mock/empty.js',\n // Exclude drizzle-kit and database drivers that it dynamically imports\n // These are dev tools and should not be bundled\n 'drizzle-kit',\n '@electric-sql/pglite',\n 'pg',\n 'postgres',\n '@vercel/postgres',\n '@neondatabase/serverless',\n 'mysql2',\n 'mysql2/promise',\n '@planetscale/database',\n ],\n },\n }\n },\n\n async resolveId(source, importer, options) {\n // Remove query parameters for matching\n const sourceWithoutQuery = source.split('?')[0]\n \n // Intercept fs imports early, before other plugins can create polyfills\n if (fsModules.includes(source) || fsModules.includes(sourceWithoutQuery)) {\n log(`[observer] Early interception of: \"${source}\" from ${importer}`)\n \n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // Resolve from plugin's context (SDK's node_modules)\n const resolved = await this.resolve(zenfsModule, PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n \n if (resolved) {\n log(`[observer] Resolved to: ${resolved.id}`)\n return resolved\n }\n }\n \n // Also intercept node-stdlib-browser empty mock if it's being used\n // Match various formats: full path, relative path, with/without query params\n if (\n source.includes('node-stdlib-browser') && \n (source.includes('mock/empty') || source.includes('empty.js'))\n ) {\n log(`[observer] Intercepting node-stdlib-browser empty mock: \"${source}\"`)\n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // Try resolving from plugin context first (SDK's node_modules)\n let resolved = await this.resolve(zenfsModule, PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n \n // If that fails and we have an importer, try resolving from the importer\n if (!resolved && importer) {\n resolved = await this.resolve(zenfsModule, importer, {\n ...options,\n skipSelf: true,\n })\n }\n \n if (resolved) {\n log(`[observer] Resolved empty mock to: ${resolved.id}`)\n return resolved\n }\n \n // If resolution fails, return null and let Vite handle it naturally\n // Vite should be able to resolve @zenfs/core from node_modules\n log(`[observer] Resolution failed, letting Vite handle: ${zenfsModule}`)\n return null\n }\n \n return null\n },\n\n configResolved(resolvedConfig) {\n config = resolvedConfig\n\n // Log any fs-related aliases from other plugins\n const aliases = resolvedConfig.resolve.alias\n if (debug && aliases) {\n const aliasArray = Array.isArray(aliases) ? aliases : Object.entries(aliases)\n for (const alias of aliasArray) {\n const [find, replacement] = Array.isArray(alias) \n ? [alias[0], alias[1]] \n : [alias.find, alias.replacement]\n \n if (typeof find === 'string' && fsModules.some(m => find.includes('fs'))) {\n log(`Detected existing alias: ${find} -> ${replacement}`)\n }\n }\n }\n },\n }\n\n /**\n * Main plugin: enforced to run last in the chain\n */\n const mainPlugin: Plugin = {\n name: 'seed-protocol:main',\n enforce: 'post',\n\n config(userConfig) {\n // Pre-optimize common dependencies to prevent incremental discovery\n // This reduces the number of reloads by ensuring dependencies are optimized upfront\n // Note: Only include if autoIncludeDeps is true, as these dependencies might not\n // be installed in the consuming project (they're in the SDK's node_modules)\n const existingInclude = userConfig.optimizeDeps?.include || []\n // Normalize entries to always be an array (Vite allows string | string[])\n const existingEntriesRaw = userConfig.optimizeDeps?.entries\n const existingEntries = Array.isArray(existingEntriesRaw)\n ? existingEntriesRaw\n : existingEntriesRaw\n ? [existingEntriesRaw]\n : []\n \n const optimizeDepsConfig: {\n include?: string[]\n entries?: string[]\n esbuildOptions?: {\n define?: Record<string, string>\n }\n } = {\n esbuildOptions: {\n define: {\n global: 'globalThis',\n },\n },\n }\n\n // Only auto-include dependencies if explicitly enabled\n // Vite will discover dependencies automatically if they're imported\n if (autoIncludeDeps) {\n const include = Array.isArray(existingInclude)\n ? [...new Set([...existingInclude, ...COMMON_DEPENDENCIES])]\n : [...COMMON_DEPENDENCIES]\n optimizeDepsConfig.include = include\n if (debug) {\n log(`[main] Auto-including common dependencies: ${COMMON_DEPENDENCIES.join(', ')}`)\n }\n } else if (Array.isArray(existingInclude) && existingInclude.length > 0) {\n // Preserve existing includes if provided\n optimizeDepsConfig.include = existingInclude\n }\n\n // If entry points are provided, merge them with existing entries\n // This helps Vite discover all dependencies during initial optimization\n if (entryPoints && entryPoints.length > 0) {\n const mergedEntries = Array.isArray(existingEntries)\n ? [...new Set([...existingEntries, ...entryPoints])]\n : entryPoints\n optimizeDepsConfig.entries = mergedEntries\n if (debug) {\n log(`[main] Using entry points for dependency scanning: ${mergedEntries.join(', ')}`)\n }\n } else if (existingEntries.length > 0) {\n // Preserve existing entries even if none provided\n optimizeDepsConfig.entries = existingEntries\n }\n\n return {\n optimizeDeps: optimizeDepsConfig,\n }\n },\n\n async resolveId(source, importer, options) {\n // Check if this is an fs-related import we should intercept\n const shouldIntercept = fsModules.includes(source) || \n KNOWN_POLYFILL_TARGETS.some(target => source.includes(target) || source === target)\n\n // Also intercept node-stdlib-browser empty mock paths\n if (source.includes('node-stdlib-browser') && source.includes('mock/empty')) {\n log(`Intercepting node-stdlib-browser empty mock: \"${source}\"`)\n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // Try resolving from plugin context first (SDK's node_modules)\n let resolved = await this.resolve(zenfsModule, PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n \n // If that fails and we have an importer, try resolving from the importer\n if (!resolved && importer) {\n resolved = await this.resolve(zenfsModule, importer, {\n ...options,\n skipSelf: true,\n })\n }\n \n if (resolved) {\n log(`Resolved empty mock to: ${resolved.id}`)\n interceptedResolutions.set(source, resolved.id)\n return resolved\n }\n \n // If resolution fails, return null and let Vite handle it naturally\n // The alias configuration should handle the resolution\n log(`Resolution failed, letting Vite handle: ${zenfsModule}`)\n return null\n }\n\n if (!shouldIntercept) {\n // Also intercept if source is a Vite pre-bundled fs polyfill path or node-stdlib-browser mock\n const sourceWithoutQuery = source.split('?')[0]\n if (\n source.includes('node_fs') || \n (source.includes('.vite/deps') && source.includes('fs') && !source.includes('@zenfs')) ||\n (source.includes('node-stdlib-browser') && (source.includes('mock/empty') || source.includes('empty.js')))\n ) {\n log(`Intercepting Vite pre-bundled fs polyfill/mock: \"${source}\"`)\n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // For .vite/deps paths, let the load hook handle them to avoid chunk reference issues\n if (source.includes('.vite/deps')) {\n // Return null to let Vite continue, then the load hook will intercept\n return null\n }\n \n // For other cases, resolve the module\n let resolved = await this.resolve(zenfsModule, importer || PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n \n if (resolved) {\n log(`Resolved pre-bundled fs to: ${resolved.id}`)\n interceptedResolutions.set(source, resolved.id)\n return resolved\n }\n \n // Fallback: return the module specifier\n log(`Fallback: returning module specifier: ${zenfsModule}`)\n interceptedResolutions.set(source, zenfsModule)\n return { id: zenfsModule, external: false }\n }\n return null\n }\n\n log(`Intercepting resolution: \"${source}\" from ${importer}`)\n\n // Determine the correct ZenFS module\n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n\n // First, try resolving from the plugin's context (SDK's node_modules)\n // This ensures we use the SDK's dependencies even if the consuming project doesn't have them\n let resolved = await this.resolve(zenfsModule, PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n\n // If that fails, try resolving from the original importer (project's node_modules)\n if (!resolved && importer) {\n resolved = await this.resolve(zenfsModule, importer, {\n ...options,\n skipSelf: true,\n })\n }\n\n if (resolved) {\n log(`Resolved to: ${resolved.id}`)\n interceptedResolutions.set(source, resolved.id)\n return resolved\n }\n\n // Fallback: return the module specifier and let Vite handle it\n // Vite should be able to resolve from parent node_modules automatically\n log(`Fallback resolution for: ${zenfsModule}`)\n return { id: zenfsModule, external: false }\n },\n\n shouldTransformCachedModule({ id, code }) {\n // Force transformation of cached fs polyfill modules\n const idWithoutQuery = id.split('?')[0]\n const isFsPolyfill = \n idWithoutQuery.includes('node_fs') || \n (idWithoutQuery.includes('.vite/deps') && idWithoutQuery.includes('fs') && !idWithoutQuery.includes('@zenfs')) ||\n (idWithoutQuery.includes('node-stdlib-browser') && (idWithoutQuery.includes('mock/empty') || idWithoutQuery.includes('empty.js')))\n \n if (isFsPolyfill) {\n log(`Forcing transformation of cached fs polyfill: ${id}`)\n return true\n }\n return false\n },\n\n load(id) {\n // Remove query parameters for matching (e.g., ?v=392cb483)\n const idWithoutQuery = id.split('?')[0]\n \n // Intercept Vite's pre-bundled fs polyfill and replace it with ZenFS\n // Also intercept node-stdlib-browser's empty mock\n // Handle both regular paths and /@fs/ prefixed paths\n const isFsPolyfill = \n idWithoutQuery.includes('node_fs') || \n (idWithoutQuery.includes('.vite/deps') && idWithoutQuery.includes('fs') && !idWithoutQuery.includes('@zenfs')) ||\n (idWithoutQuery.includes('node-stdlib-browser') && (idWithoutQuery.includes('mock/empty') || idWithoutQuery.includes('empty.js')))\n \n if (isFsPolyfill) {\n log(`Intercepting load of fs polyfill/mock file: ${id}`)\n const isPromiseVariant = idWithoutQuery.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // Return a re-export from ZenFS\n return `export * from '${zenfsModule}'; export { default } from '${zenfsModule}';`\n }\n return null\n },\n\n handleHotUpdate({ file, server }) {\n // Invalidate modules that import fs when the plugin file changes\n // This helps with HMR scenarios where the cache might be stale\n if (file.includes('node-stdlib-browser') && file.includes('empty')) {\n log(`Invalidating modules due to fs polyfill change: ${file}`)\n // Let Vite handle the invalidation naturally\n return undefined\n }\n return undefined\n },\n\n transform(code, id) {\n // Skip node_modules except for specific problematic packages\n if (id.includes('node_modules') && !id.includes('@seedprotocol')) {\n return null\n }\n\n // Handle dynamic imports of fs\n const dynamicFsImportPattern = /import\\s*\\(\\s*['\"`](fs|node:fs|fs\\/promises|node:fs\\/promises)['\"`]\\s*\\)/g\n \n if (dynamicFsImportPattern.test(code)) {\n log(`Transforming dynamic fs imports in: ${id}`)\n \n const transformed = code.replace(dynamicFsImportPattern, (match, moduleName) => {\n const isPromise = moduleName.includes('promises')\n const replacement = isPromise ? '@zenfs/core/promises' : '@zenfs/core'\n return `import('${replacement}')`\n })\n\n return {\n code: transformed,\n map: null,\n }\n }\n\n return null\n },\n\n transformIndexHtml(html) {\n if (!autoInit) return html\n\n // Inject ZenFS initialization script before other scripts\n const initScript = `\n<script type=\"module\">\n import { configure } from '@zenfs/core';\n import { IndexedDB } from '@zenfs/dom';\n \n window.__seedFsReady = configure({\n mounts: {\n '/': IndexedDB,\n },\n }).then(() => {\n console.log('[seed-protocol] ZenFS initialized');\n }).catch(err => {\n console.error('[seed-protocol] ZenFS initialization failed:', err);\n });\n</script>`\n\n // Insert before closing head tag or at the start of body\n if (html.includes('</head>')) {\n return html.replace('</head>', `${initScript}\\n</head>`)\n }\n \n return html.replace('<body>', `<body>\\n${initScript}`)\n },\n\n buildEnd() {\n if (debug && interceptedResolutions.size > 0) {\n log('Summary of intercepted resolutions:')\n for (const [source, target] of interceptedResolutions) {\n log(` ${source} -> ${target}`)\n }\n }\n },\n }\n\n /**\n * Cleanup plugin: catches any remaining fs references in the final bundle\n */\n const cleanupPlugin: Plugin = {\n name: 'seed-protocol:cleanup',\n enforce: 'post',\n apply: 'build',\n\n generateBundle(options, bundle) {\n for (const [fileName, chunk] of Object.entries(bundle)) {\n if (chunk.type !== 'chunk') continue\n\n // Check for any remaining problematic fs references\n const problematicPatterns = [\n /require\\s*\\(\\s*['\"`]fs['\"`]\\s*\\)/g,\n /from\\s*['\"`]fs['\"`]/g,\n /__vite-browser-external.*fs/g,\n ]\n\n let hasIssue = false\n for (const pattern of problematicPatterns) {\n if (pattern.test(chunk.code)) {\n hasIssue = true\n log(`Warning: Potential unresolved fs reference in ${fileName}`)\n break\n }\n }\n\n if (hasIssue && debug) {\n // Log the context around the problematic reference\n const lines = chunk.code.split('\\n')\n lines.forEach((line, i) => {\n if (line.includes('fs') && (line.includes('require') || line.includes('from'))) {\n log(` Line ${i + 1}: ${line.substring(0, 100)}...`)\n }\n })\n }\n }\n },\n }\n\n return [observerPlugin, mainPlugin, cleanupPlugin]\n}\n\n/**\n * Helper to ensure ZenFS is ready before using fs operations\n */\nexport async function waitForFs(): Promise<void> {\n if (typeof window !== 'undefined' && window.__seedFsReady) {\n await window.__seedFsReady\n }\n}\n\n// Type augmentation for the window object\ndeclare global {\n interface Window {\n __seedFsReady?: Prom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,CAAC,IAAI,KAAK,OAAO;oBAAE;;AAG5B,gBAAA,MAAM,mBAAmB,GAAG;oBAC1B,mCAAmC;oBACnC,sBAAsB;oBACtB,8BAA8B;iBAC/B;gBAED,IAAI,QAAQ,GAAG,KAAK;AACpB,gBAAA,KAAK,MAAM,OAAO,IAAI,mBAAmB,EAAE;oBACzC,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;wBAC5B,QAAQ,GAAG,IAAI;AACf,wBAAA,GAAG,CAAC,CAAA,8CAAA,EAAiD,QAAQ,CAAA,CAAE,CAAC;wBAChE;oBACF;gBACF;AAEA,gBAAA,IAAI,QAAQ,IAAI,KAAK,EAAE;;oBAErB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;oBACpC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,KAAI;wBACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE;AAC9E,4BAAA,GAAG,CAAC,CAAA,OAAA,EAAU,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,GAAA,CAAK,CAAC;wBACtD;AACF,oBAAA,CAAC,CAAC;gBACJ;YACF;QACF,CAAC;KACF;AAED,IAAA,OAAO,CAAC,cAAc,EAAE,UAAU,EAAE,aAAa,CAAC;AACpD;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/vite/index.ts"],"sourcesContent":["import type { Plugin, ResolvedConfig } from 'vite'\n\n// Get the plugin file's URL to use as importer context for resolving SDK dependencies\n// @ts-expect-error - import.meta.url is valid in ESM but TypeScript config may not recognize it\nconst PLUGIN_FILE_URL = import.meta.url\n\nexport interface SeedVitePluginOptions {\n /**\n * Custom ZenFS configuration to apply on initialization\n */\n zenfsConfig?: Record<string, unknown>\n \n /**\n * Additional modules to alias to ZenFS equivalents\n * @default ['fs', 'fs/promises', 'node:fs', 'node:fs/promises']\n */\n fsModules?: string[]\n \n /**\n * Whether to inject automatic ZenFS initialization\n * @default true\n */\n autoInit?: boolean\n \n /**\n * Enable debug logging\n * @default false\n */\n debug?: boolean\n \n /**\n * Entry points to scan for dependencies during initial optimization.\n * This helps prevent incremental dependency discovery and multiple reloads.\n * Can be file paths or glob patterns relative to the project root.\n * If not provided, the plugin will attempt to auto-detect SDK entry points.\n */\n entryPoints?: string[]\n \n /**\n * Whether to automatically include common SDK dependencies in optimizeDeps.include.\n * Set to false if these dependencies are not installed in your project.\n * @default false\n */\n autoIncludeDeps?: boolean\n}\n\nconst DEFAULT_FS_MODULES = [\n 'fs',\n 'fs/promises',\n 'node:fs',\n 'node:fs/promises',\n]\n\n// Modules that other polyfill plugins commonly alias fs to\nconst KNOWN_POLYFILL_TARGETS = [\n 'memfs',\n 'browserfs',\n 'rollup-plugin-node-polyfills/polyfills/fs',\n 'vite-plugin-node-polyfills/shims/fs',\n 'node-stdlib-browser/esm/mock/empty',\n 'node-stdlib-browser/esm/mock/empty.js',\n '\\0vite/node-polyfills/fs',\n '\\0node-polyfills:fs',\n 'empty',\n '\\0empty',\n '__vite-browser-external',\n]\n\n// Common dependencies that are frequently used by the SDK and should be pre-optimized\n// to prevent incremental discovery and multiple reloads\n// Note: Only include these if autoIncludeDeps is enabled, as they might not be\n// installed in the consuming project (they're in the SDK's node_modules)\nconst COMMON_DEPENDENCIES = [\n '@zenfs/core',\n '@zenfs/dom',\n 'path-browserify',\n 'graphql-request',\n 'tslib',\n 'reflect-metadata',\n '@sinclair/typebox',\n '@sinclair/typebox/value',\n 'immer',\n 'rxjs',\n 'xstate',\n 'lodash-es',\n 'use-immer',\n '@xstate/react',\n 'ethers',\n 'eventemitter3',\n '@statelyai/inspect',\n 'arweave',\n // Note: node:crypto is a Node.js built-in and cannot be optimized\n]\n\nexport function seedVitePlugin(options: SeedVitePluginOptions = {}): Plugin[] {\n const {\n fsModules = DEFAULT_FS_MODULES,\n autoInit = true,\n debug = false,\n entryPoints,\n autoIncludeDeps = false,\n } = options\n\n const log = (...args: unknown[]) => {\n if (debug) console.log('[seed-vite-plugin]', ...args)\n }\n\n let config: ResolvedConfig\n\n // Track what other plugins have done to fs\n const interceptedResolutions = new Map<string, string>()\n\n /**\n * First plugin: runs early to observe what other plugins do and set up aliases\n */\n const observerPlugin: Plugin = {\n name: 'seed-protocol:observer',\n enforce: 'pre',\n\n config(userConfig) {\n // Set up aliases early to override other plugins' fs polyfills\n const aliases: Array<{ find: string | RegExp; replacement: string }> = []\n \n for (const fsModule of fsModules) {\n const isPromiseVariant = fsModule.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n aliases.push({\n find: new RegExp(`^${fsModule.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}$`),\n replacement: zenfsModule,\n })\n }\n \n // Also alias the node-stdlib-browser empty mock to @zenfs/core\n // This ensures Vite can resolve it properly without needing manual resolution\n aliases.push(\n {\n find: /^node-stdlib-browser\\/esm\\/mock\\/empty(\\.js)?$/,\n replacement: '@zenfs/core',\n },\n {\n find: /node-stdlib-browser\\/esm\\/mock\\/empty(\\.js)?$/,\n replacement: '@zenfs/core',\n }\n )\n\n return {\n resolve: {\n alias: aliases,\n },\n optimizeDeps: {\n exclude: [\n 'fs', \n 'node:fs', \n 'fs/promises', \n 'node:fs/promises',\n // Also exclude the empty mock to prevent it from being cached\n 'node-stdlib-browser/esm/mock/empty',\n 'node-stdlib-browser/esm/mock/empty.js',\n // Exclude drizzle-kit and database drivers that it dynamically imports\n // These are dev tools and should not be bundled\n 'drizzle-kit',\n '@electric-sql/pglite',\n 'pg',\n 'postgres',\n '@vercel/postgres',\n '@neondatabase/serverless',\n 'mysql2',\n 'mysql2/promise',\n '@planetscale/database',\n ],\n },\n }\n },\n\n async resolveId(source, importer, options) {\n // Remove query parameters for matching\n const sourceWithoutQuery = source.split('?')[0]\n \n // Intercept fs imports early, before other plugins can create polyfills\n if (fsModules.includes(source) || fsModules.includes(sourceWithoutQuery)) {\n log(`[observer] Early interception of: \"${source}\" from ${importer}`)\n \n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // Resolve from plugin's context (SDK's node_modules)\n const resolved = await this.resolve(zenfsModule, PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n \n if (resolved) {\n log(`[observer] Resolved to: ${resolved.id}`)\n return resolved\n }\n }\n \n // Also intercept node-stdlib-browser empty mock if it's being used\n // Match various formats: full path, relative path, with/without query params\n if (\n source.includes('node-stdlib-browser') && \n (source.includes('mock/empty') || source.includes('empty.js'))\n ) {\n log(`[observer] Intercepting node-stdlib-browser empty mock: \"${source}\"`)\n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // Try resolving from plugin context first (SDK's node_modules)\n let resolved = await this.resolve(zenfsModule, PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n \n // If that fails and we have an importer, try resolving from the importer\n if (!resolved && importer) {\n resolved = await this.resolve(zenfsModule, importer, {\n ...options,\n skipSelf: true,\n })\n }\n \n if (resolved) {\n log(`[observer] Resolved empty mock to: ${resolved.id}`)\n return resolved\n }\n \n // If resolution fails, return null and let Vite handle it naturally\n // Vite should be able to resolve @zenfs/core from node_modules\n log(`[observer] Resolution failed, letting Vite handle: ${zenfsModule}`)\n return null\n }\n \n return null\n },\n\n configResolved(resolvedConfig) {\n config = resolvedConfig\n\n // Log any fs-related aliases from other plugins\n const aliases = resolvedConfig.resolve.alias\n if (debug && aliases) {\n const aliasArray = Array.isArray(aliases) ? aliases : Object.entries(aliases)\n for (const alias of aliasArray) {\n const [find, replacement] = Array.isArray(alias) \n ? [alias[0], alias[1]] \n : [alias.find, alias.replacement]\n \n if (typeof find === 'string' && fsModules.some(m => find.includes('fs'))) {\n log(`Detected existing alias: ${find} -> ${replacement}`)\n }\n }\n }\n },\n }\n\n /**\n * Main plugin: enforced to run last in the chain\n */\n const mainPlugin: Plugin = {\n name: 'seed-protocol:main',\n enforce: 'post',\n\n config(userConfig) {\n // Pre-optimize common dependencies to prevent incremental discovery\n // This reduces the number of reloads by ensuring dependencies are optimized upfront\n // Note: Only include if autoIncludeDeps is true, as these dependencies might not\n // be installed in the consuming project (they're in the SDK's node_modules)\n const existingInclude = userConfig.optimizeDeps?.include || []\n // Normalize entries to always be an array (Vite allows string | string[])\n const existingEntriesRaw = userConfig.optimizeDeps?.entries\n const existingEntries = Array.isArray(existingEntriesRaw)\n ? existingEntriesRaw\n : existingEntriesRaw\n ? [existingEntriesRaw]\n : []\n \n const optimizeDepsConfig: {\n include?: string[]\n entries?: string[]\n esbuildOptions?: {\n define?: Record<string, string>\n }\n } = {\n esbuildOptions: {\n define: {\n global: 'globalThis',\n },\n },\n }\n\n // Only auto-include dependencies if explicitly enabled\n // Vite will discover dependencies automatically if they're imported\n if (autoIncludeDeps) {\n const include = Array.isArray(existingInclude)\n ? [...new Set([...existingInclude, ...COMMON_DEPENDENCIES])]\n : [...COMMON_DEPENDENCIES]\n optimizeDepsConfig.include = include\n if (debug) {\n log(`[main] Auto-including common dependencies: ${COMMON_DEPENDENCIES.join(', ')}`)\n }\n } else if (Array.isArray(existingInclude) && existingInclude.length > 0) {\n // Preserve existing includes if provided\n optimizeDepsConfig.include = existingInclude\n }\n\n // If entry points are provided, merge them with existing entries\n // This helps Vite discover all dependencies during initial optimization\n if (entryPoints && entryPoints.length > 0) {\n const mergedEntries = Array.isArray(existingEntries)\n ? [...new Set([...existingEntries, ...entryPoints])]\n : entryPoints\n optimizeDepsConfig.entries = mergedEntries\n if (debug) {\n log(`[main] Using entry points for dependency scanning: ${mergedEntries.join(', ')}`)\n }\n } else if (existingEntries.length > 0) {\n // Preserve existing entries even if none provided\n optimizeDepsConfig.entries = existingEntries\n }\n\n // Configure build externals to prevent bundling Node.js-only packages\n // These packages should not be bundled for browser builds\n const nodeOnlyPackages = [\n 'drizzle-kit',\n '@electric-sql/pglite',\n 'pg',\n 'postgres',\n '@vercel/postgres',\n '@neondatabase/serverless',\n 'mysql2',\n 'mysql2/promise',\n '@planetscale/database',\n 'better-sqlite3',\n 'nunjucks',\n 'fsevents',\n ]\n\n // Node.js built-in modules that should be externalized\n const nodeBuiltins = [\n 'url',\n 'path',\n 'http',\n 'http2',\n 'stream',\n 'crypto',\n 'net',\n 'https',\n 'zlib',\n 'child_process',\n 'fs',\n 'fs/promises',\n 'node:fs',\n 'node:fs/promises',\n 'node:url',\n 'node:path',\n 'node:http',\n 'node:http2',\n 'node:stream',\n 'node:crypto',\n 'node:net',\n 'node:https',\n 'node:zlib',\n 'node:child_process',\n ]\n\n const existingExternal = userConfig.build?.rollupOptions?.external\n const existingExternalArray = Array.isArray(existingExternal)\n ? existingExternal\n : typeof existingExternal === 'string'\n ? [existingExternal]\n : []\n\n // Merge with existing externals, avoiding duplicates\n const allExternals = [\n ...new Set([\n ...existingExternalArray,\n ...nodeOnlyPackages,\n ...nodeBuiltins,\n ]),\n ]\n\n // Create external function that checks both our list and user's function\n const externalFunction = (id: string, importer?: string, isResolved?: boolean): boolean => {\n // Check if it's a node-only package (exact match or subpath)\n if (nodeOnlyPackages.some(pkg => id === pkg || id.startsWith(`${pkg}/`))) {\n if (debug) {\n log(`[build] Externalizing node-only package: ${id}`)\n }\n return true\n }\n\n // Check if it's a Node.js built-in\n if (nodeBuiltins.includes(id)) {\n if (debug) {\n log(`[build] Externalizing Node.js built-in: ${id}`)\n }\n return true\n }\n\n // If user provided a function, call it first\n if (typeof existingExternal === 'function') {\n const userResult = existingExternal(id, importer, isResolved)\n if (userResult) return true\n }\n\n // Otherwise check if it's in the array\n return allExternals.includes(id)\n }\n\n return {\n optimizeDeps: optimizeDepsConfig,\n build: {\n rollupOptions: {\n // Always use the function if we have node-only packages to externalize\n // or if the user provided an external function\n // Otherwise, use the array if we have externals\n external:\n nodeOnlyPackages.length > 0 || typeof existingExternal === 'function'\n ? externalFunction\n : allExternals.length > 0\n ? allExternals\n : undefined,\n },\n },\n }\n },\n\n async resolveId(source, importer, options) {\n // Check if this is an fs-related import we should intercept\n const shouldIntercept = fsModules.includes(source) || \n KNOWN_POLYFILL_TARGETS.some(target => source.includes(target) || source === target)\n\n // Also intercept node-stdlib-browser empty mock paths\n if (source.includes('node-stdlib-browser') && source.includes('mock/empty')) {\n log(`Intercepting node-stdlib-browser empty mock: \"${source}\"`)\n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // Try resolving from plugin context first (SDK's node_modules)\n let resolved = await this.resolve(zenfsModule, PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n \n // If that fails and we have an importer, try resolving from the importer\n if (!resolved && importer) {\n resolved = await this.resolve(zenfsModule, importer, {\n ...options,\n skipSelf: true,\n })\n }\n \n if (resolved) {\n log(`Resolved empty mock to: ${resolved.id}`)\n interceptedResolutions.set(source, resolved.id)\n return resolved\n }\n \n // If resolution fails, return null and let Vite handle it naturally\n // The alias configuration should handle the resolution\n log(`Resolution failed, letting Vite handle: ${zenfsModule}`)\n return null\n }\n\n if (!shouldIntercept) {\n // Also intercept if source is a Vite pre-bundled fs polyfill path or node-stdlib-browser mock\n const sourceWithoutQuery = source.split('?')[0]\n if (\n source.includes('node_fs') || \n (source.includes('.vite/deps') && source.includes('fs') && !source.includes('@zenfs')) ||\n (source.includes('node-stdlib-browser') && (source.includes('mock/empty') || source.includes('empty.js')))\n ) {\n log(`Intercepting Vite pre-bundled fs polyfill/mock: \"${source}\"`)\n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // For .vite/deps paths, let the load hook handle them to avoid chunk reference issues\n if (source.includes('.vite/deps')) {\n // Return null to let Vite continue, then the load hook will intercept\n return null\n }\n \n // For other cases, resolve the module\n let resolved = await this.resolve(zenfsModule, importer || PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n \n if (resolved) {\n log(`Resolved pre-bundled fs to: ${resolved.id}`)\n interceptedResolutions.set(source, resolved.id)\n return resolved\n }\n \n // Fallback: return the module specifier\n log(`Fallback: returning module specifier: ${zenfsModule}`)\n interceptedResolutions.set(source, zenfsModule)\n return { id: zenfsModule, external: false }\n }\n return null\n }\n\n log(`Intercepting resolution: \"${source}\" from ${importer}`)\n\n // Determine the correct ZenFS module\n const isPromiseVariant = source.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n\n // First, try resolving from the plugin's context (SDK's node_modules)\n // This ensures we use the SDK's dependencies even if the consuming project doesn't have them\n let resolved = await this.resolve(zenfsModule, PLUGIN_FILE_URL, {\n ...options,\n skipSelf: true,\n })\n\n // If that fails, try resolving from the original importer (project's node_modules)\n if (!resolved && importer) {\n resolved = await this.resolve(zenfsModule, importer, {\n ...options,\n skipSelf: true,\n })\n }\n\n if (resolved) {\n log(`Resolved to: ${resolved.id}`)\n interceptedResolutions.set(source, resolved.id)\n return resolved\n }\n\n // Fallback: return the module specifier and let Vite handle it\n // Vite should be able to resolve from parent node_modules automatically\n log(`Fallback resolution for: ${zenfsModule}`)\n return { id: zenfsModule, external: false }\n },\n\n shouldTransformCachedModule({ id, code }) {\n // Force transformation of cached fs polyfill modules\n const idWithoutQuery = id.split('?')[0]\n const isFsPolyfill = \n idWithoutQuery.includes('node_fs') || \n (idWithoutQuery.includes('.vite/deps') && idWithoutQuery.includes('fs') && !idWithoutQuery.includes('@zenfs')) ||\n (idWithoutQuery.includes('node-stdlib-browser') && (idWithoutQuery.includes('mock/empty') || idWithoutQuery.includes('empty.js')))\n \n if (isFsPolyfill) {\n log(`Forcing transformation of cached fs polyfill: ${id}`)\n return true\n }\n return false\n },\n\n load(id) {\n // Remove query parameters for matching (e.g., ?v=392cb483)\n const idWithoutQuery = id.split('?')[0]\n \n // Intercept Vite's pre-bundled fs polyfill and replace it with ZenFS\n // Also intercept node-stdlib-browser's empty mock\n // Handle both regular paths and /@fs/ prefixed paths\n const isFsPolyfill = \n idWithoutQuery.includes('node_fs') || \n (idWithoutQuery.includes('.vite/deps') && idWithoutQuery.includes('fs') && !idWithoutQuery.includes('@zenfs')) ||\n (idWithoutQuery.includes('node-stdlib-browser') && (idWithoutQuery.includes('mock/empty') || idWithoutQuery.includes('empty.js')))\n \n if (isFsPolyfill) {\n log(`Intercepting load of fs polyfill/mock file: ${id}`)\n const isPromiseVariant = idWithoutQuery.includes('promises')\n const zenfsModule = isPromiseVariant ? '@zenfs/core/promises' : '@zenfs/core'\n \n // Return a re-export from ZenFS\n return `export * from '${zenfsModule}'; export { default } from '${zenfsModule}';`\n }\n return null\n },\n\n handleHotUpdate({ file, server }) {\n // Invalidate modules that import fs when the plugin file changes\n // This helps with HMR scenarios where the cache might be stale\n if (file.includes('node-stdlib-browser') && file.includes('empty')) {\n log(`Invalidating modules due to fs polyfill change: ${file}`)\n // Let Vite handle the invalidation naturally\n return undefined\n }\n return undefined\n },\n\n transform(code, id) {\n // Skip node_modules except for specific problematic packages\n if (id.includes('node_modules') && !id.includes('@seedprotocol')) {\n return null\n }\n\n // Handle dynamic imports of fs\n const dynamicFsImportPattern = /import\\s*\\(\\s*['\"`](fs|node:fs|fs\\/promises|node:fs\\/promises)['\"`]\\s*\\)/g\n \n if (dynamicFsImportPattern.test(code)) {\n log(`Transforming dynamic fs imports in: ${id}`)\n \n const transformed = code.replace(dynamicFsImportPattern, (match, moduleName) => {\n const isPromise = moduleName.includes('promises')\n const replacement = isPromise ? '@zenfs/core/promises' : '@zenfs/core'\n return `import('${replacement}')`\n })\n\n return {\n code: transformed,\n map: null,\n }\n }\n\n return null\n },\n\n transformIndexHtml(html) {\n if (!autoInit) return html\n\n // Inject ZenFS initialization script before other scripts\n const initScript = `\n<script type=\"module\">\n import { configure } from '@zenfs/core';\n import { IndexedDB } from '@zenfs/dom';\n \n window.__seedFsReady = configure({\n mounts: {\n '/': IndexedDB,\n },\n }).then(() => {\n console.log('[seed-protocol] ZenFS initialized');\n }).catch(err => {\n console.error('[seed-protocol] ZenFS initialization failed:', err);\n });\n</script>`\n\n // Insert before closing head tag or at the start of body\n if (html.includes('</head>')) {\n return html.replace('</head>', `${initScript}\\n</head>`)\n }\n \n return html.replace('<body>', `<body>\\n${initScript}`)\n },\n\n buildEnd() {\n if (debug && interceptedResolutions.size > 0) {\n log('Summary of intercepted resolutions:')\n for (const [source, target] of interceptedResolutions) {\n log(` ${source} -> ${target}`)\n }\n }\n },\n }\n\n /**\n * Cleanup plugin: catches any remaining fs references in the final bundle\n */\n const cleanupPlugin: Plugin = {\n name: 'seed-protocol:cleanup',\n enforce: 'post',\n apply: 'build',\n\n generateBundle(options, bundle) {\n for (const [fileName, chunk] of Object.entries(bundle)) {\n if (chunk.type !== 'chunk') continue\n\n // Check for any remaining problematic fs references\n const problematicPatterns = [\n /require\\s*\\(\\s*['\"`]fs['\"`]\\s*\\)/g,\n /from\\s*['\"`]fs['\"`]/g,\n /__vite-browser-external.*fs/g,\n ]\n\n let hasIssue = false\n for (const pattern of problematicPatterns) {\n if (pattern.test(chunk.code)) {\n hasIssue = true\n log(`Warning: Potential unresolved fs reference in ${fileName}`)\n break\n }\n }\n\n if (hasIssue && debug) {\n // Log the context around the problematic reference\n const lines = chunk.code.split('\\n')\n lines.forEach((line, i) => {\n if (line.includes('fs') && (line.includes('require') || line.includes('from'))) {\n log(` Line ${i + 1}: ${line.substring(0, 100)}...`)\n }\n })\n }\n }\n },\n }\n\n return [observerPlugin, mainPlugin, cleanupPlugin]\n}\n\n/**\n * Helper to ensure ZenFS is ready before using fs operations\n */\nexport async function waitForFs(): Promise<void> {\n if (typeof window !== 'undefined' && window.__seedFsReady) {\n await window.__seedFsReady\n }\n}\n\n// Type augmentation for the window object\ndeclare global {\n interface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KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;oBACpC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,KAAI;wBACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE;AAC9E,4BAAA,GAAG,CAAC,CAAA,OAAA,EAAU,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,GAAA,CAAK,CAAC;wBACtD;AACF,oBAAA,CAAC,CAAC;gBACJ;YACF;QACF,CAAC;KACF;AAED,IAAA,OAAO,CAAC,cAAc,EAAE,UAAU,EAAE,aAAa,CAAC;AACpD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedprotocol/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "The SDK for Seed Protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/main.cjs",