{"version":3,"file":"nodeCompat.mjs","names":[],"sources":["../../src/plugin/nodeCompat.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n// The `gt-next/config` entry runs in plain Node (next.config is loaded, not\n// bundled), so the ESM build (`dist/config.mjs`) has no CJS `require` or\n// `__dirname` and the build's `polyfillRequire: false` means rolldown won't\n// inject them. Derive both here; only import this module from the config\n// graph — `createRequire` from `node:module` breaks client bundlers.\n\nexport const nodeRequire: NodeJS.Require =\n  typeof require === 'function' ? require : createRequire(import.meta.url);\n\nconst nodeCompatDirname: string =\n  typeof __dirname === 'string'\n    ? __dirname\n    : path.dirname(fileURLToPath(import.meta.url));\n\n// This module is emitted to <dist>/plugin/, one level below dist assets like\n// gt_swc_plugin.wasm, in both the CJS and ESM builds.\nexport const distDir: string = path.resolve(nodeCompatDirname, '..');\n"],"mappings":";;;;AAUA,MAAa,cACX,OAAO,YAAY,aAAa,UAAU,cAAc,OAAO,KAAK,IAAI;AAE1E,MAAM,oBACJ,OAAO,cAAc,WACjB,YACA,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAIlD,MAAa,UAAkB,KAAK,QAAQ,mBAAmB,KAAK"}