tailwind-styled-v4 5.0.8 → 5.0.9

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/next.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/presentation/next/src/schemas.ts","../packages/domain/shared/src/workerResolver.ts","../packages/domain/shared/src/index.ts","../packages/presentation/next/src/withTailwindStyled.ts"],"names":["path","isBrowser","getDirnameFromUrl","lastSlash","require","resolveLoaderPath"],"mappings":";;;;;;;;;;;;AAEA,IAAM,eAAe,CAAC,KAAA,KACpB,MAAM,MAAA,CACH,GAAA,CAAI,CAAC,KAAA,KAAU;AACd,EAAA,MAAM,CAAA,GAAI,MAAM,IAAA,CAAK,MAAA,GAAS,IAAI,KAAA,CAAM,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA,GAAI,QAAA;AACzD,EAAA,OAAO,CAAA,EAAG,CAAC,CAAA,EAAA,EAAK,KAAA,CAAM,OAAO,CAAA,CAAA;AAC/B,CAAC,CAAA,CACA,KAAK,IAAI,CAAA;AAEd,IAAM,eAAA,GAAkB,CAAI,MAAA,EAAsB,IAAA,EAAe,KAAA,KAAqB;AACpF,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,SAAA,CAAU,IAAI,CAAA;AACpC,EAAA,IAAI,MAAA,CAAO,OAAA,EAAS,OAAO,MAAA,CAAO,IAAA;AAClC,EAAA,MAAM,IAAI,UAAU,CAAA,EAAG,KAAK,KAAK,YAAA,CAAa,MAAA,CAAO,KAAK,CAAC,CAAA,CAAE,CAAA;AAC/D,CAAA;AAEO,IAAM,wBAAA,GAA2B,EAAE,MAAA,CAAO;AAAA,EAC/C,IAAA,EAAM,CAAA,CAAE,OAAA,CAAQ,cAAc,EAAE,QAAA,EAAS;AAAA,EACzC,kBAAA,EAAoB,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS;AAAA,EACzC,WAAA,EAAa,CAAA,CAAE,OAAA,EAAQ,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AAAA,QACrB;AAEA,QAAA,IAAI;AACF,UAAA,MAAM,MAAA,GAAS,eAAA,CAAgB,MAAA,EAAQ,cAAc,CAAA;AACrD,UAAA,OAAO,kBAAkB,OAAA,GAAU,MAAA,CAAO,KAAK,KAAK,CAAA,GAAI,MAAM,MAAM,CAAA;AAAA,QACtE,SAAS,KAAA,EAAO;AACd,UAAA,MAAM,IAAI,MAAM,wEAAA,EAA0E;AAAA,YACxF,KAAA,EAAO;AAAA,WACR,CAAA;AAAA,QACH;AAAA,MACF,CAAA;AAAA,MACA,SAAA,EAAW;AAAA,QACT,GAAI,UAAA,CAAW,SAAA,IAAa,EAAC;AAAA,QAC7B,KAAA,EAAO,mBAAA;AAAA,UACJ,UAAA,CAAW,SAAA,EAAW,KAAA,IAAS,EAAC;AAAA,UACjC,mBAAA,CAAoB,qBAAqB,aAAa;AAAA;AACxD;AACF,KACF;AAAA,EACF,CAAA;AACF","file":"next.mjs","sourcesContent":["import { z } from \"zod\"\r\n\r\nconst formatIssues = (error: z.ZodError): string =>\r\n error.issues\r\n .map((issue) => {\r\n const p = issue.path.length > 0 ? issue.path.join(\".\") : \"<root>\"\r\n return `${p}: ${issue.message}`\r\n })\r\n .join(\"; \")\r\n\r\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\r\n const parsed = schema.safeParse(data)\r\n if (parsed.success) return parsed.data\r\n throw new TypeError(`${label}: ${formatIssues(parsed.error)}`)\r\n}\r\n\r\nexport const NextAdapterOptionsSchema = z.object({\r\n mode: z.literal(\"zero-runtime\").optional(),\r\n autoClientBoundary: z.boolean().optional(),\r\n addDataAttr: z.boolean().optional(),\r\n hoist: z.boolean().optional(),\r\n routeCss: z.boolean().optional(),\r\n incremental: z.boolean().optional(),\r\n verbose: z.boolean().optional(),\r\n include: z.instanceof(RegExp).optional(),\r\n exclude: z.instanceof(RegExp).optional(),\r\n})\r\n\r\nexport type NextAdapterOptionsInput = z.infer<typeof NextAdapterOptionsSchema>\r\n\r\nexport const parseNextAdapterOptions = (options: unknown) =>\r\n parseWithSchema(NextAdapterOptionsSchema, options ?? {}, \"next adapter options are invalid\")\r\n","/**\r\n * Worker/bootstrap path resolution untuk artifact release safety.\r\n * Dari monorepo checklist: \"Perkuat worker/bootstrap path agar artifact release aman\"\r\n *\r\n * Masalah: path ke worker/loader script bisa berbeda antara:\r\n * - Development (src/*.ts)\r\n * - Built dist (dist/*.js / dist/*.cjs)\r\n * - Packed npm artifact (dist/ saja, tanpa src/)\r\n *\r\n * Solusi: resolve path secara hierarchical dengan fallback yang eksplisit.\r\n */\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\nconst NODE_URL = typeof window === \"undefined\" || typeof document === \"undefined\" ? \"node:url\" : null\r\nconst NODE_FS = typeof window === \"undefined\" || typeof document === \"undefined\" ? \"node:fs\" : null\r\nconst NODE_PATH = typeof window === \"undefined\" || typeof document === \"undefined\" ? \"node:path\" : null\r\n\r\nfunction getDirnameFromUrl(importMetaUrl: string): string {\r\n if (!importMetaUrl) return \"\"\r\n if (isBrowser) return \"\"\r\n\r\n try {\r\n const nodeUrl = require(NODE_URL!)\r\n return nodeUrl.fileURLToPath(importMetaUrl)\r\n } catch {\r\n if (importMetaUrl.startsWith(\"file://\")) {\r\n return importMetaUrl.slice(7)\r\n }\r\n return \"\"\r\n }\r\n}\r\n\r\nfunction resolvePath(...segments: string[]): string {\r\n if (isBrowser) return segments.join(\"/\").replace(/\\/+/g, \"/\")\r\n try {\r\n const nodePath = require(NODE_PATH!)\r\n return nodePath.resolve(...segments)\r\n } catch {\r\n return segments.join(\"/\").replace(/\\/+/g, \"/\")\r\n }\r\n}\r\n\r\nfunction existsSync(path: string): boolean {\r\n if (isBrowser) return false\r\n try {\r\n const nodeFs = require(NODE_FS!)\r\n return nodeFs.existsSync(path)\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\nexport interface WorkerPathOptions {\r\n /** Nama file worker tanpa extension */\r\n basename: string\r\n /** Import meta URL dari caller module */\r\n importMetaUrl: string\r\n /** Extensions yang dicoba secara urutan (default: [\".cjs\", \".js\", \".mjs\"]) */\r\n extensions?: string[]\r\n /** Sub-directories relatif dari runtimeDir yang dicoba */\r\n subdirs?: string[]\r\n /** Throw jika tidak ditemukan (default: true) */\r\n required?: boolean\r\n}\r\n\r\nexport interface WorkerPathResult {\r\n /** Absolute path ke worker file */\r\n path: string\r\n /** Extension yang ditemukan */\r\n extension: string\r\n /** Apakah ini dari CJS atau ESM artifact */\r\n format: \"cjs\" | \"esm\"\r\n}\r\n\r\n/**\r\n * Resolve worker/loader script path yang aman untuk release artifacts.\r\n *\r\n * Prioritas:\r\n * 1. CJS (.cjs) — untuk Node.js workers yang butuh require()\r\n * 2. JS (.js) — bundled output\r\n * 3. MJS (.mjs) — explicit ESM\r\n *\r\n * @example\r\n * const workerPath = resolveWorkerPath({\r\n * basename: \"scanner-worker\",\r\n * importMetaUrl: import.meta.url,\r\n * })\r\n * // → \"/path/to/dist/scanner-worker.cjs\"\r\n */\r\nexport function resolveWorkerPath(opts: WorkerPathOptions): WorkerPathResult {\r\n if (isBrowser) {\r\n throw new Error(\"Worker resolution not available in browser\")\r\n }\r\n\r\n const {\r\n basename,\r\n importMetaUrl,\r\n extensions = [\".cjs\", \".js\", \".mjs\"],\r\n subdirs = [\".\", \"workers\", \"lib\"],\r\n required = true,\r\n } = opts\r\n\r\n const runtimeDir = getDirnameFromUrl(importMetaUrl)\r\n\r\n // Try each subdir + extension combination\r\n for (const subdir of subdirs) {\r\n for (const ext of extensions) {\r\n const candidate = resolvePath(runtimeDir, subdir, `${basename}${ext}`)\r\n if (existsSync(candidate)) {\r\n return {\r\n path: candidate,\r\n extension: ext,\r\n format: ext === \".cjs\" ? \"cjs\" : \"esm\",\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (required) {\r\n const tried = subdirs.flatMap(d =>\r\n extensions.map(e => resolvePath(runtimeDir, d, `${basename}${e}`))\r\n )\r\n throw new Error(\r\n `[worker-resolver] Could not find worker script \"${basename}\".\\n` +\r\n `Tried:\\n${tried.map(p => ` - ${p}`).join(\"\\n\")}\\n` +\r\n `Ensure the package is built: npm run build`\r\n )\r\n }\r\n\r\n return { path: \"\", extension: \"\", format: \"cjs\" }\r\n}\r\n\r\n/**\r\n * Resolve loader path (untuk webpack/rspack/vite loaders).\r\n * Same as resolveWorkerPath but dengan nama yang lebih eksplisit.\r\n */\r\nexport function resolveLoaderPath(\r\n loaderBasename: string,\r\n importMetaUrl: string\r\n): string {\r\n return resolveWorkerPath({\r\n basename: loaderBasename,\r\n importMetaUrl,\r\n extensions: [\".cjs\", \".js\", \".mjs\"],\r\n subdirs: [\".\", \"loaders\", \"lib\"],\r\n }).path\r\n}","const isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// ESM-safe require detection\r\nlet nodeModuleRef: any = null\r\nfunction getNodeModuleRef() {\r\n if (isBrowser) return null\r\n if (nodeModuleRef !== null) return nodeModuleRef\r\n try {\r\n const test = typeof require === 'function' ? require('node:module') : null\r\n nodeModuleRef = test\r\n return test\r\n } catch {\r\n nodeModuleRef = null\r\n return null\r\n }\r\n}\r\n\r\nlet _nodeCrypto: any = null\r\nlet _nodeFs: any = null\r\nlet _nodeModule: any = null\r\nlet _nodePath: any = null\r\nlet _nodeUrl: any = null\r\n\r\nfunction getNodeCrypto() {\r\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire(import.meta.url)(\"node:crypto\")\r\n return _nodeCrypto!\r\n}\r\nfunction getNodeFs() {\r\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)(\"node:fs\")\r\n return _nodeFs!\r\n}\r\nfunction getNodeModule() {\r\n if (isBrowser) throw new Error(\"node:module not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeModule) _nodeModule = nodeRequire\r\n return _nodeModule!\r\n}\r\nfunction getNodePath() {\r\n if (isBrowser) throw new Error(\"node:path not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)(\"node:path\")\r\n return _nodePath!\r\n}\r\nfunction getNodeUrl() {\r\n if (isBrowser) throw new Error(\"node:url not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)(\"node:url\")\r\n return _nodeUrl!\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Types\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type TokenMap = Record<string, string>\r\n\r\nexport type VariantValue = string | number | boolean | undefined\r\n\r\nexport type VariantProps = Record<string, VariantValue>\r\n\r\nexport type HtmlTagName = keyof HTMLElementTagNameMap\r\n\r\nexport type CompoundCondition = Record<string, string | number | boolean>\r\n\r\nexport type VariantMatrix = Record<string, Array<string | number | boolean>>\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Logging\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface Logger {\r\n warn(...args: unknown[]): void\r\n debug(...args: unknown[]): void\r\n error(...args: unknown[]): void\r\n log(...args: unknown[]): void\r\n}\r\n\r\nexport function createLogger(namespace: string): Logger {\r\n const prefix = `[${namespace}]`\r\n return {\r\n warn(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n debug(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n error(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n log(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n }\r\n}\r\n\r\nexport function createDebugLogger(namespace: string, label?: string): (msg: string) => void {\r\n const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`\r\n return (msg: string) => {\r\n if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {\r\n console.debug(prefix, msg)\r\n }\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error handling\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type ErrorSource = \"rust\" | \"validation\" | \"compile\" | \"io\" | \"config\" | \"unknown\"\r\n\r\ntype ZodLikeIssue = {\r\n path?: readonly PropertyKey[]\r\n message?: string\r\n}\r\n\r\nfunction formatIssuePath(path?: readonly PropertyKey[]): string {\r\n if (!path || path.length === 0) return \"(root)\"\r\n return path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n}\r\n\r\nexport class TwError extends Error {\r\n /** @deprecated Gunakan source */\r\n public readonly domain: string\r\n public readonly source: ErrorSource\r\n public readonly code: string\r\n public readonly originalCause?: unknown\r\n\r\n constructor(domainOrSource: string, code: string, message: string, cause?: unknown) {\r\n super(message)\r\n this.name = \"TwError\"\r\n this.domain = domainOrSource\r\n this.source = domainOrSource as ErrorSource\r\n this.code = code\r\n this.originalCause = cause\r\n if (Error.captureStackTrace) Error.captureStackTrace(this, TwError)\r\n }\r\n\r\n static fromIo(code: string, message: string): TwError {\r\n return new TwError(\"io\", code, message)\r\n }\r\n\r\n static fromCompile(code: string, message: string): TwError {\r\n return new TwError(\"compile\", code, message)\r\n }\r\n\r\n static fromRust(err: { code?: string; message?: string } | Error | unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(\"rust\", \"RUST_ERROR\", err.message, err)\r\n if (err && typeof err === \"object\") {\r\n const e = err as { code?: string; message?: string }\r\n return new TwError(\"rust\", e.code ?? \"RUST_ERROR\", e.message ?? String(err), err)\r\n }\r\n return new TwError(\"rust\", \"RUST_ERROR\", String(err), err)\r\n }\r\n\r\n /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */\r\n static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[] }): TwError {\r\n const first = err.issues?.[0] ?? err.errors?.[0]\r\n const path = formatIssuePath(first?.path)\r\n const message = first ? `${path}: ${first.message}` : \"Schema validation failed\"\r\n return new TwError(\"validation\", \"SCHEMA_VALIDATION_FAILED\", message, err)\r\n }\r\n\r\n static wrap(source: string, code: string, err: unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(source, code, err.message, err)\r\n return new TwError(source, code, String(err), err)\r\n }\r\n\r\n override toString(): string {\r\n return `TwError [${this.source}:${this.code}] ${this.message}`\r\n }\r\n\r\n toJSON(): { name: string; source: string; code: string; message: string } {\r\n return { name: this.name, source: this.source, code: this.code, message: this.message }\r\n }\r\n\r\n toCliMessage(): string {\r\n return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`\r\n }\r\n}\r\n\r\nexport function wrapUnknownError(domain: string, code: string, error: unknown): TwError {\r\n return TwError.wrap(domain, code, error)\r\n}\r\n\r\nexport function isTwError(err: unknown): err is TwError {\r\n return err instanceof TwError\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Native binding resolution\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface LoadNativeBindingOptions<T> {\r\n runtimeDir: string\r\n candidates: string[]\r\n isValid: (module: unknown) => module is T\r\n invalidExportMessage: string\r\n}\r\n\r\nexport interface LoadNativeBindingResult<T> {\r\n binding: T | null\r\n loadErrors: Array<{ path: string; message: string }>\r\n loadedPath?: string\r\n}\r\n\r\nexport function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T> {\r\n if (isBrowser) {\r\n return { binding: null, loadErrors: [{ path: \"\", message: \"Native bindings not available in browser\" }] }\r\n }\r\n \r\n const { runtimeDir, candidates, isValid } = options\r\n const loadErrors: Array<{ path: string; message: string }> = []\r\n const path = getNodePath()\r\n const fs = getNodeFs()\r\n\r\n for (const candidate of candidates) {\r\n const candidatePath = path.resolve(runtimeDir, candidate)\r\n try {\r\n if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + \".node\")) {\r\n continue\r\n }\r\n const mod = requireNativeModule(candidatePath)\r\n if (mod && isValid(mod)) {\r\n return { binding: mod, loadErrors, loadedPath: candidatePath }\r\n }\r\n loadErrors.push({ path: candidatePath, message: options.invalidExportMessage })\r\n } catch (e) {\r\n loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) })\r\n }\r\n }\r\n\r\n return { binding: null, loadErrors }\r\n}\r\n\r\nfunction getRequire(): NodeRequire {\r\n if (isBrowser) return (() => { throw new Error(\"require not available in browser\") }) as unknown as NodeRequire\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) return (() => { throw new Error(\"require not available\") }) as unknown as NodeRequire\r\n return nodeRequire.createRequire(import.meta.url)\r\n}\r\n\r\nconst _require = getRequire()\r\n\r\nfunction requireNativeModule(path: string): unknown {\r\n return _require(path)\r\n}\r\n\r\nexport interface ResolveCandidatesOptions {\r\n runtimeDir: string\r\n envVarNames?: string[]\r\n includeDefaultCandidates?: boolean\r\n enforceNodeExtensionForEnvPath?: boolean\r\n}\r\n\r\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\r\n if (isBrowser) return []\r\n \r\n const { runtimeDir, envVarNames = [], includeDefaultCandidates = true, enforceNodeExtensionForEnvPath = false } = options\r\n const candidates: string[] = []\r\n const path = getNodePath()\r\n const fs = getNodeFs()\r\n\r\n for (const envVar of envVarNames) {\r\n const envPath = process.env[envVar]\r\n if (envPath) {\r\n if (enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\")) {\r\n candidates.push(envPath + \".node\")\r\n } else {\r\n candidates.push(envPath)\r\n }\r\n }\r\n }\r\n\r\n if (!includeDefaultCandidates) return candidates\r\n\r\n if (fs.existsSync(runtimeDir)) {\r\n try {\r\n const entries = fs.readdirSync(runtimeDir)\r\n for (const entry of entries) {\r\n if (entry.endsWith(\".node\")) {\r\n candidates.push(entry)\r\n }\r\n }\r\n } catch {\r\n // ignore read errors\r\n }\r\n }\r\n\r\n const platform = typeof process !== \"undefined\" ? process.platform : \"\"\r\n const ext = platform === \"win32\" ? \".dll\" : platform === \"darwin\" ? \".dylib\" : \".so\"\r\n const defaultBindingName = `tailwind_styled_parser${ext}`\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", defaultBindingName))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", defaultBindingName))\r\n candidates.push(path.resolve(process.cwd(), \"native\", defaultBindingName))\r\n\r\n return Array.from(new Set(candidates))\r\n}\r\n\r\nexport function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n \r\n if (dir) return getNodePath().resolve(dir)\r\n try {\r\n return getNodeUrl().fileURLToPath(importMetaUrl)\r\n } catch {\r\n return process.cwd()\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Hashing\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function hashContent(content: string, algorithm: string = \"md5\", length?: number): string {\r\n if (isBrowser) {\r\n // Simple hash fallback for browser\r\n let hash = 0\r\n for (let i = 0; i < content.length; i++) {\r\n const char = content.charCodeAt(i)\r\n hash = ((hash << 5) - hash) + char\r\n hash = hash & hash\r\n }\r\n return Math.abs(hash).toString(16).slice(0, length ?? 8)\r\n }\r\n const hash = getNodeCrypto().createHash(algorithm).update(content).digest(\"hex\")\r\n return length ? hash.slice(0, length) : hash\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error formatting\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function formatErrorMessage(error: unknown): string {\r\n if (error instanceof TwError) return error.toString()\r\n if (error instanceof Error) return error.message\r\n return String(error)\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LRU Cache\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport class LRUCache<K, V> {\r\n private capacity: number\r\n private cache: Map<K, V>\r\n\r\n constructor(capacity: number) {\r\n this.capacity = capacity\r\n this.cache = new Map()\r\n }\r\n\r\n get(key: K): V | undefined {\r\n if (!this.cache.has(key)) return undefined\r\n const value = this.cache.get(key)!\r\n this.cache.delete(key)\r\n this.cache.set(key, value)\r\n return value\r\n }\r\n\r\n set(key: K, value: V): void {\r\n if (this.cache.has(key)) {\r\n this.cache.delete(key)\r\n } else if (this.cache.size >= this.capacity) {\r\n const firstKey = this.cache.keys().next().value\r\n if (firstKey !== undefined) {\r\n this.cache.delete(firstKey)\r\n }\r\n }\r\n this.cache.set(key, value)\r\n }\r\n\r\n delete(key: K): boolean {\r\n return this.cache.delete(key)\r\n }\r\n\r\n has(key: K): boolean {\r\n return this.cache.has(key)\r\n }\r\n\r\n clear(): void {\r\n this.cache.clear()\r\n }\r\n\r\n entries(): IterableIterator<[K, V]> {\r\n return this.cache.entries()\r\n }\r\n\r\n get size(): number {\r\n return this.cache.size\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Trace Utilities\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TraceSnapshot, TraceSummary } from \"./trace\"\r\nexport {\r\n getHealthColor,\r\n getModeColor,\r\n formatMemory,\r\n formatDuration,\r\n calculateHealth,\r\n getBuildTimeColor,\r\n getMemoryColor,\r\n createTraceSnapshot,\r\n getPipelinePercentages,\r\n} from \"./trace\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Performance Telemetry\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error Codes\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { ErrorCode } from \"./error-codes\"\r\nexport { ERROR_CODES, getSuggestion, formatErrorCode } from \"./error-codes\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Tailwind Compatibility\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TailwindInfo } from \"./compatibility\"\r\nexport { detectTailwind, assertTailwindV4, getTailwindVersion, isTailwindV4 } from \"./compatibility\"\r\n\r\n// ── Native binding schemas (Zod boundary validation)\r\nexport {\r\n NativeScanFileSchema, NativeScanResultSchema,\r\n NativeAnalyzerReportSchema, NativeTransformResultSchema,\r\n NativeCssCompileResultSchema, NativeWatchResultSchema,\r\n NativeCacheEntrySchema, NativeCacheReadResultSchema,\r\n safeParseNative, parseNative,\r\n} from './native-schemas'\r\n\r\n// ── ESM-safe runtime helpers ──────────────────────────────────────────────\r\nexport {\r\n createEsmRequire,\r\n getDirname,\r\n getFilename,\r\n resolveFromRoot,\r\n tryRequire,\r\n resolveNativeNodePath,\r\n} from \"./esmHelpers\"\r\n\r\n// ── Performance telemetry ────────────────────────────────────────────────────\r\nexport {\r\n TelemetryCollector,\r\n getGlobalTelemetry,\r\n resetGlobalTelemetry,\r\n createBuildTimer,\r\n type BuildTelemetry,\r\n type TelemetrySummary,\r\n type BuildPhases,\r\n} from \"./telemetry\"\r\n\r\n// ── Config/JSON schema validation ─────────────────────────────────────────────\r\nexport {\r\n ScanCacheSchema,\r\n ScanCacheClassEntrySchema,\r\n TailwindConfigSchema,\r\n RegistryPluginEntrySchema,\r\n RegistryFileSchema,\r\n PackageJsonSchema,\r\n parseJsonWithSchema,\r\n parseJsonFileWithSchema,\r\n type ScanCache,\r\n type ScanCacheClassEntry,\r\n type TailwindConfig,\r\n type RegistryPluginEntry,\r\n type RegistryFile,\r\n type PackageJson,\r\n} from \"./configSchemas\"\r\n\r\n// ── Worker/bootstrap path resolution ─────────────────────────────────────────\r\nexport {\r\n resolveWorkerPath,\r\n resolveLoaderPath,\r\n type WorkerPathOptions,\r\n type WorkerPathResult,\r\n} from \"./workerResolver\"\r\n\r\n// ── Codegen helpers ───────────────────────────────────────────────────────────\r\nexport {\r\n generateComponentCode,\r\n generateStorybookStory,\r\n generateClassRenameCodemod,\r\n generateBarrelFile,\r\n type ComponentCodegenOptions,\r\n} from \"./codegen\"\r\n\r\n// ── Native binary resolution (QA #1) ─────────────────────────────────────────\r\nexport {\r\n resolveNativeBinary,\r\n formatNativeNotFoundError,\r\n type NativeResolutionResult,\r\n} from \"./native-resolution\"\r\n\r\n// ── Shared observability contract ────────────────────────────────────────────\r\nexport {\r\n createObservabilityClient,\r\n type ClassInspection,\r\n type ClassProperty,\r\n type ClassUsageLocation,\r\n type BuildTrace,\r\n type BuildPhaseTrace,\r\n type DashboardMetrics,\r\n type DashboardSummary,\r\n type ObservabilityClient,\r\n} from \"./observability\"\r\n","import fs from \"node:fs\"\r\nimport { createRequire } from \"node:module\"\r\nimport path from \"node:path\"\r\n\r\nfunction getDirnameFromUrl(importMetaUrl: string): string {\r\n if (typeof importMetaUrl !== 'string') return ''\r\n // Simple URL parsing without Node.js modules\r\n if (importMetaUrl.startsWith('file://')) {\r\n let withoutFile = importMetaUrl.slice(7)\r\n // On Windows, file URLs can be like file:///C:/path\r\n if (withoutFile[0] === '/' && withoutFile[2] === ':') {\r\n withoutFile = withoutFile.slice(1) // Remove leading / from C:/\r\n }\r\n const lastSlash = Math.max(withoutFile.lastIndexOf('/'), withoutFile.lastIndexOf('\\\\'))\r\n return lastSlash > 0 ? withoutFile.slice(0, lastSlash) : '/'\r\n }\r\n // Fallback for other URL types\r\n const lastSlash = Math.max(importMetaUrl.lastIndexOf('/'), importMetaUrl.lastIndexOf('\\\\'))\r\n return lastSlash > 0 ? importMetaUrl.slice(0, lastSlash) : ''\r\n}\r\n\r\nimport { resolveLoaderPath as sharedResolveLoaderPath } from \"@tailwind-styled/shared\"\r\n\r\nimport { parseNextAdapterOptions } from \"./schemas\"\r\n\r\nconst require = createRequire(import.meta.url)\r\n\r\ninterface TailwindStyledLoaderOptions {\r\n mode?: \"zero-runtime\"\r\n autoClientBoundary?: boolean\r\n addDataAttr?: boolean\r\n hoist?: boolean\r\n routeCss?: boolean\r\n incremental?: boolean\r\n verbose?: boolean\r\n preserveImports?: boolean\r\n}\r\n\r\nexport interface TailwindStyledNextOptions\r\n extends Pick<\r\n TailwindStyledLoaderOptions,\r\n \"mode\" | \"autoClientBoundary\" | \"addDataAttr\" | \"hoist\" | \"routeCss\" | \"incremental\" | \"verbose\"\r\n > {\r\n include?: RegExp\r\n exclude?: RegExp\r\n}\r\n\r\nimport type { NextConfig } from \"next\"\r\n\r\n// Derive webpack types directly from Next.js — always in sync with installed version\r\ntype NextWebpackFn = NonNullable<NextConfig[\"webpack\"]>\r\ntype NextWebpackConfig = Parameters<NextWebpackFn>[0]\r\ntype NextWebpackOptions = Parameters<NextWebpackFn>[1]\r\n\r\n// Derive turbopack rule types from NextConfig\r\ntype TurboRules = NonNullable<NonNullable<NextConfig[\"turbopack\"]>[\"rules\"]>\r\ntype TurbopackLoaderRule = TurboRules[string]\r\n\r\n// Derive webpack module rule type for safe iteration\r\ntype ModuleRule = NonNullable<NonNullable<NextWebpackConfig[\"module\"]>[\"rules\"]>[number]\r\ntype RuleUseEntry = { loader?: string; options?: unknown }\r\n\r\ninterface NextWebpackUseEntry {\r\n loader: string\r\n options?: TailwindStyledLoaderOptions\r\n}\r\n\r\ninterface NextWebpackRule {\r\n test?: RegExp\r\n exclude?: RegExp\r\n enforce?: \"pre\" | \"post\"\r\n use?: NextWebpackUseEntry[]\r\n}\r\n\r\n\r\nconst resolveRuntimeDir = (): string => getDirnameFromUrl(import.meta.url)\r\n\r\nconst resolveLoaderPath = (basename: string): string => {\r\n try {\r\n return sharedResolveLoaderPath(basename, import.meta.url)\r\n } catch {\r\n const runtimeDir = resolveRuntimeDir()\r\n const candidates = [\r\n path.resolve(runtimeDir, `${basename}.mjs`),\r\n path.resolve(runtimeDir, `${basename}.js`),\r\n path.resolve(runtimeDir, `${basename}.cjs`),\r\n ]\r\n\r\n for (const candidate of candidates) {\r\n if (fs.existsSync(candidate)) {\r\n return candidate\r\n }\r\n }\r\n\r\n throw new Error(\r\n `[tailwind-styled] Loader not found for '${basename}'. Checked: ${candidates.join(\", \")}`\r\n )\r\n }\r\n}\r\n\r\nfunction checkNextVersion(): void {\r\n try {\r\n const pkgPath = require.resolve(\"next/package.json\")\r\n const { version } = require(pkgPath)\r\n const major = Number.parseInt(version.split(\".\")[0], 10)\r\n if (major < 15) {\r\n console.warn(\r\n `[tailwind-styled] Next.js ${version} detected. Recommended: 15+ for full Turbopack support.`\r\n )\r\n }\r\n } catch {\r\n // next not resolvable — skip check\r\n }\r\n}\r\n\r\nconst DEFAULT_INCLUDE = /\\.[jt]sx?$/\r\nconst DEFAULT_EXCLUDE = /node_modules/\r\n\r\nconst createLoaderOptions = (options: TailwindStyledNextOptions): Readonly<TailwindStyledLoaderOptions> => {\r\n const opts: TailwindStyledLoaderOptions = {\r\n mode: options.mode ?? \"zero-runtime\",\r\n autoClientBoundary: options.autoClientBoundary ?? true,\r\n preserveImports: true,\r\n }\r\n if (options.addDataAttr !== undefined) opts.addDataAttr = options.addDataAttr\r\n if (options.hoist !== undefined) opts.hoist = options.hoist\r\n if (options.routeCss !== undefined) opts.routeCss = options.routeCss\r\n if (options.incremental !== undefined) opts.incremental = options.incremental\r\n if (options.verbose !== undefined) opts.verbose = options.verbose\r\n return Object.freeze(opts)\r\n}\r\n\r\nconst buildTurbopackRules = (\r\n loaderPath: string,\r\n loaderOptions: TailwindStyledLoaderOptions\r\n): TurboRules => {\r\n const extensions = [\"js\", \"jsx\", \"ts\", \"tsx\", \"mjs\", \"cjs\"]\r\n return Object.fromEntries(\r\n extensions.map((ext) => [\r\n `*.${ext}`,\r\n { loaders: [{ loader: loaderPath, options: loaderOptions }] },\r\n ])\r\n ) as TurboRules\r\n}\r\n\r\nconst normalizeLoaderPath = (loaderPath: string): string => path.resolve(loaderPath)\r\n\r\nconst applyWebpackRule = (\r\n config: NextWebpackConfig,\r\n options: TailwindStyledNextOptions,\r\n loaderPath: string\r\n): NextWebpackConfig => {\r\n const loaderOptions = createLoaderOptions(options)\r\n const rules = config.module?.rules ?? []\r\n const normalizedLoaderPath = normalizeLoaderPath(loaderPath)\r\n\r\n const alreadyRegistered = rules.some(\r\n (rule: ModuleRule) =>\r\n Array.isArray(rule?.use) &&\r\n (rule.use as RuleUseEntry[]).some(\r\n (entry: RuleUseEntry) =>\r\n typeof entry.loader === \"string\" &&\r\n normalizeLoaderPath(entry.loader) === normalizedLoaderPath\r\n )\r\n )\r\n\r\n if (alreadyRegistered) return config\r\n\r\n const tailwindStyledRule: NextWebpackRule = {\r\n test: options.include ?? DEFAULT_INCLUDE,\r\n exclude: options.exclude ?? DEFAULT_EXCLUDE,\r\n enforce: \"pre\",\r\n use: [{ loader: loaderPath, options: loaderOptions }],\r\n }\r\n\r\n config.module = {\r\n ...(config.module ?? {}),\r\n rules: [...rules, tailwindStyledRule],\r\n }\r\n\r\n const externalPackages = [\r\n \"@tailwind-styled/shared\",\r\n \"@tailwind-styled/compiler\", \r\n \"@tailwind-styled/engine\",\r\n \"@tailwind-styled/plugin\",\r\n \"@tailwind-styled/core\",\r\n \"@tailwind-styled/runtime-css\",\r\n \"@tailwind-styled/runtime\",\r\n \"@tailwind-styled/scanner\",\r\n \"@tailwind-styled/analyzer\",\r\n \"@tailwind-styled/theme\",\r\n \"@tailwind-styled/preset\",\r\n ]\r\n\r\n type ExternalsArray = Extract<NonNullable<NextWebpackConfig[\"externals\"]>, readonly unknown[]>\r\n type ExternalItem = ExternalsArray[number]\r\n\r\n if (!config.externals) {\r\n config.externals = []\r\n }\r\n\r\n const ext = config.externals\r\n if (Array.isArray(ext)) {\r\n externalPackages.forEach((pkg) => {\r\n const found = (ext as ExternalItem[]).find((e: ExternalItem) =>\r\n (typeof e === \"string\" && e.includes(pkg)) ||\r\n (typeof e === \"object\" && e !== null && !Array.isArray(e) &&\r\n Object.keys(e as object).some((k) => k.includes(pkg)))\r\n )\r\n if (!found) {\r\n (ext as string[]).push(pkg)\r\n }\r\n })\r\n }\r\n\r\n return config\r\n}\r\n\r\nconst mergeTurbopackRules = (\r\n existingRules: TurboRules,\r\n nextRules: TurboRules\r\n): TurboRules => {\r\n const merged: TurboRules = { ...existingRules }\r\n\r\n for (const [pattern, incomingRule] of Object.entries(nextRules)) {\r\n const current = merged[pattern]\r\n if (current == null) {\r\n merged[pattern] = incomingRule\r\n continue\r\n }\r\n\r\n if (typeof current === \"object\" && current !== null && \"loaders\" in current) {\r\n const typedCurrent = current as { loaders?: unknown }\r\n if (Array.isArray(typedCurrent.loaders)) {\r\n const incomingLoaders = (incomingRule as { loaders?: unknown[] }).loaders ?? []\r\n merged[pattern] = {\r\n ...(current as TurbopackLoaderRule),\r\n loaders: [...typedCurrent.loaders, ...incomingLoaders],\r\n } as TurbopackLoaderRule\r\n console.warn(\r\n `[tailwind-styled] Turbopack rule '${pattern}' already exists. Appending tailwind-styled loader.`\r\n )\r\n continue\r\n }\r\n }\r\n\r\n merged[pattern] = incomingRule\r\n console.warn(\r\n `[tailwind-styled] Turbopack rule '${pattern}' has incompatible shape. Replacing with tailwind-styled rule.`\r\n )\r\n }\r\n\r\n return merged\r\n}\r\n\r\nexport function withTailwindStyled(options: TailwindStyledNextOptions = {}) {\r\n checkNextVersion()\r\n const normalizedOptions = parseNextAdapterOptions(options)\r\n const webpackLoaderPath = resolveLoaderPath(\"webpackLoader\")\r\n const turbopackLoaderPath = resolveLoaderPath(\"turbopackLoader\")\r\n\r\nreturn function wrap(nextConfig: NextConfig = {}): NextConfig {\r\n const previousWebpack = nextConfig.webpack\r\n const loaderOptions = createLoaderOptions(normalizedOptions)\r\n\r\n return {\r\n ...nextConfig,\r\n webpack(\r\n config: NextWebpackConfig,\r\n webpackOptions: NextWebpackOptions\r\n ): ReturnType<NextWebpackFn> {\r\n const apply = (resolvedConfig: NextWebpackConfig) => {\r\n const finalConfig = applyWebpackRule(resolvedConfig, normalizedOptions, webpackLoaderPath)\r\n if (!finalConfig.externals) {\r\n finalConfig.externals = []\r\n }\r\n const externals = finalConfig.externals\r\n if (Array.isArray(externals)) {\r\n externals.push({\r\n \"@tailwind-styled/shared\": \"commonjs2 @tailwind-styled/shared\",\r\n \"@tailwind-styled/compiler\": \"commonjs2 @tailwind-styled/compiler\",\r\n \"@tailwind-styled/engine\": \"commonjs2 @tailwind-styled/engine\",\r\n \"@tailwind-styled/plugin\": \"commonjs2 @tailwind-styled/plugin\",\r\n })\r\n }\r\n return finalConfig\r\n }\r\n\r\n if (typeof previousWebpack !== \"function\") {\r\n return apply(config)\r\n }\r\n\r\n try {\r\n const result = previousWebpack(config, webpackOptions)\r\n return result instanceof Promise ? result.then(apply) : apply(result)\r\n } catch (error) {\r\n throw new Error(\"[tailwind-styled] Failed while executing existing Next webpack config.\", {\r\n cause: error,\r\n })\r\n }\r\n },\r\n turbopack: {\r\n ...(nextConfig.turbopack ?? {}),\r\n rules: mergeTurbopackRules(\r\n (nextConfig.turbopack?.rules ?? {}) as TurboRules,\r\n buildTurbopackRules(turbopackLoaderPath, loaderOptions)\r\n ),\r\n },\r\n }\r\n }\r\n}"]}
1
+ {"version":3,"sources":["../packages/presentation/next/src/schemas.ts","../packages/domain/shared/src/workerResolver.ts","../packages/domain/shared/src/index.ts","../packages/presentation/next/src/withTailwindStyled.ts"],"names":["path","isBrowser","getDirnameFromUrl","lastSlash","require","resolveLoaderPath"],"mappings":";;;;;;;;;;;;AAEA,IAAM,eAAe,CAAC,KAAA,KACpB,MAAM,MAAA,CACH,GAAA,CAAI,CAAC,KAA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AAA,WACR,CAAA;AAAA,QACH;AAAA,MACF,CAAA;AAAA,MACA,SAAA,EAAW;AAAA,QACT,GAAI,UAAA,CAAW,SAAA,IAAa,EAAC;AAAA,QAC7B,KAAA,EAAO,mBAAA;AAAA,UACJ,UAAA,CAAW,SAAA,EAAW,KAAA,IAAS,EAAC;AAAA,UACjC,mBAAA,CAAoB,qBAAqB,aAAa;AAAA;AACxD;AACF,KACF;AAAA,EACF,CAAA;AACF","file":"next.mjs","sourcesContent":["import { z } from \"zod\"\r\n\r\nconst formatIssues = (error: z.ZodError): string =>\r\n error.issues\r\n .map((issue) => {\r\n const p = issue.path.length > 0 ? issue.path.join(\".\") : \"<root>\"\r\n return `${p}: ${issue.message}`\r\n })\r\n .join(\"; \")\r\n\r\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\r\n const parsed = schema.safeParse(data)\r\n if (parsed.success) return parsed.data\r\n throw new TypeError(`${label}: ${formatIssues(parsed.error)}`)\r\n}\r\n\r\nexport const NextAdapterOptionsSchema = z.object({\r\n mode: z.literal(\"zero-runtime\").optional(),\r\n autoClientBoundary: z.boolean().optional(),\r\n addDataAttr: z.boolean().optional(),\r\n hoist: z.boolean().optional(),\r\n routeCss: z.boolean().optional(),\r\n incremental: z.boolean().optional(),\r\n verbose: z.boolean().optional(),\r\n include: z.instanceof(RegExp).optional(),\r\n exclude: z.instanceof(RegExp).optional(),\r\n})\r\n\r\nexport type NextAdapterOptionsInput = z.infer<typeof NextAdapterOptionsSchema>\r\n\r\nexport const parseNextAdapterOptions = (options: unknown) =>\r\n parseWithSchema(NextAdapterOptionsSchema, options ?? {}, \"next adapter options are invalid\")\r\n","/**\r\n * Worker/bootstrap path resolution untuk artifact release safety.\r\n * Dari monorepo checklist: \"Perkuat worker/bootstrap path agar artifact release aman\"\r\n *\r\n * Masalah: path ke worker/loader script bisa berbeda antara:\r\n * - Development (src/*.ts)\r\n * - Built dist (dist/*.js / dist/*.cjs)\r\n * - Packed npm artifact (dist/ saja, tanpa src/)\r\n *\r\n * Solusi: resolve path secara hierarchical dengan fallback yang eksplisit.\r\n */\r\n\r\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\nconst NODE_URL = typeof window === \"undefined\" || typeof document === \"undefined\" ? \"node:url\" : null\r\nconst NODE_FS = typeof window === \"undefined\" || typeof document === \"undefined\" ? \"node:fs\" : null\r\nconst NODE_PATH = typeof window === \"undefined\" || typeof document === \"undefined\" ? \"node:path\" : null\r\n\r\nfunction getDirnameFromUrl(importMetaUrl: string): string {\r\n if (!importMetaUrl) return \"\"\r\n if (isBrowser) return \"\"\r\n\r\n try {\r\n const nodeUrl = require(NODE_URL!)\r\n return nodeUrl.fileURLToPath(importMetaUrl)\r\n } catch {\r\n if (importMetaUrl.startsWith(\"file://\")) {\r\n return importMetaUrl.slice(7)\r\n }\r\n return \"\"\r\n }\r\n}\r\n\r\nfunction resolvePath(...segments: string[]): string {\r\n if (isBrowser) return segments.join(\"/\").replace(/\\/+/g, \"/\")\r\n try {\r\n const nodePath = require(NODE_PATH!)\r\n return nodePath.resolve(...segments)\r\n } catch {\r\n return segments.join(\"/\").replace(/\\/+/g, \"/\")\r\n }\r\n}\r\n\r\nfunction existsSync(path: string): boolean {\r\n if (isBrowser) return false\r\n try {\r\n const nodeFs = require(NODE_FS!)\r\n return nodeFs.existsSync(path)\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\nexport interface WorkerPathOptions {\r\n /** Nama file worker tanpa extension */\r\n basename: string\r\n /** Import meta URL dari caller module */\r\n importMetaUrl: string\r\n /** Extensions yang dicoba secara urutan (default: [\".cjs\", \".js\", \".mjs\"]) */\r\n extensions?: string[]\r\n /** Sub-directories relatif dari runtimeDir yang dicoba */\r\n subdirs?: string[]\r\n /** Throw jika tidak ditemukan (default: true) */\r\n required?: boolean\r\n}\r\n\r\nexport interface WorkerPathResult {\r\n /** Absolute path ke worker file */\r\n path: string\r\n /** Extension yang ditemukan */\r\n extension: string\r\n /** Apakah ini dari CJS atau ESM artifact */\r\n format: \"cjs\" | \"esm\"\r\n}\r\n\r\n/**\r\n * Resolve worker/loader script path yang aman untuk release artifacts.\r\n *\r\n * Prioritas:\r\n * 1. CJS (.cjs) — untuk Node.js workers yang butuh require()\r\n * 2. JS (.js) — bundled output\r\n * 3. MJS (.mjs) — explicit ESM\r\n *\r\n * @example\r\n * const workerPath = resolveWorkerPath({\r\n * basename: \"scanner-worker\",\r\n * importMetaUrl: import.meta.url,\r\n * })\r\n * // → \"/path/to/dist/scanner-worker.cjs\"\r\n */\r\nexport function resolveWorkerPath(opts: WorkerPathOptions): WorkerPathResult {\r\n if (isBrowser) {\r\n throw new Error(\"Worker resolution not available in browser\")\r\n }\r\n\r\n const {\r\n basename,\r\n importMetaUrl,\r\n extensions = [\".cjs\", \".js\", \".mjs\"],\r\n subdirs = [\".\", \"workers\", \"lib\"],\r\n required = true,\r\n } = opts\r\n\r\n const runtimeDir = getDirnameFromUrl(importMetaUrl)\r\n\r\n // Try each subdir + extension combination\r\n for (const subdir of subdirs) {\r\n for (const ext of extensions) {\r\n const candidate = resolvePath(runtimeDir, subdir, `${basename}${ext}`)\r\n if (existsSync(candidate)) {\r\n return {\r\n path: candidate,\r\n extension: ext,\r\n format: ext === \".cjs\" ? \"cjs\" : \"esm\",\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (required) {\r\n const tried = subdirs.flatMap(d =>\r\n extensions.map(e => resolvePath(runtimeDir, d, `${basename}${e}`))\r\n )\r\n throw new Error(\r\n `[worker-resolver] Could not find worker script \"${basename}\".\\n` +\r\n `Tried:\\n${tried.map(p => ` - ${p}`).join(\"\\n\")}\\n` +\r\n `Ensure the package is built: npm run build`\r\n )\r\n }\r\n\r\n return { path: \"\", extension: \"\", format: \"cjs\" }\r\n}\r\n\r\n/**\r\n * Resolve loader path (untuk webpack/rspack/vite loaders).\r\n * Same as resolveWorkerPath but dengan nama yang lebih eksplisit.\r\n */\r\nexport function resolveLoaderPath(\r\n loaderBasename: string,\r\n importMetaUrl: string\r\n): string {\r\n return resolveWorkerPath({\r\n basename: loaderBasename,\r\n importMetaUrl,\r\n extensions: [\".cjs\", \".js\", \".mjs\"],\r\n subdirs: [\".\", \"loaders\", \"lib\"],\r\n }).path\r\n}","const isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\r\n\r\n// ESM-safe require detection\r\nlet nodeModuleRef: any = null\r\nfunction getNodeModuleRef() {\r\n if (isBrowser) return null\r\n if (nodeModuleRef !== null) return nodeModuleRef\r\n try {\r\n const test = typeof require === 'function' ? require('node:module') : null\r\n nodeModuleRef = test\r\n return test\r\n } catch {\r\n nodeModuleRef = null\r\n return null\r\n }\r\n}\r\n\r\nlet _nodeCrypto: any = null\r\nlet _nodeFs: any = null\r\nlet _nodeModule: any = null\r\nlet _nodePath: any = null\r\nlet _nodeUrl: any = null\r\n\r\nfunction getNodeCrypto() {\r\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire(import.meta.url)(\"node:crypto\")\r\n return _nodeCrypto!\r\n}\r\nfunction getNodeFs() {\r\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import.meta.url)(\"node:fs\")\r\n return _nodeFs!\r\n}\r\nfunction getNodeModule() {\r\n if (isBrowser) throw new Error(\"node:module not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeModule) _nodeModule = nodeRequire\r\n return _nodeModule!\r\n}\r\nfunction getNodePath() {\r\n if (isBrowser) throw new Error(\"node:path not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodePath) _nodePath = nodeRequire.createRequire(import.meta.url)(\"node:path\")\r\n return _nodePath!\r\n}\r\nfunction getNodeUrl() {\r\n if (isBrowser) throw new Error(\"node:url not available in browser\")\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) throw new Error(\"require not available\")\r\n if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import.meta.url)(\"node:url\")\r\n return _nodeUrl!\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Types\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type TokenMap = Record<string, string>\r\n\r\nexport type VariantValue = string | number | boolean | undefined\r\n\r\nexport type VariantProps = Record<string, VariantValue>\r\n\r\nexport type HtmlTagName = keyof HTMLElementTagNameMap\r\n\r\nexport type CompoundCondition = Record<string, string | number | boolean>\r\n\r\nexport type VariantMatrix = Record<string, Array<string | number | boolean>>\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Logging\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface Logger {\r\n warn(...args: unknown[]): void\r\n debug(...args: unknown[]): void\r\n error(...args: unknown[]): void\r\n log(...args: unknown[]): void\r\n}\r\n\r\nexport function createLogger(namespace: string): Logger {\r\n const prefix = `[${namespace}]`\r\n return {\r\n warn(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n debug(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n error(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n log(...args: unknown[]) {\r\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\r\n },\r\n }\r\n}\r\n\r\nexport function createDebugLogger(namespace: string, label?: string): (msg: string) => void {\r\n const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`\r\n return (msg: string) => {\r\n if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {\r\n console.debug(prefix, msg)\r\n }\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error handling\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type ErrorSource = \"rust\" | \"validation\" | \"compile\" | \"io\" | \"config\" | \"unknown\"\r\n\r\ntype ZodLikeIssue = {\r\n path?: readonly PropertyKey[]\r\n message?: string\r\n}\r\n\r\nfunction formatIssuePath(path?: readonly PropertyKey[]): string {\r\n if (!path || path.length === 0) return \"(root)\"\r\n return path\r\n .map((segment) =>\r\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\r\n )\r\n .join(\".\")\r\n}\r\n\r\nexport class TwError extends Error {\r\n /** @deprecated Gunakan source */\r\n public readonly domain: string\r\n public readonly source: ErrorSource\r\n public readonly code: string\r\n public readonly originalCause?: unknown\r\n\r\n constructor(domainOrSource: string, code: string, message: string, cause?: unknown) {\r\n super(message)\r\n this.name = \"TwError\"\r\n this.domain = domainOrSource\r\n this.source = domainOrSource as ErrorSource\r\n this.code = code\r\n this.originalCause = cause\r\n if (Error.captureStackTrace) Error.captureStackTrace(this, TwError)\r\n }\r\n\r\n static fromIo(code: string, message: string): TwError {\r\n return new TwError(\"io\", code, message)\r\n }\r\n\r\n static fromCompile(code: string, message: string): TwError {\r\n return new TwError(\"compile\", code, message)\r\n }\r\n\r\n static fromRust(err: { code?: string; message?: string } | Error | unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(\"rust\", \"RUST_ERROR\", err.message, err)\r\n if (err && typeof err === \"object\") {\r\n const e = err as { code?: string; message?: string }\r\n return new TwError(\"rust\", e.code ?? \"RUST_ERROR\", e.message ?? String(err), err)\r\n }\r\n return new TwError(\"rust\", \"RUST_ERROR\", String(err), err)\r\n }\r\n\r\n /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */\r\n static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[] }): TwError {\r\n const first = err.issues?.[0] ?? err.errors?.[0]\r\n const path = formatIssuePath(first?.path)\r\n const message = first ? `${path}: ${first.message}` : \"Schema validation failed\"\r\n return new TwError(\"validation\", \"SCHEMA_VALIDATION_FAILED\", message, err)\r\n }\r\n\r\n static wrap(source: string, code: string, err: unknown): TwError {\r\n if (err instanceof TwError) return err\r\n if (err instanceof Error) return new TwError(source, code, err.message, err)\r\n return new TwError(source, code, String(err), err)\r\n }\r\n\r\n override toString(): string {\r\n return `TwError [${this.source}:${this.code}] ${this.message}`\r\n }\r\n\r\n toJSON(): { name: string; source: string; code: string; message: string } {\r\n return { name: this.name, source: this.source, code: this.code, message: this.message }\r\n }\r\n\r\n toCliMessage(): string {\r\n return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`\r\n }\r\n}\r\n\r\nexport function wrapUnknownError(domain: string, code: string, error: unknown): TwError {\r\n return TwError.wrap(domain, code, error)\r\n}\r\n\r\nexport function isTwError(err: unknown): err is TwError {\r\n return err instanceof TwError\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Native binding resolution\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport interface LoadNativeBindingOptions<T> {\r\n runtimeDir: string\r\n candidates: string[]\r\n isValid: (module: unknown) => module is T\r\n invalidExportMessage: string\r\n}\r\n\r\nexport interface LoadNativeBindingResult<T> {\r\n binding: T | null\r\n loadErrors: Array<{ path: string; message: string }>\r\n loadedPath?: string\r\n}\r\n\r\nexport function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T> {\r\n if (isBrowser) {\r\n return { binding: null, loadErrors: [{ path: \"\", message: \"Native bindings not available in browser\" }] }\r\n }\r\n \r\n const { runtimeDir, candidates, isValid } = options\r\n const loadErrors: Array<{ path: string; message: string }> = []\r\n const path = getNodePath()\r\n const fs = getNodeFs()\r\n\r\n for (const candidate of candidates) {\r\n const candidatePath = path.resolve(runtimeDir, candidate)\r\n try {\r\n if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + \".node\")) {\r\n continue\r\n }\r\n const mod = requireNativeModule(candidatePath)\r\n if (mod && isValid(mod)) {\r\n return { binding: mod, loadErrors, loadedPath: candidatePath }\r\n }\r\n loadErrors.push({ path: candidatePath, message: options.invalidExportMessage })\r\n } catch (e) {\r\n loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) })\r\n }\r\n }\r\n\r\n return { binding: null, loadErrors }\r\n}\r\n\r\nfunction getRequire(): NodeRequire {\r\n if (isBrowser) return (() => { throw new Error(\"require not available in browser\") }) as unknown as NodeRequire\r\n const nodeRequire = getNodeModuleRef()\r\n if (!nodeRequire) return (() => { throw new Error(\"require not available\") }) as unknown as NodeRequire\r\n return nodeRequire.createRequire(import.meta.url)\r\n}\r\n\r\nconst _require = getRequire()\r\n\r\nfunction requireNativeModule(path: string): unknown {\r\n return _require(path)\r\n}\r\n\r\nexport interface ResolveCandidatesOptions {\r\n runtimeDir: string\r\n envVarNames?: string[]\r\n includeDefaultCandidates?: boolean\r\n enforceNodeExtensionForEnvPath?: boolean\r\n}\r\n\r\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\r\n if (isBrowser) return []\r\n \r\n const { runtimeDir, envVarNames = [], includeDefaultCandidates = true, enforceNodeExtensionForEnvPath = false } = options\r\n const candidates: string[] = []\r\n const path = getNodePath()\r\n const fs = getNodeFs()\r\n\r\n for (const envVar of envVarNames) {\r\n const envPath = process.env[envVar]\r\n if (envPath) {\r\n if (enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\")) {\r\n candidates.push(envPath + \".node\")\r\n } else {\r\n candidates.push(envPath)\r\n }\r\n }\r\n }\r\n\r\n if (!includeDefaultCandidates) return candidates\r\n\r\n if (fs.existsSync(runtimeDir)) {\r\n try {\r\n const entries = fs.readdirSync(runtimeDir)\r\n for (const entry of entries) {\r\n if (entry.endsWith(\".node\")) {\r\n candidates.push(entry)\r\n }\r\n }\r\n } catch {\r\n // ignore read errors\r\n }\r\n }\r\n\r\n const platform = typeof process !== \"undefined\" ? process.platform : \"\"\r\n const ext = platform === \"win32\" ? \".dll\" : platform === \"darwin\" ? \".dylib\" : \".so\"\r\n const defaultBindingName = `tailwind_styled_parser${ext}`\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", defaultBindingName))\r\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", defaultBindingName))\r\n candidates.push(path.resolve(process.cwd(), \"native\", defaultBindingName))\r\n\r\n return Array.from(new Set(candidates))\r\n}\r\n\r\nexport function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string {\r\n if (isBrowser) return \"\"\r\n \r\n if (dir) return getNodePath().resolve(dir)\r\n try {\r\n return getNodeUrl().fileURLToPath(importMetaUrl)\r\n } catch {\r\n return process.cwd()\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Hashing\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function hashContent(content: string, algorithm: string = \"md5\", length?: number): string {\r\n if (isBrowser) {\r\n // Simple hash fallback for browser\r\n let hash = 0\r\n for (let i = 0; i < content.length; i++) {\r\n const char = content.charCodeAt(i)\r\n hash = ((hash << 5) - hash) + char\r\n hash = hash & hash\r\n }\r\n return Math.abs(hash).toString(16).slice(0, length ?? 8)\r\n }\r\n const hash = getNodeCrypto().createHash(algorithm).update(content).digest(\"hex\")\r\n return length ? hash.slice(0, length) : hash\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error formatting\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport function formatErrorMessage(error: unknown): string {\r\n if (error instanceof TwError) return error.toString()\r\n if (error instanceof Error) return error.message\r\n return String(error)\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// LRU Cache\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport class LRUCache<K, V> {\r\n private capacity: number\r\n private cache: Map<K, V>\r\n\r\n constructor(capacity: number) {\r\n this.capacity = capacity\r\n this.cache = new Map()\r\n }\r\n\r\n get(key: K): V | undefined {\r\n if (!this.cache.has(key)) return undefined\r\n const value = this.cache.get(key)!\r\n this.cache.delete(key)\r\n this.cache.set(key, value)\r\n return value\r\n }\r\n\r\n set(key: K, value: V): void {\r\n if (this.cache.has(key)) {\r\n this.cache.delete(key)\r\n } else if (this.cache.size >= this.capacity) {\r\n const firstKey = this.cache.keys().next().value\r\n if (firstKey !== undefined) {\r\n this.cache.delete(firstKey)\r\n }\r\n }\r\n this.cache.set(key, value)\r\n }\r\n\r\n delete(key: K): boolean {\r\n return this.cache.delete(key)\r\n }\r\n\r\n has(key: K): boolean {\r\n return this.cache.has(key)\r\n }\r\n\r\n clear(): void {\r\n this.cache.clear()\r\n }\r\n\r\n entries(): IterableIterator<[K, V]> {\r\n return this.cache.entries()\r\n }\r\n\r\n get size(): number {\r\n return this.cache.size\r\n }\r\n}\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Trace Utilities\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TraceSnapshot, TraceSummary } from \"./trace\"\r\nexport {\r\n getHealthColor,\r\n getModeColor,\r\n formatMemory,\r\n formatDuration,\r\n calculateHealth,\r\n getBuildTimeColor,\r\n getMemoryColor,\r\n createTraceSnapshot,\r\n getPipelinePercentages,\r\n} from \"./trace\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Performance Telemetry\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\n\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Error Codes\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { ErrorCode } from \"./error-codes\"\r\nexport { ERROR_CODES, getSuggestion, formatErrorCode } from \"./error-codes\"\r\n\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n// Tailwind Compatibility\r\n// ─────────────────────────────────────────────────────────────────────────────\r\n\r\nexport type { TailwindInfo } from \"./compatibility\"\r\nexport { detectTailwind, assertTailwindV4, getTailwindVersion, isTailwindV4 } from \"./compatibility\"\r\n\r\n// ── Native binding schemas (Zod boundary validation)\r\nexport {\r\n NativeScanFileSchema, NativeScanResultSchema,\r\n NativeAnalyzerReportSchema, NativeTransformResultSchema,\r\n NativeCssCompileResultSchema, NativeWatchResultSchema,\r\n NativeCacheEntrySchema, NativeCacheReadResultSchema,\r\n safeParseNative, parseNative,\r\n} from './native-schemas'\r\n\r\n// ── ESM-safe runtime helpers ──────────────────────────────────────────────\r\nexport {\r\n createEsmRequire,\r\n getDirname,\r\n getFilename,\r\n resolveFromRoot,\r\n tryRequire,\r\n resolveNativeNodePath,\r\n} from \"./esmHelpers\"\r\n\r\n// ── Performance telemetry ────────────────────────────────────────────────────\r\nexport {\r\n TelemetryCollector,\r\n getGlobalTelemetry,\r\n resetGlobalTelemetry,\r\n createBuildTimer,\r\n type BuildTelemetry,\r\n type TelemetrySummary,\r\n type BuildPhases,\r\n} from \"./telemetry\"\r\n\r\n// ── Config/JSON schema validation ─────────────────────────────────────────────\r\nexport {\r\n ScanCacheSchema,\r\n ScanCacheClassEntrySchema,\r\n TailwindConfigSchema,\r\n RegistryPluginEntrySchema,\r\n RegistryFileSchema,\r\n PackageJsonSchema,\r\n parseJsonWithSchema,\r\n parseJsonFileWithSchema,\r\n type ScanCache,\r\n type ScanCacheClassEntry,\r\n type TailwindConfig,\r\n type RegistryPluginEntry,\r\n type RegistryFile,\r\n type PackageJson,\r\n} from \"./configSchemas\"\r\n\r\n// ── Worker/bootstrap path resolution ─────────────────────────────────────────\r\nexport {\r\n resolveWorkerPath,\r\n resolveLoaderPath,\r\n type WorkerPathOptions,\r\n type WorkerPathResult,\r\n} from \"./workerResolver\"\r\n\r\n// ── Codegen helpers ───────────────────────────────────────────────────────────\r\nexport {\r\n generateComponentCode,\r\n generateStorybookStory,\r\n generateClassRenameCodemod,\r\n generateBarrelFile,\r\n type ComponentCodegenOptions,\r\n} from \"./codegen\"\r\n\r\n// ── Native binary resolution (QA #1) ─────────────────────────────────────────\r\nexport {\r\n resolveNativeBinary,\r\n formatNativeNotFoundError,\r\n type NativeResolutionResult,\r\n} from \"./native-resolution\"\r\n\r\n// ── Shared observability contract ────────────────────────────────────────────\r\nexport {\r\n createObservabilityClient,\r\n type ClassInspection,\r\n type ClassProperty,\r\n type ClassUsageLocation,\r\n type BuildTrace,\r\n type BuildPhaseTrace,\r\n type DashboardMetrics,\r\n type DashboardSummary,\r\n type ObservabilityClient,\r\n} from \"./observability\"\r\n","import fs from \"node:fs\"\r\nimport { createRequire } from \"node:module\"\r\nimport path from \"node:path\"\r\n\r\nfunction getDirnameFromUrl(importMetaUrl: string): string {\r\n if (typeof importMetaUrl !== 'string') return ''\r\n // Simple URL parsing without Node.js modules\r\n if (importMetaUrl.startsWith('file://')) {\r\n let withoutFile = importMetaUrl.slice(7)\r\n // On Windows, file URLs can be like file:///C:/path\r\n if (withoutFile[0] === '/' && withoutFile[2] === ':') {\r\n withoutFile = withoutFile.slice(1) // Remove leading / from C:/\r\n }\r\n const lastSlash = Math.max(withoutFile.lastIndexOf('/'), withoutFile.lastIndexOf('\\\\'))\r\n return lastSlash > 0 ? withoutFile.slice(0, lastSlash) : '/'\r\n }\r\n // Fallback for other URL types\r\n const lastSlash = Math.max(importMetaUrl.lastIndexOf('/'), importMetaUrl.lastIndexOf('\\\\'))\r\n return lastSlash > 0 ? importMetaUrl.slice(0, lastSlash) : ''\r\n}\r\n\r\nimport { resolveLoaderPath as sharedResolveLoaderPath } from \"@tailwind-styled/shared\"\r\n\r\nimport { parseNextAdapterOptions } from \"./schemas\"\r\n\r\nconst require = createRequire(import.meta.url)\r\n\r\ninterface TailwindStyledLoaderOptions {\r\n /** @deprecated — handled by engine internally */\r\n mode?: \"zero-runtime\"\r\n /** @deprecated — handled by engine internally */\r\n autoClientBoundary?: boolean\r\n /** @deprecated — handled by engine internally */\r\n addDataAttr?: boolean\r\n /** @deprecated — handled by engine internally */\r\n hoist?: boolean\r\n /** @deprecated — handled by engine internally */\r\n routeCss?: boolean\r\n /** @deprecated — handled by engine internally */\r\n incremental?: boolean\r\n verbose?: boolean\r\n preserveImports?: boolean\r\n safelistPath?: string\r\n}\r\n\r\nexport interface TailwindStyledNextOptions {\r\n /** @deprecated — handled by engine internally */\r\n mode?: \"zero-runtime\"\r\n /** @deprecated — handled by engine internally */\r\n autoClientBoundary?: boolean\r\n /** @deprecated — handled by engine internally */\r\n addDataAttr?: boolean\r\n /** @deprecated — handled by engine internally */\r\n hoist?: boolean\r\n /** @deprecated — handled by engine internally */\r\n routeCss?: boolean\r\n /** @deprecated — handled by engine internally */\r\n incremental?: boolean\r\n /** Show detailed loader output */\r\n verbose?: boolean\r\n /** Path to generated safelist CSS file. Default: <cwd>/__tw_safelist.css */\r\n safelistPath?: string\r\n include?: RegExp\r\n exclude?: RegExp\r\n}\r\n\r\nimport type { NextConfig } from \"next\"\r\n\r\n// Derive webpack types directly from Next.js — always in sync with installed version\r\ntype NextWebpackFn = NonNullable<NextConfig[\"webpack\"]>\r\ntype NextWebpackConfig = Parameters<NextWebpackFn>[0]\r\ntype NextWebpackOptions = Parameters<NextWebpackFn>[1]\r\n\r\n// Derive turbopack rule types from NextConfig\r\ntype TurboRules = NonNullable<NonNullable<NextConfig[\"turbopack\"]>[\"rules\"]>\r\ntype TurbopackLoaderRule = TurboRules[string]\r\n\r\n// Derive webpack module rule type for safe iteration\r\ntype ModuleRule = NonNullable<NonNullable<NextWebpackConfig[\"module\"]>[\"rules\"]>[number]\r\ntype RuleUseEntry = { loader?: string; options?: unknown }\r\n\r\ninterface NextWebpackUseEntry {\r\n loader: string\r\n options?: TailwindStyledLoaderOptions\r\n}\r\n\r\ninterface NextWebpackRule {\r\n test?: RegExp\r\n exclude?: RegExp\r\n enforce?: \"pre\" | \"post\"\r\n use?: NextWebpackUseEntry[]\r\n}\r\n\r\n\r\nconst resolveRuntimeDir = (): string => getDirnameFromUrl(import.meta.url)\r\n\r\nconst resolveLoaderPath = (basename: string): string => {\r\n try {\r\n return sharedResolveLoaderPath(basename, import.meta.url)\r\n } catch {\r\n const runtimeDir = resolveRuntimeDir()\r\n const candidates = [\r\n path.resolve(runtimeDir, `${basename}.mjs`),\r\n path.resolve(runtimeDir, `${basename}.js`),\r\n path.resolve(runtimeDir, `${basename}.cjs`),\r\n ]\r\n\r\n for (const candidate of candidates) {\r\n if (fs.existsSync(candidate)) {\r\n return candidate\r\n }\r\n }\r\n\r\n throw new Error(\r\n `[tailwind-styled] Loader not found for '${basename}'. Checked: ${candidates.join(\", \")}`\r\n )\r\n }\r\n}\r\n\r\nfunction checkNextVersion(): void {\r\n try {\r\n const pkgPath = require.resolve(\"next/package.json\")\r\n const { version } = require(pkgPath)\r\n const major = Number.parseInt(version.split(\".\")[0], 10)\r\n if (major < 15) {\r\n console.warn(\r\n `[tailwind-styled] Next.js ${version} detected. Recommended: 15+ for full Turbopack support.`\r\n )\r\n }\r\n } catch {\r\n // next not resolvable — skip check\r\n }\r\n}\r\n\r\nconst DEFAULT_INCLUDE = /\\.[jt]sx?$/\r\nconst DEFAULT_EXCLUDE = /node_modules/\r\n\r\n/**\r\n * Next.js App Router entry-point files yang TIDAK boleh diproses oleh TW loader.\r\n *\r\n * Mengapa: file-file ini adalah RSC boundary points yang dikelola Next.js secara khusus.\r\n * Jika loader menginjeksi TRANSFORM_MARKER atau memodifikasi source-nya—bahkan ketika\r\n * `changed: false`—Next.js/React Compiler kehilangan sinyal bahwa file adalah pure RSC,\r\n * sehingga locale injection dari Accept-Language header (Next.js 16+) tidak konsisten\r\n * antara SSR pass (server: lang=\"id\") dan hydration pass (client: lang=\"en\").\r\n *\r\n * File yang dikecualikan: layout, page, loading, error, not-found, template, default\r\n * semuanya adalah Next.js segment conventions yang tidak boleh disentuh loader pihak ketiga.\r\n */\r\nconst NEXT_RSC_ENTRIES =\r\n /(?:^|[\\\\/])(?:layout|page|loading|error|not-found|template|default)\\.[jt]sx?$/\r\n\r\n/**\r\n * Gabungkan user-supplied exclude dengan NEXT_RSC_ENTRIES.\r\n * Menggunakan non-capturing group agar tidak interferensi dengan capture group lain.\r\n */\r\nconst buildExcludePattern = (userExclude?: RegExp): RegExp => {\r\n if (!userExclude) return new RegExp(`(?:${DEFAULT_EXCLUDE.source})|(?:${NEXT_RSC_ENTRIES.source})`)\r\n return new RegExp(`(?:${userExclude.source})|(?:${NEXT_RSC_ENTRIES.source})`)\r\n}\r\n\r\nconst createLoaderOptions = (options: TailwindStyledNextOptions): Readonly<TailwindStyledLoaderOptions> => {\r\n // Deprecated options — still passed for loader backward compat but engine ignores them\r\n const opts: TailwindStyledLoaderOptions = {\r\n mode: \"zero-runtime\", // only supported mode\r\n autoClientBoundary: true, // always on (engine handles it)\r\n preserveImports: true,\r\n }\r\n if (options.verbose !== undefined) opts.verbose = options.verbose\r\n opts.safelistPath = options.safelistPath ?? path.join(process.cwd(), \"__tw_safelist.css\")\r\n return Object.freeze(opts)\r\n}\r\n\r\nconst buildTurbopackRules = (\r\n loaderPath: string,\r\n loaderOptions: TailwindStyledLoaderOptions\r\n): TurboRules => {\r\n const extensions = [\"js\", \"jsx\", \"ts\", \"tsx\", \"mjs\", \"cjs\"]\r\n return Object.fromEntries(\r\n extensions.map((ext) => [\r\n `*.${ext}`,\r\n { loaders: [{ loader: loaderPath, options: loaderOptions }] },\r\n ])\r\n ) as TurboRules\r\n}\r\n\r\nconst normalizeLoaderPath = (loaderPath: string): string => path.resolve(loaderPath)\r\n\r\nconst applyWebpackRule = (\r\n config: NextWebpackConfig,\r\n options: TailwindStyledNextOptions,\r\n loaderPath: string\r\n): NextWebpackConfig => {\r\n const loaderOptions = createLoaderOptions(options)\r\n const rules = config.module?.rules ?? []\r\n const normalizedLoaderPath = normalizeLoaderPath(loaderPath)\r\n\r\n const alreadyRegistered = rules.some(\r\n (rule: ModuleRule) =>\r\n Array.isArray(rule?.use) &&\r\n (rule.use as RuleUseEntry[]).some(\r\n (entry: RuleUseEntry) =>\r\n typeof entry.loader === \"string\" &&\r\n normalizeLoaderPath(entry.loader) === normalizedLoaderPath\r\n )\r\n )\r\n\r\n if (alreadyRegistered) return config\r\n\r\n const tailwindStyledRule: NextWebpackRule = {\r\n test: options.include ?? DEFAULT_INCLUDE,\r\n // Selalu kecualikan Next.js RSC entry files (layout, page, dll) bahkan jika\r\n // user menyuplai exclude pattern sendiri — lihat buildExcludePattern.\r\n exclude: buildExcludePattern(options.exclude),\r\n enforce: \"pre\",\r\n use: [{ loader: loaderPath, options: loaderOptions }],\r\n }\r\n\r\n config.module = {\r\n ...(config.module ?? {}),\r\n rules: [...rules, tailwindStyledRule],\r\n }\r\n\r\n const externalPackages = [\r\n \"@tailwind-styled/shared\",\r\n \"@tailwind-styled/compiler\", \r\n \"@tailwind-styled/engine\",\r\n \"@tailwind-styled/plugin\",\r\n \"@tailwind-styled/core\",\r\n \"@tailwind-styled/runtime-css\",\r\n \"@tailwind-styled/runtime\",\r\n \"@tailwind-styled/scanner\",\r\n \"@tailwind-styled/analyzer\",\r\n \"@tailwind-styled/theme\",\r\n \"@tailwind-styled/preset\",\r\n ]\r\n\r\n type ExternalsArray = Extract<NonNullable<NextWebpackConfig[\"externals\"]>, readonly unknown[]>\r\n type ExternalItem = ExternalsArray[number]\r\n\r\n if (!config.externals) {\r\n config.externals = []\r\n }\r\n\r\n const ext = config.externals\r\n if (Array.isArray(ext)) {\r\n externalPackages.forEach((pkg) => {\r\n const found = (ext as ExternalItem[]).find((e: ExternalItem) =>\r\n (typeof e === \"string\" && e.includes(pkg)) ||\r\n (typeof e === \"object\" && e !== null && !Array.isArray(e) &&\r\n Object.keys(e as object).some((k) => k.includes(pkg)))\r\n )\r\n if (!found) {\r\n (ext as string[]).push(pkg)\r\n }\r\n })\r\n }\r\n\r\n return config\r\n}\r\n\r\nconst mergeTurbopackRules = (\r\n existingRules: TurboRules,\r\n nextRules: TurboRules\r\n): TurboRules => {\r\n const merged: TurboRules = { ...existingRules }\r\n\r\n for (const [pattern, incomingRule] of Object.entries(nextRules)) {\r\n const current = merged[pattern]\r\n if (current == null) {\r\n merged[pattern] = incomingRule\r\n continue\r\n }\r\n\r\n if (typeof current === \"object\" && current !== null && \"loaders\" in current) {\r\n const typedCurrent = current as { loaders?: unknown }\r\n if (Array.isArray(typedCurrent.loaders)) {\r\n const incomingLoaders = (incomingRule as { loaders?: unknown[] }).loaders ?? []\r\n merged[pattern] = {\r\n ...(current as TurbopackLoaderRule),\r\n loaders: [...typedCurrent.loaders, ...incomingLoaders],\r\n } as TurbopackLoaderRule\r\n console.warn(\r\n `[tailwind-styled] Turbopack rule '${pattern}' already exists. Appending tailwind-styled loader.`\r\n )\r\n continue\r\n }\r\n }\r\n\r\n merged[pattern] = incomingRule\r\n console.warn(\r\n `[tailwind-styled] Turbopack rule '${pattern}' has incompatible shape. Replacing with tailwind-styled rule.`\r\n )\r\n }\r\n\r\n return merged\r\n}\r\n\r\nexport function withTailwindStyled(options: TailwindStyledNextOptions = {}) {\r\n checkNextVersion()\r\n const normalizedOptions = parseNextAdapterOptions(options)\r\n const webpackLoaderPath = resolveLoaderPath(\"webpackLoader\")\r\n const turbopackLoaderPath = resolveLoaderPath(\"turbopackLoader\")\r\n\r\nreturn function wrap(nextConfig: NextConfig = {}): NextConfig {\r\n const previousWebpack = nextConfig.webpack\r\n const loaderOptions = createLoaderOptions(normalizedOptions)\r\n\r\n return {\r\n ...nextConfig,\r\n webpack(\r\n config: NextWebpackConfig,\r\n webpackOptions: NextWebpackOptions\r\n ): ReturnType<NextWebpackFn> {\r\n const apply = (resolvedConfig: NextWebpackConfig) => {\r\n const finalConfig = applyWebpackRule(resolvedConfig, normalizedOptions, webpackLoaderPath)\r\n if (!finalConfig.externals) {\r\n finalConfig.externals = []\r\n }\r\n const externals = finalConfig.externals\r\n if (Array.isArray(externals)) {\r\n externals.push({\r\n \"@tailwind-styled/shared\": \"commonjs2 @tailwind-styled/shared\",\r\n \"@tailwind-styled/compiler\": \"commonjs2 @tailwind-styled/compiler\",\r\n \"@tailwind-styled/engine\": \"commonjs2 @tailwind-styled/engine\",\r\n \"@tailwind-styled/plugin\": \"commonjs2 @tailwind-styled/plugin\",\r\n })\r\n }\r\n return finalConfig\r\n }\r\n\r\n if (typeof previousWebpack !== \"function\") {\r\n return apply(config)\r\n }\r\n\r\n try {\r\n const result = previousWebpack(config, webpackOptions)\r\n return result instanceof Promise ? result.then(apply) : apply(result)\r\n } catch (error) {\r\n throw new Error(\"[tailwind-styled] Failed while executing existing Next webpack config.\", {\r\n cause: error,\r\n })\r\n }\r\n },\r\n turbopack: {\r\n ...(nextConfig.turbopack ?? {}),\r\n rules: mergeTurbopackRules(\r\n (nextConfig.turbopack?.rules ?? {}) as TurboRules,\r\n buildTurbopackRules(turbopackLoaderPath, loaderOptions)\r\n ),\r\n },\r\n }\r\n }\r\n}"]}
@@ -282,10 +282,13 @@ function detectRouter(resourcePath) {
282
282
  if (/\/pages\//.test(normalized)) return "pages";
283
283
  return "unknown";
284
284
  }
285
+ var NEXT_RSC_ENTRIES = /(?:^|[\\/])(?:layout|page|loading|error|not-found|template|default)\.[jt]sx?$/;
285
286
  function isSkippable(resourcePath) {
286
287
  const normalized = resourcePath.replace(/\\/g, "/");
287
288
  return normalized.includes("/node_modules/") || normalized.endsWith(".d.ts") || normalized.endsWith(".d.mts") || normalized.endsWith(".d.cts") || // Skip CSS/assets
288
- /\.(css|scss|sass|less|svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|eot)$/.test(normalized);
289
+ /\.(css|scss|sass|less|svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|eot)$/.test(normalized) || // Skip Next.js RSC entry files — Turbopack tidak punya exclude di rule level,
290
+ // jadi guard ini menggantikan NEXT_RSC_ENTRIES exclude yang ada di webpack path.
291
+ NEXT_RSC_ENTRIES.test(normalized);
289
292
  }
290
293
  function extractDirective(source) {
291
294
  const match = source.match(/^(\s*["'](use client|use server)["']\s*;?\s*\n?)/);
@@ -383,7 +386,7 @@ function turbopackLoader(source, options = {}) {
383
386
  source: stripped,
384
387
  options: effective
385
388
  });
386
- if (!output.changed && !output.code.length) return source;
389
+ if (!output.changed) return source;
387
390
  if (output.classes.length > 0) {
388
391
  registerFileClasses(this.resourcePath, output.classes);
389
392
  writePerFileSafelist(options.safelistPath, this.resourcePath, output.classes);