tailwind-styled-v4 5.0.39 → 5.0.40

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.
@@ -104,12 +104,11 @@ var import_node_fs = require("fs");
104
104
  var import_node_module = require("module");
105
105
  var import_node_path = require("path");
106
106
  var import_node_url = require("url");
107
- var import_meta = {};
108
107
  var _native = void 0;
109
108
  function getNative() {
110
109
  if (_native !== void 0) return _native;
111
110
  try {
112
- const runtimeDir = typeof __dirname === "string" && __dirname.length > 0 ? __dirname : typeof import_meta !== "undefined" && __importMetaUrl ? (0, import_node_url.fileURLToPath)(new URL(".", __importMetaUrl)) : process.cwd();
111
+ const runtimeDir = typeof __dirname === "string" && __dirname.length > 0 ? __dirname : false ? fileURLToPath(new URL(".", __importMetaUrl)) : process.cwd();
113
112
  const req = (0, import_node_module.createRequire)((0, import_node_path.join)(runtimeDir, "noop.cjs"));
114
113
  const _pa = `${process.platform}-${process.arch}`;
115
114
  const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/domain/plugin-registry/registry.json","../src/umbrella/plugin-registry.ts","../packages/domain/plugin-registry/src/index.ts"],"sourcesContent":["{\n \"version\": \"5.0.0\",\n \"updatedAt\": \"2026-03-23\",\n \"official\": [\n {\n \"name\": \"@tailwind-styled/plugin-animation\",\n \"description\": \"Animation presets and keyframes — enter/exit transitions, spring physics, scroll-triggered\",\n \"version\": \"5.0.0\",\n \"tags\": [\"animation\", \"motion\", \"transition\", \"keyframes\"],\n \"docs\": \"https://github.com/tailwind-styled/tailwind-styled-v5/tree/main/packages/animate\",\n \"install\": \"npm install @tailwind-styled/plugin-animation@5.0.0\",\n \"integrity\": \"sha256-abc123\"\n },\n {\n \"name\": \"@tailwind-styled/plugin-typography\",\n \"description\": \"Prose and typography utilities — headings, body, code blocks, with dark mode\",\n \"version\": \"5.0.0\",\n \"tags\": [\"typography\", \"prose\", \"markdown\", \"content\"],\n \"docs\": \"https://github.com/tailwind-styled/tailwind-styled-v5/tree/main/docs/plugins\",\n \"install\": \"npm install @tailwind-styled/plugin-typography@5.0.0\",\n \"integrity\": \"sha256-def456\"\n },\n {\n \"name\": \"@tailwind-styled/plugin-forms\",\n \"description\": \"Form input styling helpers — reset, validation states, custom checkboxes/radios\",\n \"version\": \"5.0.0\",\n \"tags\": [\"forms\", \"inputs\", \"validation\", \"checkbox\", \"radio\"],\n \"docs\": \"https://github.com/tailwind-styled/tailwind-styled-v5/tree/main/docs/plugins\",\n \"install\": \"npm install @tailwind-styled/plugin-forms@5.0.0\",\n \"integrity\": \"sha256-ghi789\"\n },\n {\n \"name\": \"@tailwind-styled/plugin-container-queries\",\n \"description\": \"Container query utilities — @container breakpoints for component-level responsiveness\",\n \"version\": \"5.0.0\",\n \"tags\": [\"container-queries\", \"responsive\", \"layout\"],\n \"docs\": \"https://github.com/tailwind-styled/tailwind-styled-v5/tree/main/docs/plugins\",\n \"install\": \"npm install @tailwind-styled/plugin-container-queries@5.0.0\",\n \"integrity\": \"sha256-jkl012\"\n }\n ],\n \"community\": [\n {\n \"name\": \"tailwind-styled-animate\",\n \"description\": \"Community animation variants — bounce, pulse, wiggle, and more\",\n \"version\": \"0.1.0\",\n \"tags\": [\"animation\", \"community\"],\n \"author\": \"community\",\n \"install\": \"npm install tailwind-styled-animate\"\n },\n {\n \"name\": \"tailwind-styled-icons\",\n \"description\": \"SVG icon system integrated with tw() variant API\",\n \"version\": \"0.1.0\",\n \"tags\": [\"icons\", \"svg\", \"community\"],\n \"author\": \"community\",\n \"install\": \"npm install tailwind-styled-icons\"\n }\n ]\n}\n","export * from \"@tailwind-styled/plugin-registry\"\n","import { spawnSync } from \"node:child_process\"\nimport { existsSync, readFileSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { join, resolve } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\n// ── Native bridge (lazy-loaded to avoid circular deps) ──────────────────────\ntype NativePluginRegistry = {\n pluginSearch: (pluginsJson: string, query: string) => string\n pluginValidateName: (name: string) => boolean\n pluginVerifyIntegrity: (content: string, expectedIntegrity: string) => boolean\n pluginSemverHasUpdate: (current: string, latest: string) => boolean\n pluginCheckAllUpdates: (installedJson: string, registryJson: string) => string\n}\nlet _native: NativePluginRegistry | null | undefined = undefined\nfunction getNative(): NativePluginRegistry | null {\n if (_native !== undefined) return _native\n try {\n const runtimeDir = typeof __dirname === \"string\" && __dirname.length > 0\n ? __dirname\n : typeof import.meta !== \"undefined\" && import.meta.url\n ? fileURLToPath(new URL(\".\", import.meta.url))\n : process.cwd()\n const req = createRequire(join(runtimeDir, \"noop.cjs\"))\n const _pa = `${process.platform}-${process.arch}`\n const _paGnu = _pa === \"linux-x64\" ? \"linux-x64-gnu\" : _pa === \"linux-arm64\" ? \"linux-arm64-gnu\" : _pa\n const candidates = [\n // npm install case: dist/../native/\n resolve(runtimeDir, \"..\", \"native\", \"tailwind-styled-native.node\"),\n resolve(runtimeDir, \"..\", \"native\", `tailwind-styled-native.${_pa}.node`),\n resolve(runtimeDir, \"..\", \"native\", `tailwind-styled-native.${_paGnu}.node`),\n resolve(runtimeDir, \"..\", \"native\", \"tailwind_styled_parser.node\"),\n // cwd fallback\n resolve(process.cwd(), \"native\", \"tailwind-styled-native.node\"),\n resolve(process.cwd(), \"native\", \"tailwind_styled_parser.node\"),\n // monorepo dev: 4-level up\n resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", \"tailwind-styled-native.node\"),\n resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", \"tailwind_styled_parser.node\"),\n // 3-level fallback\n resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", \"tailwind-styled-native.node\"),\n resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", \"tailwind_styled_parser.node\"),\n ]\n for (const c of candidates) {\n try {\n const mod = req(c) as Record<string, unknown>\n if (typeof mod?.pluginSearch === \"function\") {\n return (_native = mod as unknown as NativePluginRegistry)\n }\n } catch { /* continue */ }\n }\n } catch { /* ignore */ }\n return (_native = null)\n}\n\nconst NATIVE_UNAVAILABLE_MESSAGE =\n \"[tailwind-styled/plugin-registry] Native binding is required but not available.\\n\" +\n \"Please ensure you have run: npm run build:rust\"\n\n/**\n * Native-only accessor. Throws if the Rust binding is missing.\n * The TS layer is a thin wrapper — no JS fallbacks (native-first philosophy).\n */\nfunction requireNative(): NativePluginRegistry {\n const native = getNative()\n if (!native) throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\n return native\n}\n\nconst PLUGIN_NAME_REGEX = /^(@[a-z0-9-]+\\/)?[a-z0-9-]+(@[0-9]+\\.[0-9]+\\.[0-9]+)?$/\n\nexport interface PluginInfo {\n name: string\n description: string\n version: string\n tags: string[]\n official?: boolean\n docs?: string\n install?: string\n integrity?: string\n}\n\ninterface RegistryData {\n version: string\n official: PluginInfo[]\n community: PluginInfo[]\n}\n\nexport interface InstallResult {\n plugin: string\n installed: boolean\n command: string\n exitCode: number\n}\n\nexport type PluginRegistryErrorCode =\n | \"INVALID_PLUGIN_NAME\"\n | \"PLUGIN_NOT_FOUND\"\n | \"EXTERNAL_CONFIRMATION_REQUIRED\"\n | \"INSTALL_COMMAND_FAILED\"\n | \"INSTALL_FAILED\"\n | \"NETWORK_ERROR\"\n | \"REGISTRY_LOAD_FAILED\"\n\nexport interface PluginRegistryErrorPayload {\n code: PluginRegistryErrorCode\n message: string\n context?: Record<string, unknown>\n}\n\nexport class PluginRegistryError extends Error {\n readonly code: PluginRegistryErrorCode\n readonly context?: Record<string, unknown>\n\n constructor(payload: PluginRegistryErrorPayload) {\n super(payload.message)\n this.name = \"PluginRegistryError\"\n this.code = payload.code\n this.context = payload.context\n }\n\n toObject(): PluginRegistryErrorPayload {\n return {\n code: this.code,\n message: this.message,\n context: this.context,\n }\n }\n}\n\nexport interface InstallOptions {\n dryRun?: boolean\n npmBin?: string\n allowExternal?: boolean\n confirmExternal?: boolean\n}\n\nexport interface RegistryOptions {\n registryUrl?: string\n}\n\nexport class PluginRegistry {\n private readonly plugins: PluginInfo[]\n private readonly registryVersion: string\n\n constructor(registryData?: RegistryData, options: RegistryOptions = {}) {\n if (options.registryUrl) {\n this.plugins = []\n this.registryVersion = \"0.0.0\"\n } else {\n const data = registryData\n const version = data?.version ?? \"4.2.0\"\n const official = (data?.official ?? []).map((item) => ({\n name: item.name,\n description: item.description,\n version: item.version,\n tags: [...item.tags],\n official: true,\n docs: item.docs,\n install: item.install,\n integrity: item.integrity,\n }))\n const community = (data?.community ?? []).map((item) => ({\n name: item.name,\n description: item.description,\n version: item.version,\n tags: [...item.tags],\n official: false,\n }))\n this.plugins = [...official, ...community]\n this.registryVersion = version\n }\n }\n\n static async loadFromUrl(url: string): Promise<PluginRegistry> {\n try {\n const response = await fetch(url)\n if (!response.ok) {\n throw new PluginRegistryError({\n code: \"NETWORK_ERROR\",\n message: `Failed to fetch registry: ${response.status} ${response.statusText}`,\n context: { url, status: response.status },\n })\n }\n const data = (await response.json()) as RegistryData\n return new PluginRegistry(data, { registryUrl: url })\n } catch (error) {\n if (error instanceof PluginRegistryError) throw error\n throw new PluginRegistryError({\n code: \"NETWORK_ERROR\",\n message: `Failed to load registry: ${error instanceof Error ? error.message : String(error)}`,\n context: { url },\n })\n }\n }\n\n getVersion(): string {\n return this.registryVersion\n }\n\n search(query: string): PluginInfo[] {\n const native = requireNative()\n return JSON.parse(native.pluginSearch(JSON.stringify(this.plugins), query)) as PluginInfo[]\n }\n\n getAll(): PluginInfo[] {\n return [...this.plugins]\n }\n\n getByName(pluginName: string): PluginInfo | undefined {\n const nameWithoutVersion = pluginName.split(\"@\").slice(0, 2).join(\"@\")\n return this.plugins.find((plugin) => plugin.name === nameWithoutVersion)\n }\n\n install(pluginName: string, options: InstallOptions = {}): InstallResult {\n const npmBin = options.npmBin ?? process.env.TW_PLUGIN_NPM_BIN ?? \"npm\"\n\n const native = requireNative()\n const isValidName = native.pluginValidateName(pluginName)\n\n if (!isValidName) {\n throw new PluginRegistryError({\n code: \"INVALID_PLUGIN_NAME\",\n message: `Nama plugin tidak valid: '${pluginName}'.`,\n context: {\n pluginName,\n expectedPattern: String(PLUGIN_NAME_REGEX),\n },\n })\n }\n\n const knownPlugin = this.getByName(pluginName)\n const isExternal = !knownPlugin\n\n if (isExternal && !options.allowExternal) {\n throw new PluginRegistryError({\n code: \"PLUGIN_NOT_FOUND\",\n message: `Plugin '${pluginName}' tidak ditemukan di registry. Coba cari dengan 'tw-plugin search <keyword>'.`,\n context: {\n pluginName,\n allowExternal: false,\n },\n })\n }\n\n if (isExternal && options.allowExternal && !options.confirmExternal) {\n throw new PluginRegistryError({\n code: \"EXTERNAL_CONFIRMATION_REQUIRED\",\n message: `Plugin eksternal '${pluginName}' butuh konfirmasi. Jalankan ulang dengan --allow-external --yes.`,\n context: {\n pluginName,\n allowExternal: true,\n },\n })\n }\n\n const command = `${npmBin} install ${pluginName}`\n if (options.dryRun) {\n return { plugin: pluginName, installed: true, command, exitCode: 0 }\n }\n\n const child = spawnSync(npmBin, [\"install\", pluginName], { stdio: \"inherit\" })\n if (child.error) {\n throw new PluginRegistryError({\n code: \"INSTALL_COMMAND_FAILED\",\n message: `Gagal menjalankan perintah install: ${command}`,\n context: {\n pluginName,\n command,\n reason: child.error.message,\n },\n })\n }\n\n if (child.status !== 0) {\n throw new PluginRegistryError({\n code: \"INSTALL_FAILED\",\n message: `Install gagal (${child.status ?? 1}): ${command}`,\n context: {\n pluginName,\n command,\n exitCode: child.status ?? 1,\n },\n })\n }\n\n return {\n plugin: pluginName,\n installed: true,\n command,\n exitCode: 0,\n }\n }\n\n uninstall(\n pluginName: string,\n options: { dryRun?: boolean; npmBin?: string } = {}\n ): {\n plugin: string\n uninstalled: boolean\n command: string\n exitCode: number\n } {\n const npmBin = options.npmBin ?? process.env.TW_PLUGIN_NPM_BIN ?? \"npm\"\n const command = `${npmBin} uninstall ${pluginName}`\n\n if (options.dryRun) {\n return { plugin: pluginName, uninstalled: true, command, exitCode: 0 }\n }\n\n const child = spawnSync(npmBin, [\"uninstall\", pluginName], { stdio: \"inherit\" })\n if (child.status !== 0 && child.status !== null) {\n throw new PluginRegistryError({\n code: \"INSTALL_FAILED\",\n message: `Uninstall gagal (${child.status}): ${command}`,\n context: { pluginName, command, exitCode: child.status },\n })\n }\n\n return {\n plugin: pluginName,\n uninstalled: true,\n command,\n exitCode: child.status ?? 0,\n }\n }\n\n verifyIntegrity(pluginName: string): { ok: boolean; reason?: string } {\n const plugin = this.getByName(pluginName)\n if (!plugin) return { ok: false, reason: `Plugin '${pluginName}' not in registry` }\n if (!plugin.integrity) {\n return { ok: true, reason: \"no checksum registered (skip)\" }\n }\n try {\n const pkgPath = join(process.cwd(), \"node_modules\", pluginName, \"package.json\")\n if (!existsSync(pkgPath)) return { ok: false, reason: \"plugin not installed\" }\n const content = readFileSync(pkgPath, \"utf8\")\n const native = requireNative()\n const ok = native.pluginVerifyIntegrity(content, plugin.integrity!)\n return ok ? { ok: true } : { ok: false, reason: `Integrity mismatch: expected ${plugin.integrity}` }\n } catch (e: unknown) {\n return {\n ok: false,\n reason: `Integrity check failed: ${e instanceof Error ? e.message : String(e)}`,\n }\n }\n }\n\n checkForUpdate(pluginName: string): {\n hasUpdate: boolean\n current?: string\n latest?: string\n error?: string\n } {\n const plugin = this.getByName(pluginName)\n if (!plugin) return { hasUpdate: false, error: `Plugin '${pluginName}' not in registry` }\n try {\n const pkgPath = join(process.cwd(), \"node_modules\", pluginName, \"package.json\")\n if (!existsSync(pkgPath)) return { hasUpdate: false, error: \"plugin not installed\" }\n const current = JSON.parse(readFileSync(pkgPath, \"utf8\")).version ?? \"0.0.0\"\n const latest = plugin.version\n const native = requireNative()\n const hasUpdate = native.pluginSemverHasUpdate(current as string, latest)\n return { hasUpdate, current: current as string, latest }\n } catch (e: unknown) {\n return {\n hasUpdate: false,\n error: `Update check failed: ${e instanceof Error ? e.message : String(e)}`,\n }\n }\n }\n\n checkAllUpdates(): Array<{\n name: string\n hasUpdate: boolean\n current?: string\n latest?: string\n error?: string\n }> {\n type UpdateResult = {\n name: string\n hasUpdate: boolean\n current?: string\n latest?: string\n error?: string\n }\n const native = requireNative()\n\n // FS I/O stays in JS — gather installed versions for every registry plugin.\n const installed: Array<{ name: string; version: string }> = []\n const byName = new Map<string, UpdateResult>()\n for (const p of this.plugins) {\n try {\n const pkgPath = join(process.cwd(), \"node_modules\", p.name, \"package.json\")\n if (!existsSync(pkgPath)) {\n byName.set(p.name, { name: p.name, hasUpdate: false, error: \"plugin not installed\" })\n continue\n }\n const version = JSON.parse(readFileSync(pkgPath, \"utf8\")).version ?? \"0.0.0\"\n installed.push({ name: p.name, version: version as string })\n } catch (e: unknown) {\n byName.set(p.name, {\n name: p.name,\n hasUpdate: false,\n error: `Update check failed: ${e instanceof Error ? e.message : String(e)}`,\n })\n }\n }\n\n // Single native batch call does all semver comparisons (1 FFI crossing, not N).\n const results = JSON.parse(\n native.pluginCheckAllUpdates(JSON.stringify(installed), JSON.stringify(this.plugins))\n ) as UpdateResult[]\n for (const r of results) byName.set(r.name, r)\n\n // Preserve registry order.\n return this.plugins.map((p) => byName.get(p.name)).filter((r): r is UpdateResult => r !== undefined)\n }\n}\n\nconst _state = { defaultRegistry: null as PluginRegistry | null }\n\nexport function getRegistry(): PluginRegistry {\n if (!_state.defaultRegistry) {\n const registryData = require(\"../registry.json\") as RegistryData\n _state.defaultRegistry = new PluginRegistry(registryData)\n }\n return _state.defaultRegistry\n}\n\nexport const registry = getRegistry()"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,kDAAAA,UAAAC,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,SAAW;AAAA,MACX,WAAa;AAAA,MACb,UAAY;AAAA,QACV;AAAA,UACE,MAAQ;AAAA,UACR,aAAe;AAAA,UACf,SAAW;AAAA,UACX,MAAQ,CAAC,aAAa,UAAU,cAAc,WAAW;AAAA,UACzD,MAAQ;AAA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AAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,OAAO,OAAO,uBAAuB,CAAC;AACpF;AAAA,QACF;AACA,cAAM,UAAU,KAAK,UAAM,6BAAa,SAAS,MAAM,CAAC,EAAE,WAAW;AACrE,kBAAU,KAAK,EAAE,MAAM,EAAE,MAAM,QAA2B,CAAC;AAAA,MAC7D,SAAS,GAAY;AACnB,eAAO,IAAI,EAAE,MAAM;AAAA,UACjB,MAAM,EAAE;AAAA,UACR,WAAW;AAAA,UACX,OAAO,wBAAwB,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;AAAA,QAC3E,CAAC;AAAA,MACH;AAAA,IACF;AAGA,UAAM,UAAU,KAAK;AAAA,MACnB,OAAO,sBAAsB,KAAK,UAAU,SAAS,GAAG,KAAK,UAAU,KAAK,OAAO,CAAC;AAAA,IACtF;AACA,eAAW,KAAK,QAAS,QAAO,IAAI,EAAE,MAAM,CAAC;AAG7C,WAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,OAAO,IAAI,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,MAAyB,MAAM,MAAS;AAAA,EACrG;AACF;AAEA,IAAM,SAAS,EAAE,iBAAiB,KAA8B;AAEzD,SAAS,cAA8B;AAC5C,MAAI,CAAC,OAAO,iBAAiB;AAC3B,UAAM,eAAe;AACrB,WAAO,kBAAkB,IAAI,eAAe,YAAY;AAAA,EAC1D;AACA,SAAO,OAAO;AAChB;AAEO,IAAM,WAAW,YAAY;","names":["exports","module"]}
1
+ {"version":3,"sources":["../packages/domain/plugin-registry/registry.json","../src/umbrella/plugin-registry.ts","../packages/domain/plugin-registry/src/index.ts"],"sourcesContent":["{\n \"version\": \"5.0.0\",\n \"updatedAt\": \"2026-03-23\",\n \"official\": [\n {\n \"name\": \"@tailwind-styled/plugin-animation\",\n \"description\": \"Animation presets and keyframes — enter/exit transitions, spring physics, scroll-triggered\",\n \"version\": \"5.0.0\",\n \"tags\": [\"animation\", \"motion\", \"transition\", \"keyframes\"],\n \"docs\": \"https://github.com/tailwind-styled/tailwind-styled-v5/tree/main/packages/animate\",\n \"install\": \"npm install @tailwind-styled/plugin-animation@5.0.0\",\n \"integrity\": \"sha256-abc123\"\n },\n {\n \"name\": \"@tailwind-styled/plugin-typography\",\n \"description\": \"Prose and typography utilities — headings, body, code blocks, with dark mode\",\n \"version\": \"5.0.0\",\n \"tags\": [\"typography\", \"prose\", \"markdown\", \"content\"],\n \"docs\": \"https://github.com/tailwind-styled/tailwind-styled-v5/tree/main/docs/plugins\",\n \"install\": \"npm install @tailwind-styled/plugin-typography@5.0.0\",\n \"integrity\": \"sha256-def456\"\n },\n {\n \"name\": \"@tailwind-styled/plugin-forms\",\n \"description\": \"Form input styling helpers — reset, validation states, custom checkboxes/radios\",\n \"version\": \"5.0.0\",\n \"tags\": [\"forms\", \"inputs\", \"validation\", \"checkbox\", \"radio\"],\n \"docs\": \"https://github.com/tailwind-styled/tailwind-styled-v5/tree/main/docs/plugins\",\n \"install\": \"npm install @tailwind-styled/plugin-forms@5.0.0\",\n \"integrity\": \"sha256-ghi789\"\n },\n {\n \"name\": \"@tailwind-styled/plugin-container-queries\",\n \"description\": \"Container query utilities — @container breakpoints for component-level responsiveness\",\n \"version\": \"5.0.0\",\n \"tags\": [\"container-queries\", \"responsive\", \"layout\"],\n \"docs\": \"https://github.com/tailwind-styled/tailwind-styled-v5/tree/main/docs/plugins\",\n \"install\": \"npm install @tailwind-styled/plugin-container-queries@5.0.0\",\n \"integrity\": \"sha256-jkl012\"\n }\n ],\n \"community\": [\n {\n \"name\": \"tailwind-styled-animate\",\n \"description\": \"Community animation variants — bounce, pulse, wiggle, and more\",\n \"version\": \"0.1.0\",\n \"tags\": [\"animation\", \"community\"],\n \"author\": \"community\",\n \"install\": \"npm install tailwind-styled-animate\"\n },\n {\n \"name\": \"tailwind-styled-icons\",\n \"description\": \"SVG icon system integrated with tw() variant API\",\n \"version\": \"0.1.0\",\n \"tags\": [\"icons\", \"svg\", \"community\"],\n \"author\": \"community\",\n \"install\": \"npm install tailwind-styled-icons\"\n }\n ]\n}\n","export * from \"@tailwind-styled/plugin-registry\"\n","import { spawnSync } from \"node:child_process\"\nimport { existsSync, readFileSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { join, resolve } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\n// ── Native bridge (lazy-loaded to avoid circular deps) ──────────────────────\ntype NativePluginRegistry = {\n pluginSearch: (pluginsJson: string, query: string) => string\n pluginValidateName: (name: string) => boolean\n pluginVerifyIntegrity: (content: string, expectedIntegrity: string) => boolean\n pluginSemverHasUpdate: (current: string, latest: string) => boolean\n pluginCheckAllUpdates: (installedJson: string, registryJson: string) => string\n}\nlet _native: NativePluginRegistry | null | undefined = undefined\nfunction getNative(): NativePluginRegistry | null {\n if (_native !== undefined) return _native\n try {\n const runtimeDir = typeof __dirname === \"string\" && __dirname.length > 0\n ? __dirname\n : typeof import.meta !== \"undefined\" && import.meta.url\n ? fileURLToPath(new URL(\".\", import.meta.url))\n : process.cwd()\n const req = createRequire(join(runtimeDir, \"noop.cjs\"))\n const _pa = `${process.platform}-${process.arch}`\n const _paGnu = _pa === \"linux-x64\" ? \"linux-x64-gnu\" : _pa === \"linux-arm64\" ? \"linux-arm64-gnu\" : _pa\n const candidates = [\n // npm install case: dist/../native/\n resolve(runtimeDir, \"..\", \"native\", \"tailwind-styled-native.node\"),\n resolve(runtimeDir, \"..\", \"native\", `tailwind-styled-native.${_pa}.node`),\n resolve(runtimeDir, \"..\", \"native\", `tailwind-styled-native.${_paGnu}.node`),\n resolve(runtimeDir, \"..\", \"native\", \"tailwind_styled_parser.node\"),\n // cwd fallback\n resolve(process.cwd(), \"native\", \"tailwind-styled-native.node\"),\n resolve(process.cwd(), \"native\", \"tailwind_styled_parser.node\"),\n // monorepo dev: 4-level up\n resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", \"tailwind-styled-native.node\"),\n resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", \"tailwind_styled_parser.node\"),\n // 3-level fallback\n resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", \"tailwind-styled-native.node\"),\n resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", \"tailwind_styled_parser.node\"),\n ]\n for (const c of candidates) {\n try {\n const mod = req(c) as Record<string, unknown>\n if (typeof mod?.pluginSearch === \"function\") {\n return (_native = mod as unknown as NativePluginRegistry)\n }\n } catch { /* continue */ }\n }\n } catch { /* ignore */ }\n return (_native = null)\n}\n\nconst NATIVE_UNAVAILABLE_MESSAGE =\n \"[tailwind-styled/plugin-registry] Native binding is required but not available.\\n\" +\n \"Please ensure you have run: npm run build:rust\"\n\n/**\n * Native-only accessor. Throws if the Rust binding is missing.\n * The TS layer is a thin wrapper — no JS fallbacks (native-first philosophy).\n */\nfunction requireNative(): NativePluginRegistry {\n const native = getNative()\n if (!native) throw new Error(NATIVE_UNAVAILABLE_MESSAGE)\n return native\n}\n\nconst PLUGIN_NAME_REGEX = /^(@[a-z0-9-]+\\/)?[a-z0-9-]+(@[0-9]+\\.[0-9]+\\.[0-9]+)?$/\n\nexport interface PluginInfo {\n name: string\n description: string\n version: string\n tags: string[]\n official?: boolean\n docs?: string\n install?: string\n integrity?: string\n}\n\ninterface RegistryData {\n version: string\n official: PluginInfo[]\n community: PluginInfo[]\n}\n\nexport interface InstallResult {\n plugin: string\n installed: boolean\n command: string\n exitCode: number\n}\n\nexport type PluginRegistryErrorCode =\n | \"INVALID_PLUGIN_NAME\"\n | \"PLUGIN_NOT_FOUND\"\n | \"EXTERNAL_CONFIRMATION_REQUIRED\"\n | \"INSTALL_COMMAND_FAILED\"\n | \"INSTALL_FAILED\"\n | \"NETWORK_ERROR\"\n | \"REGISTRY_LOAD_FAILED\"\n\nexport interface PluginRegistryErrorPayload {\n code: PluginRegistryErrorCode\n message: string\n context?: Record<string, unknown>\n}\n\nexport class PluginRegistryError extends Error {\n readonly code: PluginRegistryErrorCode\n readonly context?: Record<string, unknown>\n\n constructor(payload: PluginRegistryErrorPayload) {\n super(payload.message)\n this.name = \"PluginRegistryError\"\n this.code = payload.code\n this.context = payload.context\n }\n\n toObject(): PluginRegistryErrorPayload {\n return {\n code: this.code,\n message: this.message,\n context: this.context,\n }\n }\n}\n\nexport interface InstallOptions {\n dryRun?: boolean\n npmBin?: string\n allowExternal?: boolean\n confirmExternal?: boolean\n}\n\nexport interface RegistryOptions {\n registryUrl?: string\n}\n\nexport class PluginRegistry {\n private readonly plugins: PluginInfo[]\n private readonly registryVersion: string\n\n constructor(registryData?: RegistryData, options: RegistryOptions = {}) {\n if (options.registryUrl) {\n this.plugins = []\n this.registryVersion = \"0.0.0\"\n } else {\n const data = registryData\n const version = data?.version ?? \"4.2.0\"\n const official = (data?.official ?? []).map((item) => ({\n name: item.name,\n description: item.description,\n version: item.version,\n tags: [...item.tags],\n official: true,\n docs: item.docs,\n install: item.install,\n integrity: item.integrity,\n }))\n const community = (data?.community ?? []).map((item) => ({\n name: item.name,\n description: item.description,\n version: item.version,\n tags: [...item.tags],\n official: false,\n }))\n this.plugins = [...official, ...community]\n this.registryVersion = version\n }\n }\n\n static async loadFromUrl(url: string): Promise<PluginRegistry> {\n try {\n const response = await fetch(url)\n if (!response.ok) {\n throw new PluginRegistryError({\n code: \"NETWORK_ERROR\",\n message: `Failed to fetch registry: ${response.status} ${response.statusText}`,\n context: { url, status: response.status },\n })\n }\n const data = (await response.json()) as RegistryData\n return new PluginRegistry(data, { registryUrl: url })\n } catch (error) {\n if (error instanceof PluginRegistryError) throw error\n throw new PluginRegistryError({\n code: \"NETWORK_ERROR\",\n message: `Failed to load registry: ${error instanceof Error ? error.message : String(error)}`,\n context: { url },\n })\n }\n }\n\n getVersion(): string {\n return this.registryVersion\n }\n\n search(query: string): PluginInfo[] {\n const native = requireNative()\n return JSON.parse(native.pluginSearch(JSON.stringify(this.plugins), query)) as PluginInfo[]\n }\n\n getAll(): PluginInfo[] {\n return [...this.plugins]\n }\n\n getByName(pluginName: string): PluginInfo | undefined {\n const nameWithoutVersion = pluginName.split(\"@\").slice(0, 2).join(\"@\")\n return this.plugins.find((plugin) => plugin.name === nameWithoutVersion)\n }\n\n install(pluginName: string, options: InstallOptions = {}): InstallResult {\n const npmBin = options.npmBin ?? process.env.TW_PLUGIN_NPM_BIN ?? \"npm\"\n\n const native = requireNative()\n const isValidName = native.pluginValidateName(pluginName)\n\n if (!isValidName) {\n throw new PluginRegistryError({\n code: \"INVALID_PLUGIN_NAME\",\n message: `Nama plugin tidak valid: '${pluginName}'.`,\n context: {\n pluginName,\n expectedPattern: String(PLUGIN_NAME_REGEX),\n },\n })\n }\n\n const knownPlugin = this.getByName(pluginName)\n const isExternal = !knownPlugin\n\n if (isExternal && !options.allowExternal) {\n throw new PluginRegistryError({\n code: \"PLUGIN_NOT_FOUND\",\n message: `Plugin '${pluginName}' tidak ditemukan di registry. Coba cari dengan 'tw-plugin search <keyword>'.`,\n context: {\n pluginName,\n allowExternal: false,\n },\n })\n }\n\n if (isExternal && options.allowExternal && !options.confirmExternal) {\n throw new PluginRegistryError({\n code: \"EXTERNAL_CONFIRMATION_REQUIRED\",\n message: `Plugin eksternal '${pluginName}' butuh konfirmasi. Jalankan ulang dengan --allow-external --yes.`,\n context: {\n pluginName,\n allowExternal: true,\n },\n })\n }\n\n const command = `${npmBin} install ${pluginName}`\n if (options.dryRun) {\n return { plugin: pluginName, installed: true, command, exitCode: 0 }\n }\n\n const child = spawnSync(npmBin, [\"install\", pluginName], { stdio: \"inherit\" })\n if (child.error) {\n throw new PluginRegistryError({\n code: \"INSTALL_COMMAND_FAILED\",\n message: `Gagal menjalankan perintah install: ${command}`,\n context: {\n pluginName,\n command,\n reason: child.error.message,\n },\n })\n }\n\n if (child.status !== 0) {\n throw new PluginRegistryError({\n code: \"INSTALL_FAILED\",\n message: `Install gagal (${child.status ?? 1}): ${command}`,\n context: {\n pluginName,\n command,\n exitCode: child.status ?? 1,\n },\n })\n }\n\n return {\n plugin: pluginName,\n installed: true,\n command,\n exitCode: 0,\n }\n }\n\n uninstall(\n pluginName: string,\n options: { dryRun?: boolean; npmBin?: string } = {}\n ): {\n plugin: string\n uninstalled: boolean\n command: string\n exitCode: number\n } {\n const npmBin = options.npmBin ?? process.env.TW_PLUGIN_NPM_BIN ?? \"npm\"\n const command = `${npmBin} uninstall ${pluginName}`\n\n if (options.dryRun) {\n return { plugin: pluginName, uninstalled: true, command, exitCode: 0 }\n }\n\n const child = spawnSync(npmBin, [\"uninstall\", pluginName], { stdio: \"inherit\" })\n if (child.status !== 0 && child.status !== null) {\n throw new PluginRegistryError({\n code: \"INSTALL_FAILED\",\n message: `Uninstall gagal (${child.status}): ${command}`,\n context: { pluginName, command, exitCode: child.status },\n })\n }\n\n return {\n plugin: pluginName,\n uninstalled: true,\n command,\n exitCode: child.status ?? 0,\n }\n }\n\n verifyIntegrity(pluginName: string): { ok: boolean; reason?: string } {\n const plugin = this.getByName(pluginName)\n if (!plugin) return { ok: false, reason: `Plugin '${pluginName}' not in registry` }\n if (!plugin.integrity) {\n return { ok: true, reason: \"no checksum registered (skip)\" }\n }\n try {\n const pkgPath = join(process.cwd(), \"node_modules\", pluginName, \"package.json\")\n if (!existsSync(pkgPath)) return { ok: false, reason: \"plugin not installed\" }\n const content = readFileSync(pkgPath, \"utf8\")\n const native = requireNative()\n const ok = native.pluginVerifyIntegrity(content, plugin.integrity!)\n return ok ? { ok: true } : { ok: false, reason: `Integrity mismatch: expected ${plugin.integrity}` }\n } catch (e: unknown) {\n return {\n ok: false,\n reason: `Integrity check failed: ${e instanceof Error ? e.message : String(e)}`,\n }\n }\n }\n\n checkForUpdate(pluginName: string): {\n hasUpdate: boolean\n current?: string\n latest?: string\n error?: string\n } {\n const plugin = this.getByName(pluginName)\n if (!plugin) return { hasUpdate: false, error: `Plugin '${pluginName}' not in registry` }\n try {\n const pkgPath = join(process.cwd(), \"node_modules\", pluginName, \"package.json\")\n if (!existsSync(pkgPath)) return { hasUpdate: false, error: \"plugin not installed\" }\n const current = JSON.parse(readFileSync(pkgPath, \"utf8\")).version ?? \"0.0.0\"\n const latest = plugin.version\n const native = requireNative()\n const hasUpdate = native.pluginSemverHasUpdate(current as string, latest)\n return { hasUpdate, current: current as string, latest }\n } catch (e: unknown) {\n return {\n hasUpdate: false,\n error: `Update check failed: ${e instanceof Error ? e.message : String(e)}`,\n }\n }\n }\n\n checkAllUpdates(): Array<{\n name: string\n hasUpdate: boolean\n current?: string\n latest?: string\n error?: string\n }> {\n type UpdateResult = {\n name: string\n hasUpdate: boolean\n current?: string\n latest?: string\n error?: string\n }\n const native = requireNative()\n\n // FS I/O stays in JS — gather installed versions for every registry plugin.\n const installed: Array<{ name: string; version: string }> = []\n const byName = new Map<string, UpdateResult>()\n for (const p of this.plugins) {\n try {\n const pkgPath = join(process.cwd(), \"node_modules\", p.name, \"package.json\")\n if (!existsSync(pkgPath)) {\n byName.set(p.name, { name: p.name, hasUpdate: false, error: \"plugin not installed\" })\n continue\n }\n const version = JSON.parse(readFileSync(pkgPath, \"utf8\")).version ?? \"0.0.0\"\n installed.push({ name: p.name, version: version as string })\n } catch (e: unknown) {\n byName.set(p.name, {\n name: p.name,\n hasUpdate: false,\n error: `Update check failed: ${e instanceof Error ? e.message : String(e)}`,\n })\n }\n }\n\n // Single native batch call does all semver comparisons (1 FFI crossing, not N).\n const results = JSON.parse(\n native.pluginCheckAllUpdates(JSON.stringify(installed), JSON.stringify(this.plugins))\n ) as UpdateResult[]\n for (const r of results) byName.set(r.name, r)\n\n // Preserve registry order.\n return this.plugins.map((p) => byName.get(p.name)).filter((r): r is UpdateResult => r !== undefined)\n }\n}\n\nconst _state = { defaultRegistry: null as PluginRegistry | null }\n\nexport function getRegistry(): PluginRegistry {\n if (!_state.defaultRegistry) {\n const registryData = require(\"../registry.json\") as RegistryData\n _state.defaultRegistry = new PluginRegistry(registryData)\n }\n return _state.defaultRegistry\n}\n\nexport const registry = getRegistry()"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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));
33
33
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
34
 
35
- // packages/domain/shared/src/esmHelpers.ts
36
- function getNodeModuleRef() {
37
- if (isBrowser) return null;
38
- if (nodeModuleRef !== null) return nodeModuleRef;
39
- try {
40
- const test = typeof require === "function" ? require("module") : null;
41
- nodeModuleRef = test;
42
- return test;
43
- } catch {
44
- nodeModuleRef = null;
45
- return null;
46
- }
47
- }
48
- function getCurrentFileUrl() {
49
- if (__importMetaUrl) {
50
- return __importMetaUrl;
51
- }
52
- if (typeof __filename !== "undefined") {
53
- return `file://${__filename.replace(/\\/g, "/")}`;
54
- }
55
- return "file://unknown";
56
- }
57
- function getNodePath() {
58
- if (isBrowser) throw new Error("node:path not available in browser");
59
- if (!_nodePath) {
60
- if (typeof require === "function") {
61
- _nodePath = require("path");
62
- } else {
63
- const nodeRequire = getNodeModuleRef();
64
- if (!nodeRequire) throw new Error("require not available");
65
- _nodePath = nodeRequire.createRequire(getCurrentFileUrl())("node:path");
66
- }
67
- }
68
- return _nodePath;
69
- }
70
- function getNodeUrl() {
71
- if (isBrowser) throw new Error("node:url not available in browser");
72
- if (!_nodeUrl) {
73
- if (typeof require === "function") {
74
- _nodeUrl = require("url");
75
- } else {
76
- const nodeRequire = getNodeModuleRef();
77
- if (!nodeRequire) throw new Error("require not available");
78
- _nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())("node:url");
79
- }
80
- }
81
- return _nodeUrl;
82
- }
83
- function getDirname(importMetaUrl) {
84
- if (isBrowser) return "";
85
- if (typeof __dirname !== "undefined") return __dirname;
86
- const nodePath = getNodePath();
87
- const nodeUrl = getNodeUrl();
88
- return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
89
- }
90
- var isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
91
- var init_esmHelpers = __esm({
92
- "packages/domain/shared/src/esmHelpers.ts"() {
93
- "use strict";
94
- isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
95
- nodeModuleRef = null;
96
- _nodePath = null;
97
- _nodeUrl = null;
98
- }
99
- });
100
-
101
35
  // packages/domain/shared/src/index.ts
102
36
  function formatIssuePath(path3) {
103
37
  if (!path3 || path3.length === 0) return "(root)";
@@ -114,7 +48,6 @@ var init_src = __esm({
114
48
  import_node_path = __toESM(require("path"));
115
49
  import_node_url = require("url");
116
50
  import_node_module = require("module");
117
- init_esmHelpers();
118
51
  TwError = class _TwError extends Error {
119
52
  /** @deprecated Gunakan source */
120
53
  domain;
@@ -186,7 +119,6 @@ module.exports = __toCommonJS(rspack_exports);
186
119
  // packages/presentation/rspack/src/index.ts
187
120
  var import_node_fs2 = __toESM(require("fs"), 1);
188
121
  var import_node_path2 = __toESM(require("path"), 1);
189
- init_src();
190
122
 
191
123
  // packages/presentation/rspack/src/schemas.ts
192
124
  var import_zod = require("zod");
@@ -221,18 +153,17 @@ var RspackPluginOptionsSchema = import_zod.z.object({
221
153
  var parseRspackPluginOptions = (options) => parseWithSchema(RspackPluginOptionsSchema, options ?? {}, "rspack plugin options are invalid");
222
154
 
223
155
  // packages/presentation/rspack/src/index.ts
224
- var import_meta = {};
225
- function getDirname2() {
156
+ function getDirname() {
226
157
  if (typeof __dirname !== "undefined") {
227
158
  return __dirname;
228
159
  }
229
- if (typeof import_meta !== "undefined" && __importMetaUrl) {
230
- return getDirname(__importMetaUrl);
160
+ if (false) {
161
+ return getEsmDirname(__importMetaUrl);
231
162
  }
232
163
  return process.cwd();
233
164
  }
234
165
  function resolveLoaderPath(basename) {
235
- const runtimeDir = getDirname2();
166
+ const runtimeDir = getDirname();
236
167
  const preferredExtensions = typeof __dirname !== "undefined" && __dirname.length > 0 ? [".cjs", ".js"] : [".js", ".cjs"];
237
168
  for (const ext of preferredExtensions) {
238
169
  const candidate = import_node_path2.default.resolve(runtimeDir, `${basename}${ext}`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../packages/domain/shared/src/esmHelpers.ts","../packages/domain/shared/src/index.ts","../src/umbrella/rspack.ts","../packages/presentation/rspack/src/index.ts","../packages/presentation/rspack/src/schemas.ts"],"sourcesContent":["/**\n * ESM-safe runtime helpers untuk monorepo.\n *\n * Menggantikan pola fragile seperti:\n * - `createRequire(import.meta.url)` → gunakan `createEsmRequire()`\n * - `__dirname` → gunakan `getDirname(import.meta.url)`\n * - `__filename` → gunakan `getFilename(import.meta.url)`\n *\n * Semua helper ini bekerja di ESM dan CJS.\n *\n * @module @tailwind-styled/shared/esmHelpers\n */\n\nconst isBrowser = typeof window !== \"undefined\" || typeof document !== \"undefined\"\n\n// Safe check for require availability - works in both CJS and ESM\nlet nodeModuleRef: typeof import(\"node:module\") | null = null\nfunction getNodeModuleRef(): typeof import(\"node:module\") | null {\n if (isBrowser) return null\n if (nodeModuleRef !== null) return nodeModuleRef\n try {\n const test = typeof require === 'function' ? (require('node:module') as typeof import(\"node:module\")) : null\n nodeModuleRef = test\n return test\n } catch {\n nodeModuleRef = null\n return null\n }\n}\n\nlet _nodePath: typeof import(\"node:path\") | null = null\nlet _nodeUrl: typeof import(\"node:url\") | null = null\nlet _nodeFs: typeof import(\"node:fs\") | null = null\nlet _nodeCrypto: typeof import(\"node:crypto\") | null = null\nlet _nodeOs: typeof import(\"node:os\") | null = null\n\n/**\n * Get current file URL in a way that works in both ESM and CJS.\n * In ESM: uses import.meta.url\n * In CJS: uses __filename converted to file URL\n */\nfunction getCurrentFileUrl(): string {\n // In CJS builds, import.meta.url is replaced by esbuild with __importMetaUrl\n // which is set via the banner polyfill. In ESM it's the real URL.\n if (import.meta.url) {\n return import.meta.url\n }\n // Fallback: __filename is available in bare CJS (not bundled)\n if (typeof __filename !== \"undefined\") {\n return `file://${__filename.replace(/\\\\/g, \"/\")}`\n }\n return \"file://unknown\"\n}\n\nfunction getNodePath(): typeof import(\"node:path\") {\n if (isBrowser) throw new Error(\"node:path not available in browser\")\n if (!_nodePath) {\n if (typeof require === \"function\") {\n _nodePath = require(\"node:path\") as typeof import(\"node:path\")\n } else {\n const nodeRequire = getNodeModuleRef()\n if (!nodeRequire) throw new Error(\"require not available\")\n _nodePath = nodeRequire.createRequire(getCurrentFileUrl())(\"node:path\") as typeof import(\"node:path\")\n }\n }\n return _nodePath!\n}\nfunction getNodeUrl(): typeof import(\"node:url\") {\n if (isBrowser) throw new Error(\"node:url not available in browser\")\n if (!_nodeUrl) {\n if (typeof require === \"function\") {\n _nodeUrl = require(\"node:url\") as typeof import(\"node:url\")\n } else {\n const nodeRequire = getNodeModuleRef()\n if (!nodeRequire) throw new Error(\"require not available\")\n _nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())(\"node:url\") as typeof import(\"node:url\")\n }\n }\n return _nodeUrl!\n}\nfunction getNodeFs(): typeof import(\"node:fs\") {\n if (isBrowser) throw new Error(\"node:fs not available in browser\")\n if (!_nodeFs) {\n if (typeof require === \"function\") {\n _nodeFs = require(\"node:fs\") as typeof import(\"node:fs\")\n } else {\n const nodeRequire = getNodeModuleRef()\n if (!nodeRequire) throw new Error(\"require not available\")\n _nodeFs = nodeRequire.createRequire(getCurrentFileUrl())(\"node:fs\") as typeof import(\"node:fs\")\n }\n }\n return _nodeFs!\n}\nfunction getNodeCrypto(): typeof import(\"node:crypto\") {\n if (isBrowser) throw new Error(\"node:crypto not available in browser\")\n if (!_nodeCrypto) {\n if (typeof require === \"function\") {\n _nodeCrypto = require(\"node:crypto\") as typeof import(\"node:crypto\")\n } else {\n const nodeRequire = getNodeModuleRef()\n if (!nodeRequire) throw new Error(\"require not available\")\n _nodeCrypto = nodeRequire.createRequire(getCurrentFileUrl())(\"node:crypto\") as typeof import(\"node:crypto\")\n }\n }\n return _nodeCrypto!\n}\nfunction getNodeOs(): typeof import(\"node:os\") {\n if (isBrowser) throw new Error(\"node:os not available in browser\")\n if (!_nodeOs) {\n if (typeof require === \"function\") {\n _nodeOs = require(\"node:os\") as typeof import(\"node:os\")\n } else {\n const nodeRequire = getNodeModuleRef()\n if (!nodeRequire) throw new Error(\"require not available\")\n _nodeOs = nodeRequire.createRequire(getCurrentFileUrl())(\"node:os\") as typeof import(\"node:os\")\n }\n }\n return _nodeOs!\n}\n\n/**\n * Buat `require()` function yang relative terhadap sebuah ESM module.\n *\n * @example\n * const req = createEsmRequire(import.meta.url)\n * const mod = req(\"some-pkg\")\n */\nexport function createEsmRequire(importMetaUrl: string): NodeRequire {\n if (isBrowser) throw new Error(\"require not available in browser\")\n // CJS: require is already available globally\n if (typeof require === \"function\") return require\n const nodeRequire = getNodeModuleRef()\n if (!nodeRequire) throw new Error(\"require not available\")\n return nodeRequire.createRequire(importMetaUrl)\n}\n\n/**\n * Dapat `__dirname` dari `import.meta.url`.\n *\n * @example\n * const dir = getDirname(import.meta.url)\n */\nexport function getDirname(importMetaUrl: string): string {\n if (isBrowser) return \"\"\n // CJS: __dirname is directly available\n if (typeof __dirname !== \"undefined\") return __dirname\n const nodePath = getNodePath()\n const nodeUrl = getNodeUrl()\n return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl))\n}\n\n/**\n * Dapat `__filename` dari `import.meta.url`.\n */\nexport function getFilename(importMetaUrl: string): string {\n if (isBrowser) return \"\"\n // CJS: __filename is directly available\n if (typeof __filename !== \"undefined\") return __filename\n return getNodeUrl().fileURLToPath(importMetaUrl)\n}\n\n/**\n * Resolve path dari root monorepo (bukan CWD).\n */\nexport function resolveFromRoot(...segments: string[]): string {\n if (isBrowser) return segments.join(\"/\")\n\n const nodePath = getNodePath()\n const nodeFs = getNodeFs()\n\n // Use __dirname in CJS, or getDirname with current file URL in ESM\n let dir = typeof __dirname !== \"undefined\"\n ? __dirname\n : getDirname(getCurrentFileUrl())\n\n for (let i = 0; i < 10; i++) {\n const pkgPath = nodePath.join(dir, \"package.json\")\n try {\n const pkg = JSON.parse(nodeFs.readFileSync(pkgPath, \"utf-8\"))\n if (pkg.workspaces) {\n return nodePath.resolve(dir, ...segments)\n }\n } catch { /* intentionally silent */ }\n dir = nodePath.dirname(dir)\n }\n return nodePath.resolve(process.cwd(), ...segments)\n}\n\n/**\n * Require sebuah module dengan fallback ke null jika tidak tersedia.\n */\nexport function tryRequire<T = unknown>(\n moduleName: string,\n importMetaUrl: string\n): T | null {\n if (isBrowser) return null\n try {\n return createEsmRequire(importMetaUrl)(moduleName) as T\n } catch { /* intentionally silent — optional dep */ }\n return null\n}\n\n/**\n * Resolve .node binary path yang cross-platform dan ESM-safe.\n */\nexport function resolveNativeNodePath(\n importMetaUrl: string,\n ...relativeSegments: string[]\n): string {\n if (isBrowser) return relativeSegments.join(\"/\")\n return getNodePath().resolve(getDirname(importMetaUrl), ...relativeSegments)\n}\n","import { createHash } from \"node:crypto\"\nimport fs from \"node:fs\"\nimport path from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\nimport { createRequire } from \"node:module\"\n\n// Native-only: Node.js is always available. No browser fallback.\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type TokenMap = Record<string, string>\n\nexport type VariantValue = string | number | boolean | undefined\n\nexport type VariantProps = Record<string, VariantValue>\n\nexport type HtmlTagName = keyof HTMLElementTagNameMap\n\nexport type CompoundCondition = Record<string, string | number | boolean>\n\nexport type VariantMatrix = Record<string, Array<string | number | boolean>>\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Logging\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface Logger {\n warn(...args: unknown[]): void\n debug(...args: unknown[]): void\n error(...args: unknown[]): void\n log(...args: unknown[]): void\n}\n\nexport function createLogger(namespace: string): Logger {\n const prefix = `[${namespace}]`\n return {\n warn(...args: unknown[]) {\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n },\n debug(...args: unknown[]) {\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n },\n error(...args: unknown[]) {\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n },\n log(...args: unknown[]) {\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n },\n }\n}\n\nexport function createDebugLogger(namespace: string, label?: string): (msg: string) => void {\n const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`\n return (msg: string) => {\n if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {\n console.debug(prefix, msg)\n }\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error handling\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type ErrorSource = \"rust\" | \"validation\" | \"compile\" | \"io\" | \"config\" | \"unknown\"\n\ntype ZodLikeIssue = {\n path?: readonly PropertyKey[]\n message?: string\n}\n\nfunction formatIssuePath(path?: readonly PropertyKey[]): string {\n if (!path || path.length === 0) return \"(root)\"\n return path\n .map((segment) =>\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\n )\n .join(\".\")\n}\n\nexport class TwError extends Error {\n /** @deprecated Gunakan source */\n public readonly domain: string\n public readonly source: ErrorSource\n public readonly code: string\n public readonly originalCause?: unknown\n\n constructor(domainOrSource: string, code: string, message: string, cause?: unknown) {\n super(message)\n this.name = \"TwError\"\n this.domain = domainOrSource\n this.source = domainOrSource as ErrorSource\n this.code = code\n this.originalCause = cause\n if (Error.captureStackTrace) Error.captureStackTrace(this, TwError)\n }\n\n static fromIo(code: string, message: string): TwError {\n return new TwError(\"io\", code, message)\n }\n\n static fromCompile(code: string, message: string): TwError {\n return new TwError(\"compile\", code, message)\n }\n\n static fromRust(err: { code?: string; message?: string } | Error | unknown): TwError {\n if (err instanceof TwError) return err\n if (err instanceof Error) return new TwError(\"rust\", \"RUST_ERROR\", err.message, err)\n if (err && typeof err === \"object\") {\n const e = err as { code?: string; message?: string }\n return new TwError(\"rust\", e.code ?? \"RUST_ERROR\", e.message ?? String(err), err)\n }\n return new TwError(\"rust\", \"RUST_ERROR\", String(err), err)\n }\n\n /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */\n static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[] }): TwError {\n const first = err.issues?.[0] ?? err.errors?.[0]\n const path = formatIssuePath(first?.path)\n const message = first ? `${path}: ${first.message}` : \"Schema validation failed\"\n return new TwError(\"validation\", \"SCHEMA_VALIDATION_FAILED\", message, err)\n }\n\n static wrap(source: string, code: string, err: unknown): TwError {\n if (err instanceof TwError) return err\n if (err instanceof Error) return new TwError(source, code, err.message, err)\n return new TwError(source, code, String(err), err)\n }\n\n override toString(): string {\n return `TwError [${this.source}:${this.code}] ${this.message}`\n }\n\n toJSON(): { name: string; source: string; code: string; message: string } {\n return { name: this.name, source: this.source, code: this.code, message: this.message }\n }\n\n toCliMessage(): string {\n return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`\n }\n}\n\nexport function wrapUnknownError(domain: string, code: string, error: unknown): TwError {\n return TwError.wrap(domain, code, error)\n}\n\nexport function isTwError(err: unknown): err is TwError {\n return err instanceof TwError\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Native binding resolution\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface LoadNativeBindingOptions<T> {\n runtimeDir: string\n candidates: string[]\n isValid: (module: unknown) => module is T\n invalidExportMessage: string\n}\n\nexport interface LoadNativeBindingResult<T> {\n binding: T | null\n loadErrors: Array<{ path: string; message: string }>\n loadedPath?: string\n}\n\nexport function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T> {\n const { runtimeDir, candidates, isValid } = options\n const loadErrors: Array<{ path: string; message: string }> = []\n\n for (const candidate of candidates) {\n const candidatePath = path.resolve(runtimeDir, candidate)\n try {\n if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + \".node\")) {\n continue\n }\n const mod = requireNativeModule(candidatePath)\n if (mod && isValid(mod)) {\n return { binding: mod, loadErrors, loadedPath: candidatePath }\n }\n loadErrors.push({ path: candidatePath, message: options.invalidExportMessage })\n } catch (e) {\n loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) })\n }\n }\n\n return { binding: null, loadErrors }\n}\n\nconst _require = createRequire(\n typeof __filename !== \"undefined\"\n ? `file://${__filename}`\n : (import.meta.url ?? \"file://unknown\")\n)\n\nfunction requireNativeModule(p: string): unknown {\n return _require(p)\n}\n\nexport interface ResolveCandidatesOptions {\n runtimeDir?: string\n envVarNames?: string[]\n includeDefaultCandidates?: boolean\n enforceNodeExtensionForEnvPath?: boolean\n /** @deprecated — ignored, kept for backward compat */\n packageName?: string\n}\n\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\n const {\n envVarNames = [\"TW_NATIVE_PATH\", \"TWS_NATIVE_PATH\"],\n includeDefaultCandidates = true,\n enforceNodeExtensionForEnvPath = false,\n } = options\n // Default ke cwd kalau runtimeDir tidak disediakan\n const runtimeDir = options.runtimeDir || process.cwd()\n const candidates: string[] = []\n\n for (const envVar of envVarNames) {\n const envPath = process.env[envVar]\n if (envPath) {\n candidates.push(enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\") ? envPath + \".node\" : envPath)\n }\n }\n\n if (!includeDefaultCandidates) return candidates\n\n if (fs.existsSync(runtimeDir)) {\n try {\n for (const entry of fs.readdirSync(runtimeDir)) {\n if (entry.endsWith(\".node\")) candidates.push(entry)\n }\n } catch { /* ignore read errors */ }\n }\n\n const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\n const napiPlatform = process.platform === \"linux\" && process.arch === \"x64\" ? \"linux-x64-gnu\"\n : process.platform === \"linux\" && process.arch === \"arm64\" ? \"linux-arm64-gnu\"\n : `${process.platform}-${process.arch}`\n\n for (const bin of BINARY_NAMES) {\n candidates.push(path.resolve(runtimeDir, `${bin}.node`))\n candidates.push(path.resolve(runtimeDir, `${bin}.${napiPlatform}.node`))\n // 1 level: dist/ → package-root/native/ (published npm package)\n candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.node`))\n candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.${napiPlatform}.node`))\n // cwd fallback (user project root)\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.node`))\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.${napiPlatform}.node`))\n // 4 level: dist/ → package/ → domain/ → packages/ → repo-root/ (monorepo dev)\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.${napiPlatform}.node`))\n // 3 level fallback\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\n }\n\n return Array.from(new Set(candidates))\n}\n\nexport function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string {\n if (dir) return path.resolve(dir)\n try {\n return path.dirname(fileURLToPath(importMetaUrl))\n } catch {\n return process.cwd()\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Hashing\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport function hashContent(content: string, algorithm: string = \"md5\", length?: number): string {\n const hash = createHash(algorithm).update(content).digest(\"hex\")\n return length ? hash.slice(0, length) : hash\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error formatting\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport function formatErrorMessage(error: unknown): string {\n if (error instanceof TwError) return error.toString()\n if (error instanceof Error) return error.message\n return String(error)\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// LRU Cache\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport class LRUCache<K, V> {\n private capacity: number\n private cache: Map<K, V>\n\n constructor(capacity: number) {\n this.capacity = capacity\n this.cache = new Map()\n }\n\n get(key: K): V | undefined {\n if (!this.cache.has(key)) return undefined\n const value = this.cache.get(key)!\n this.cache.delete(key)\n this.cache.set(key, value)\n return value\n }\n\n set(key: K, value: V): void {\n if (this.cache.has(key)) {\n this.cache.delete(key)\n } else if (this.cache.size >= this.capacity) {\n const firstKey = this.cache.keys().next().value\n if (firstKey !== undefined) {\n this.cache.delete(firstKey)\n }\n }\n this.cache.set(key, value)\n }\n\n delete(key: K): boolean {\n return this.cache.delete(key)\n }\n\n has(key: K): boolean {\n return this.cache.has(key)\n }\n\n clear(): void {\n this.cache.clear()\n }\n\n entries(): IterableIterator<[K, V]> {\n return this.cache.entries()\n }\n\n get size(): number {\n return this.cache.size\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Trace Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { TraceSnapshot, TraceSummary } from \"./trace\"\nexport {\n getHealthColor,\n getModeColor,\n formatMemory,\n formatDuration,\n calculateHealth,\n getBuildTimeColor,\n getMemoryColor,\n createTraceSnapshot,\n getPipelinePercentages,\n} from \"./trace\"\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Performance Telemetry\n// ─────────────────────────────────────────────────────────────────────────────\n\n\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error Codes\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { ErrorCode } from \"./error-codes\"\nexport { ERROR_CODES, getSuggestion, formatErrorCode } from \"./error-codes\"\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tailwind Compatibility\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { TailwindInfo } from \"./compatibility\"\nexport { detectTailwind, assertTailwindV4, getTailwindVersion, isTailwindV4 } from \"./compatibility\"\n\n// ── Native binding schemas (Zod boundary validation)\nexport {\n NativeScanFileSchema, NativeScanResultSchema,\n NativeAnalyzerReportSchema, NativeTransformResultSchema,\n NativeCssCompileResultSchema, NativeWatchResultSchema,\n NativeCacheEntrySchema, NativeCacheReadResultSchema,\n safeParseNative, parseNative,\n} from './native-schemas'\n\n// ── ESM-safe runtime helpers ──────────────────────────────────────────────\nexport {\n createEsmRequire,\n getDirname,\n getFilename,\n resolveFromRoot,\n tryRequire,\n resolveNativeNodePath,\n} from \"./esmHelpers\"\n\n// ── Performance telemetry ────────────────────────────────────────────────────\nexport {\n TelemetryCollector,\n getGlobalTelemetry,\n resetGlobalTelemetry,\n createBuildTimer,\n type BuildTelemetry,\n type TelemetrySummary,\n type BuildPhases,\n} from \"./telemetry\"\n\n// ── Config/JSON schema validation ─────────────────────────────────────────────\nexport {\n ScanCacheSchema,\n ScanCacheClassEntrySchema,\n TailwindConfigSchema,\n RegistryPluginEntrySchema,\n RegistryFileSchema,\n PackageJsonSchema,\n parseJsonWithSchema,\n parseJsonFileWithSchema,\n type ScanCache,\n type ScanCacheClassEntry,\n type TailwindConfig,\n type RegistryPluginEntry,\n type RegistryFile,\n type PackageJson,\n} from \"./configSchemas\"\n\n// ── Worker/bootstrap path resolution ─────────────────────────────────────────\nexport {\n resolveWorkerPath,\n resolveLoaderPath,\n type WorkerPathOptions,\n type WorkerPathResult,\n} from \"./workerResolver\"\n\n// ── Codegen helpers ───────────────────────────────────────────────────────────\nexport {\n generateComponentCode,\n generateStorybookStory,\n generateClassRenameCodemod,\n generateBarrelFile,\n type ComponentCodegenOptions,\n} from \"./codegen\"\n\n// ── Native binary resolution (QA #1) ─────────────────────────────────────────\nexport {\n resolveNativeBinary,\n formatNativeNotFoundError,\n type NativeResolutionResult,\n} from \"./native-resolution\"\n\n// ── Shared observability contract ────────────────────────────────────────────\nexport {\n createObservabilityClient,\n type ClassInspection,\n type ClassProperty,\n type ClassUsageLocation,\n type BuildTrace,\n type BuildPhaseTrace,\n type DashboardMetrics,\n type DashboardSummary,\n type ObservabilityClient,\n} from \"./observability\"\n\nexport {\n TW_STATE_STATIC_FILENAME,\n extractStaticStateCss,\n appendStaticStateCssToSafelist,\n type TwStateConfigEntry,\n type StaticStateCssInput,\n type GeneratedStateRule,\n type StaticStateExtractionResult,\n} from \"./staticStateExtractor\"\nexport { setGlobalLogFile } from \"./logger\"","export * from \"@tailwind-styled/rspack\"\n","/**\n * tailwind-styled-v4 - Rspack Plugin v5 (stable)\n *\n * Usage:\n * import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\n *\n * export default defineConfig({\n * plugins: [tailwindStyledRspackPlugin()],\n * })\n *\n * v5:\n * - Simplified API\n * - Mode always zero-runtime\n */\n\nimport fs from \"node:fs\"\nimport path from \"node:path\"\nimport { getDirname as getEsmDirname } from \"@tailwind-styled/shared\"\n\nimport { parseRspackPluginOptions } from \"./schemas\"\n\nfunction getDirname(): string {\n if (typeof __dirname !== \"undefined\") {\n return __dirname\n }\n if (typeof import.meta !== \"undefined\" && import.meta.url) {\n return getEsmDirname(import.meta.url)\n }\n return process.cwd()\n}\n\nfunction resolveLoaderPath(basename: string): string {\n const runtimeDir = getDirname()\n const preferredExtensions =\n typeof __dirname !== \"undefined\" && __dirname.length > 0 ? [\".cjs\", \".js\"] : [\".js\", \".cjs\"]\n\n for (const ext of preferredExtensions) {\n const candidate = path.resolve(runtimeDir, `${basename}${ext}`)\n if (fs.existsSync(candidate)) return candidate\n }\n\n return path.resolve(runtimeDir, `${basename}.js`)\n}\n\ninterface RspackRule {\n _tailwindStyledRspackMarker?: boolean\n test?: RegExp\n exclude?: RegExp\n use?: Array<{\n loader: string\n options: {\n mode: \"zero-runtime\"\n addDataAttr: boolean\n preserveImports: boolean\n safelistPath?: string\n }\n }>\n}\n\ninterface RspackCompiler {\n options: {\n mode?: string\n module?: {\n rules?: RspackRule[]\n }\n }\n}\n\nexport interface RspackPluginOptions {\n /** File patterns to include. Default: /\\.[jt]sx?$/ */\n include?: RegExp\n /** File patterns to exclude. Default: /node_modules/ */\n exclude?: RegExp\n /** Add data-tw debug attributes in dev. Default: true in dev */\n addDataAttr?: boolean\n /** Enable analyzer. Default: false */\n analyze?: boolean\n /**\n * Path ke safelist CSS file.\n * `_tw-state-static.css` ditulis di direktori yang sama.\n * Default: `<cwd>/__tw_safelist.css`\n */\n safelistPath?: string\n}\n\nexport class TailwindStyledRspackPlugin {\n private opts: RspackPluginOptions\n\n constructor(opts: RspackPluginOptions = {}) {\n this.opts = parseRspackPluginOptions(opts)\n }\n\n apply(compiler: RspackCompiler): void {\n const isDev = compiler.options.mode !== \"production\"\n const loaderPath = resolveLoaderPath(\"loader\")\n const existing = compiler.options.module?.rules ?? []\n const alreadyRegistered = existing.some(\n (rule) =>\n typeof rule === \"object\" && rule !== null && rule._tailwindStyledRspackMarker === true\n )\n\n if (alreadyRegistered) return\n\n const safelistPath =\n this.opts.safelistPath ?? path.join(process.cwd(), \"__tw_safelist.css\")\n\n // Tulis placeholder agar @import di CSS entry tidak error saat cold start\n const stateStaticPath = path.join(path.dirname(safelistPath), \"_tw-state-static.css\")\n if (!fs.existsSync(stateStaticPath)) {\n try {\n fs.mkdirSync(path.dirname(stateStaticPath), { recursive: true })\n fs.writeFileSync(\n stateStaticPath,\n `/* _tw-state-static.css — Auto-generated by tailwind-styled-v4. DO NOT EDIT.\\n` +\n ` * Import di CSS entry: @import \"./_tw-state-static.css\";\\n` +\n ` */\\n`,\n \"utf-8\"\n )\n } catch { /* non-fatal */ }\n }\n\n const rule: RspackRule = {\n _tailwindStyledRspackMarker: true,\n test: this.opts.include ?? /\\.[jt]sx?$/,\n exclude: this.opts.exclude ?? /node_modules/,\n use: [\n {\n loader: loaderPath,\n options: {\n mode: \"zero-runtime\",\n addDataAttr: this.opts.addDataAttr ?? isDev,\n preserveImports: true,\n safelistPath,\n },\n },\n ],\n }\n\n compiler.options.module = {\n ...(compiler.options.module ?? {}),\n rules: [rule, ...existing],\n }\n }\n}\n\nexport function tailwindStyledRspackPlugin(\n opts: RspackPluginOptions = {}\n): TailwindStyledRspackPlugin {\n return new TailwindStyledRspackPlugin(opts)\n}\n\nexport default tailwindStyledRspackPlugin\n\nexport {\n parseRspackPluginOptions,\n type RspackPluginOptionsInput,\n RspackPluginOptionsSchema,\n} from \"./schemas\"\n","import { z } from \"zod\"\nimport { TwError } from \"@tailwind-styled/shared\"\n\nconst formatIssuePath = (path: readonly PropertyKey[]): string =>\n path.length > 0\n ? path\n .map((segment) =>\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\n )\n .join(\".\")\n : \"<root>\"\n\nconst formatIssues = (error: z.ZodError): string =>\n error.issues\n .map((issue) => {\n const p = formatIssuePath(issue.path)\n return `${p}: ${issue.message}`\n })\n .join(\"; \")\n\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\n const parsed = schema.safeParse(data)\n if (parsed.success) return parsed.data\n const details = formatIssues(parsed.error)\n throw new TwError(\n \"validation\",\n \"SCHEMA_VALIDATION_FAILED\",\n details ? `${label}: ${details}` : label,\n parsed.error\n )\n}\n\nexport const RspackPluginOptionsSchema = z.object({\n include: z.instanceof(RegExp).optional(),\n exclude: z.instanceof(RegExp).optional(),\n addDataAttr: z.boolean().optional(),\n analyze: z.boolean().optional(),\n cssEntry: z.string().optional(),\n /** Path ke safelist CSS file. Default: <cwd>/__tw_safelist.css */\n safelistPath: z.string().optional(),\n})\n\nexport type RspackPluginOptionsInput = z.infer<typeof RspackPluginOptionsSchema>\n\nexport const parseRspackPluginOptions = (options: unknown) =>\n parseWithSchema(RspackPluginOptionsSchema, options ?? {}, \"rspack plugin options are invalid\")\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,SAAS,mBAAwD;AAC/D,MAAI,UAAW,QAAO;AACtB,MAAI,kBAAkB,KAAM,QAAO;AACnC,MAAI;AACF,UAAM,OAAO,OAAO,YAAY,aAAc,QAAQ,QAAa,IAAqC;AACxG,oBAAgB;AAChB,WAAO;AAAA,EACT,QAAQ;AACN,oBAAgB;AAChB,WAAO;AAAA,EACT;AACF;AAaA,SAAS,oBAA4B;AAGnC,MAAI,iBAAiB;AACnB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,aAAa;AACrC,WAAO,UAAU,WAAW,QAAQ,OAAO,GAAG,CAAC;AAAA,EACjD;AACA,SAAO;AACT;AAEA,SAAS,cAA0C;AACjD,MAAI,UAAW,OAAM,IAAI,MAAM,oCAAoC;AACnE,MAAI,CAAC,WA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D;AAC5B,SAAO,IAAI,2BAA2B,IAAI;AAC5C;","names":["path","import_node_fs","import_node_path","formatIssuePath","path","getDirname","path","fs","rule"]}
1
+ {"version":3,"sources":["../packages/domain/shared/src/index.ts","../src/umbrella/rspack.ts","../packages/presentation/rspack/src/index.ts","../packages/presentation/rspack/src/schemas.ts"],"sourcesContent":["import { createHash } from \"node:crypto\"\nimport fs from \"node:fs\"\nimport path from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\nimport { createRequire } from \"node:module\"\n\n// Native-only: Node.js is always available. No browser fallback.\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Types\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type TokenMap = Record<string, string>\n\nexport type VariantValue = string | number | boolean | undefined\n\nexport type VariantProps = Record<string, VariantValue>\n\nexport type HtmlTagName = keyof HTMLElementTagNameMap\n\nexport type CompoundCondition = Record<string, string | number | boolean>\n\nexport type VariantMatrix = Record<string, Array<string | number | boolean>>\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Logging\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface Logger {\n warn(...args: unknown[]): void\n debug(...args: unknown[]): void\n error(...args: unknown[]): void\n log(...args: unknown[]): void\n}\n\nexport function createLogger(namespace: string): Logger {\n const prefix = `[${namespace}]`\n return {\n warn(...args: unknown[]) {\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n },\n debug(...args: unknown[]) {\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n },\n error(...args: unknown[]) {\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n },\n log(...args: unknown[]) {\n process.stderr.write(`${prefix} ${args.map(a => typeof a === \"string\" ? a : String(a)).join(\" \")}\\n`)\n },\n }\n}\n\nexport function createDebugLogger(namespace: string, label?: string): (msg: string) => void {\n const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`\n return (msg: string) => {\n if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {\n console.debug(prefix, msg)\n }\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error handling\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type ErrorSource = \"rust\" | \"validation\" | \"compile\" | \"io\" | \"config\" | \"unknown\"\n\ntype ZodLikeIssue = {\n path?: readonly PropertyKey[]\n message?: string\n}\n\nfunction formatIssuePath(path?: readonly PropertyKey[]): string {\n if (!path || path.length === 0) return \"(root)\"\n return path\n .map((segment) =>\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\n )\n .join(\".\")\n}\n\nexport class TwError extends Error {\n /** @deprecated Gunakan source */\n public readonly domain: string\n public readonly source: ErrorSource\n public readonly code: string\n public readonly originalCause?: unknown\n\n constructor(domainOrSource: string, code: string, message: string, cause?: unknown) {\n super(message)\n this.name = \"TwError\"\n this.domain = domainOrSource\n this.source = domainOrSource as ErrorSource\n this.code = code\n this.originalCause = cause\n if (Error.captureStackTrace) Error.captureStackTrace(this, TwError)\n }\n\n static fromIo(code: string, message: string): TwError {\n return new TwError(\"io\", code, message)\n }\n\n static fromCompile(code: string, message: string): TwError {\n return new TwError(\"compile\", code, message)\n }\n\n static fromRust(err: { code?: string; message?: string } | Error | unknown): TwError {\n if (err instanceof TwError) return err\n if (err instanceof Error) return new TwError(\"rust\", \"RUST_ERROR\", err.message, err)\n if (err && typeof err === \"object\") {\n const e = err as { code?: string; message?: string }\n return new TwError(\"rust\", e.code ?? \"RUST_ERROR\", e.message ?? String(err), err)\n }\n return new TwError(\"rust\", \"RUST_ERROR\", String(err), err)\n }\n\n /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */\n static fromZod(err: { issues?: ZodLikeIssue[]; errors?: ZodLikeIssue[] }): TwError {\n const first = err.issues?.[0] ?? err.errors?.[0]\n const path = formatIssuePath(first?.path)\n const message = first ? `${path}: ${first.message}` : \"Schema validation failed\"\n return new TwError(\"validation\", \"SCHEMA_VALIDATION_FAILED\", message, err)\n }\n\n static wrap(source: string, code: string, err: unknown): TwError {\n if (err instanceof TwError) return err\n if (err instanceof Error) return new TwError(source, code, err.message, err)\n return new TwError(source, code, String(err), err)\n }\n\n override toString(): string {\n return `TwError [${this.source}:${this.code}] ${this.message}`\n }\n\n toJSON(): { name: string; source: string; code: string; message: string } {\n return { name: this.name, source: this.source, code: this.code, message: this.message }\n }\n\n toCliMessage(): string {\n return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`\n }\n}\n\nexport function wrapUnknownError(domain: string, code: string, error: unknown): TwError {\n return TwError.wrap(domain, code, error)\n}\n\nexport function isTwError(err: unknown): err is TwError {\n return err instanceof TwError\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Native binding resolution\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface LoadNativeBindingOptions<T> {\n runtimeDir: string\n candidates: string[]\n isValid: (module: unknown) => module is T\n invalidExportMessage: string\n}\n\nexport interface LoadNativeBindingResult<T> {\n binding: T | null\n loadErrors: Array<{ path: string; message: string }>\n loadedPath?: string\n}\n\nexport function loadNativeBinding<T>(options: LoadNativeBindingOptions<T>): LoadNativeBindingResult<T> {\n const { runtimeDir, candidates, isValid } = options\n const loadErrors: Array<{ path: string; message: string }> = []\n\n for (const candidate of candidates) {\n const candidatePath = path.resolve(runtimeDir, candidate)\n try {\n if (!fs.existsSync(candidatePath) && !fs.existsSync(candidatePath + \".node\")) {\n continue\n }\n const mod = requireNativeModule(candidatePath)\n if (mod && isValid(mod)) {\n return { binding: mod, loadErrors, loadedPath: candidatePath }\n }\n loadErrors.push({ path: candidatePath, message: options.invalidExportMessage })\n } catch (e) {\n loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) })\n }\n }\n\n return { binding: null, loadErrors }\n}\n\nconst _require = createRequire(\n typeof __filename !== \"undefined\"\n ? `file://${__filename}`\n : (import.meta.url ?? \"file://unknown\")\n)\n\nfunction requireNativeModule(p: string): unknown {\n return _require(p)\n}\n\nexport interface ResolveCandidatesOptions {\n runtimeDir?: string\n envVarNames?: string[]\n includeDefaultCandidates?: boolean\n enforceNodeExtensionForEnvPath?: boolean\n /** @deprecated — ignored, kept for backward compat */\n packageName?: string\n}\n\nexport function resolveNativeBindingCandidates(options: ResolveCandidatesOptions): string[] {\n const {\n envVarNames = [\"TW_NATIVE_PATH\", \"TWS_NATIVE_PATH\"],\n includeDefaultCandidates = true,\n enforceNodeExtensionForEnvPath = false,\n } = options\n // Default ke cwd kalau runtimeDir tidak disediakan\n const runtimeDir = options.runtimeDir || process.cwd()\n const candidates: string[] = []\n\n for (const envVar of envVarNames) {\n const envPath = process.env[envVar]\n if (envPath) {\n candidates.push(enforceNodeExtensionForEnvPath && !envPath.endsWith(\".node\") ? envPath + \".node\" : envPath)\n }\n }\n\n if (!includeDefaultCandidates) return candidates\n\n if (fs.existsSync(runtimeDir)) {\n try {\n for (const entry of fs.readdirSync(runtimeDir)) {\n if (entry.endsWith(\".node\")) candidates.push(entry)\n }\n } catch { /* ignore read errors */ }\n }\n\n const BINARY_NAMES = [\"tailwind-styled-native\", \"tailwind_styled_parser\"]\n const napiPlatform = process.platform === \"linux\" && process.arch === \"x64\" ? \"linux-x64-gnu\"\n : process.platform === \"linux\" && process.arch === \"arm64\" ? \"linux-arm64-gnu\"\n : `${process.platform}-${process.arch}`\n\n for (const bin of BINARY_NAMES) {\n candidates.push(path.resolve(runtimeDir, `${bin}.node`))\n candidates.push(path.resolve(runtimeDir, `${bin}.${napiPlatform}.node`))\n // 1 level: dist/ → package-root/native/ (published npm package)\n candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.node`))\n candidates.push(path.resolve(runtimeDir, \"..\", \"native\", `${bin}.${napiPlatform}.node`))\n // cwd fallback (user project root)\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.node`))\n candidates.push(path.resolve(process.cwd(), \"native\", `${bin}.${napiPlatform}.node`))\n // 4 level: dist/ → package/ → domain/ → packages/ → repo-root/ (monorepo dev)\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"..\", \"native\", `${bin}.${napiPlatform}.node`))\n // 3 level fallback\n candidates.push(path.resolve(runtimeDir, \"..\", \"..\", \"..\", \"native\", `${bin}.node`))\n }\n\n return Array.from(new Set(candidates))\n}\n\nexport function resolveRuntimeDir(dir: string | undefined, importMetaUrl: string): string {\n if (dir) return path.resolve(dir)\n try {\n return path.dirname(fileURLToPath(importMetaUrl))\n } catch {\n return process.cwd()\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Hashing\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport function hashContent(content: string, algorithm: string = \"md5\", length?: number): string {\n const hash = createHash(algorithm).update(content).digest(\"hex\")\n return length ? hash.slice(0, length) : hash\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error formatting\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport function formatErrorMessage(error: unknown): string {\n if (error instanceof TwError) return error.toString()\n if (error instanceof Error) return error.message\n return String(error)\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// LRU Cache\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport class LRUCache<K, V> {\n private capacity: number\n private cache: Map<K, V>\n\n constructor(capacity: number) {\n this.capacity = capacity\n this.cache = new Map()\n }\n\n get(key: K): V | undefined {\n if (!this.cache.has(key)) return undefined\n const value = this.cache.get(key)!\n this.cache.delete(key)\n this.cache.set(key, value)\n return value\n }\n\n set(key: K, value: V): void {\n if (this.cache.has(key)) {\n this.cache.delete(key)\n } else if (this.cache.size >= this.capacity) {\n const firstKey = this.cache.keys().next().value\n if (firstKey !== undefined) {\n this.cache.delete(firstKey)\n }\n }\n this.cache.set(key, value)\n }\n\n delete(key: K): boolean {\n return this.cache.delete(key)\n }\n\n has(key: K): boolean {\n return this.cache.has(key)\n }\n\n clear(): void {\n this.cache.clear()\n }\n\n entries(): IterableIterator<[K, V]> {\n return this.cache.entries()\n }\n\n get size(): number {\n return this.cache.size\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Trace Utilities\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { TraceSnapshot, TraceSummary } from \"./trace\"\nexport {\n getHealthColor,\n getModeColor,\n formatMemory,\n formatDuration,\n calculateHealth,\n getBuildTimeColor,\n getMemoryColor,\n createTraceSnapshot,\n getPipelinePercentages,\n} from \"./trace\"\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Performance Telemetry\n// ─────────────────────────────────────────────────────────────────────────────\n\n\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Error Codes\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { ErrorCode } from \"./error-codes\"\nexport { ERROR_CODES, getSuggestion, formatErrorCode } from \"./error-codes\"\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tailwind Compatibility\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type { TailwindInfo } from \"./compatibility\"\nexport { detectTailwind, assertTailwindV4, getTailwindVersion, isTailwindV4 } from \"./compatibility\"\n\n// ── Native binding schemas (Zod boundary validation)\nexport {\n NativeScanFileSchema, NativeScanResultSchema,\n NativeAnalyzerReportSchema, NativeTransformResultSchema,\n NativeCssCompileResultSchema, NativeWatchResultSchema,\n NativeCacheEntrySchema, NativeCacheReadResultSchema,\n safeParseNative, parseNative,\n} from './native-schemas'\n\n// ── ESM-safe runtime helpers ──────────────────────────────────────────────\nexport {\n createEsmRequire,\n getDirname,\n getFilename,\n resolveFromRoot,\n tryRequire,\n resolveNativeNodePath,\n} from \"./esmHelpers\"\n\n// ── Performance telemetry ────────────────────────────────────────────────────\nexport {\n TelemetryCollector,\n getGlobalTelemetry,\n resetGlobalTelemetry,\n createBuildTimer,\n type BuildTelemetry,\n type TelemetrySummary,\n type BuildPhases,\n} from \"./telemetry\"\n\n// ── Config/JSON schema validation ─────────────────────────────────────────────\nexport {\n ScanCacheSchema,\n ScanCacheClassEntrySchema,\n TailwindConfigSchema,\n RegistryPluginEntrySchema,\n RegistryFileSchema,\n PackageJsonSchema,\n parseJsonWithSchema,\n parseJsonFileWithSchema,\n type ScanCache,\n type ScanCacheClassEntry,\n type TailwindConfig,\n type RegistryPluginEntry,\n type RegistryFile,\n type PackageJson,\n} from \"./configSchemas\"\n\n// ── Worker/bootstrap path resolution ─────────────────────────────────────────\nexport {\n resolveWorkerPath,\n resolveLoaderPath,\n type WorkerPathOptions,\n type WorkerPathResult,\n} from \"./workerResolver\"\n\n// ── Codegen helpers ───────────────────────────────────────────────────────────\nexport {\n generateComponentCode,\n generateStorybookStory,\n generateClassRenameCodemod,\n generateBarrelFile,\n type ComponentCodegenOptions,\n} from \"./codegen\"\n\n// ── Native binary resolution (QA #1) ─────────────────────────────────────────\nexport {\n resolveNativeBinary,\n formatNativeNotFoundError,\n type NativeResolutionResult,\n} from \"./native-resolution\"\n\n// ── Shared observability contract ────────────────────────────────────────────\nexport {\n createObservabilityClient,\n type ClassInspection,\n type ClassProperty,\n type ClassUsageLocation,\n type BuildTrace,\n type BuildPhaseTrace,\n type DashboardMetrics,\n type DashboardSummary,\n type ObservabilityClient,\n} from \"./observability\"\n\nexport {\n TW_STATE_STATIC_FILENAME,\n extractStaticStateCss,\n appendStaticStateCssToSafelist,\n type TwStateConfigEntry,\n type StaticStateCssInput,\n type GeneratedStateRule,\n type StaticStateExtractionResult,\n} from \"./staticStateExtractor\"\nexport { setGlobalLogFile } from \"./logger\"","export * from \"@tailwind-styled/rspack\"\n","/**\n * tailwind-styled-v4 - Rspack Plugin v5 (stable)\n *\n * Usage:\n * import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\n *\n * export default defineConfig({\n * plugins: [tailwindStyledRspackPlugin()],\n * })\n *\n * v5:\n * - Simplified API\n * - Mode always zero-runtime\n */\n\nimport fs from \"node:fs\"\nimport path from \"node:path\"\nimport { getDirname as getEsmDirname } from \"@tailwind-styled/shared\"\n\nimport { parseRspackPluginOptions } from \"./schemas\"\n\nfunction getDirname(): string {\n if (typeof __dirname !== \"undefined\") {\n return __dirname\n }\n if (typeof import.meta !== \"undefined\" && import.meta.url) {\n return getEsmDirname(import.meta.url)\n }\n return process.cwd()\n}\n\nfunction resolveLoaderPath(basename: string): string {\n const runtimeDir = getDirname()\n const preferredExtensions =\n typeof __dirname !== \"undefined\" && __dirname.length > 0 ? [\".cjs\", \".js\"] : [\".js\", \".cjs\"]\n\n for (const ext of preferredExtensions) {\n const candidate = path.resolve(runtimeDir, `${basename}${ext}`)\n if (fs.existsSync(candidate)) return candidate\n }\n\n return path.resolve(runtimeDir, `${basename}.js`)\n}\n\ninterface RspackRule {\n _tailwindStyledRspackMarker?: boolean\n test?: RegExp\n exclude?: RegExp\n use?: Array<{\n loader: string\n options: {\n mode: \"zero-runtime\"\n addDataAttr: boolean\n preserveImports: boolean\n safelistPath?: string\n }\n }>\n}\n\ninterface RspackCompiler {\n options: {\n mode?: string\n module?: {\n rules?: RspackRule[]\n }\n }\n}\n\nexport interface RspackPluginOptions {\n /** File patterns to include. Default: /\\.[jt]sx?$/ */\n include?: RegExp\n /** File patterns to exclude. Default: /node_modules/ */\n exclude?: RegExp\n /** Add data-tw debug attributes in dev. Default: true in dev */\n addDataAttr?: boolean\n /** Enable analyzer. Default: false */\n analyze?: boolean\n /**\n * Path ke safelist CSS file.\n * `_tw-state-static.css` ditulis di direktori yang sama.\n * Default: `<cwd>/__tw_safelist.css`\n */\n safelistPath?: string\n}\n\nexport class TailwindStyledRspackPlugin {\n private opts: RspackPluginOptions\n\n constructor(opts: RspackPluginOptions = {}) {\n this.opts = parseRspackPluginOptions(opts)\n }\n\n apply(compiler: RspackCompiler): void {\n const isDev = compiler.options.mode !== \"production\"\n const loaderPath = resolveLoaderPath(\"loader\")\n const existing = compiler.options.module?.rules ?? []\n const alreadyRegistered = existing.some(\n (rule) =>\n typeof rule === \"object\" && rule !== null && rule._tailwindStyledRspackMarker === true\n )\n\n if (alreadyRegistered) return\n\n const safelistPath =\n this.opts.safelistPath ?? path.join(process.cwd(), \"__tw_safelist.css\")\n\n // Tulis placeholder agar @import di CSS entry tidak error saat cold start\n const stateStaticPath = path.join(path.dirname(safelistPath), \"_tw-state-static.css\")\n if (!fs.existsSync(stateStaticPath)) {\n try {\n fs.mkdirSync(path.dirname(stateStaticPath), { recursive: true })\n fs.writeFileSync(\n stateStaticPath,\n `/* _tw-state-static.css — Auto-generated by tailwind-styled-v4. DO NOT EDIT.\\n` +\n ` * Import di CSS entry: @import \"./_tw-state-static.css\";\\n` +\n ` */\\n`,\n \"utf-8\"\n )\n } catch { /* non-fatal */ }\n }\n\n const rule: RspackRule = {\n _tailwindStyledRspackMarker: true,\n test: this.opts.include ?? /\\.[jt]sx?$/,\n exclude: this.opts.exclude ?? /node_modules/,\n use: [\n {\n loader: loaderPath,\n options: {\n mode: \"zero-runtime\",\n addDataAttr: this.opts.addDataAttr ?? isDev,\n preserveImports: true,\n safelistPath,\n },\n },\n ],\n }\n\n compiler.options.module = {\n ...(compiler.options.module ?? {}),\n rules: [rule, ...existing],\n }\n }\n}\n\nexport function tailwindStyledRspackPlugin(\n opts: RspackPluginOptions = {}\n): TailwindStyledRspackPlugin {\n return new TailwindStyledRspackPlugin(opts)\n}\n\nexport default tailwindStyledRspackPlugin\n\nexport {\n parseRspackPluginOptions,\n type RspackPluginOptionsInput,\n RspackPluginOptionsSchema,\n} from \"./schemas\"\n","import { z } from \"zod\"\nimport { TwError } from \"@tailwind-styled/shared\"\n\nconst formatIssuePath = (path: readonly PropertyKey[]): string =>\n path.length > 0\n ? path\n .map((segment) =>\n typeof segment === \"symbol\" ? segment.description ?? segment.toString() : String(segment)\n )\n .join(\".\")\n : \"<root>\"\n\nconst formatIssues = (error: z.ZodError): string =>\n error.issues\n .map((issue) => {\n const p = formatIssuePath(issue.path)\n return `${p}: ${issue.message}`\n })\n .join(\"; \")\n\nconst parseWithSchema = <T>(schema: z.ZodType<T>, data: unknown, label: string): T => {\n const parsed = schema.safeParse(data)\n if (parsed.success) return parsed.data\n const details = formatIssues(parsed.error)\n throw new TwError(\n \"validation\",\n \"SCHEMA_VALIDATION_FAILED\",\n details ? `${label}: ${details}` : label,\n parsed.error\n )\n}\n\nexport const RspackPluginOptionsSchema = z.object({\n include: z.instanceof(RegExp).optional(),\n exclude: z.instanceof(RegExp).optional(),\n addDataAttr: z.boolean().optional(),\n analyze: z.boolean().optional(),\n cssEntry: z.string().optional(),\n /** Path ke safelist CSS file. Default: <cwd>/__tw_safelist.css */\n safelistPath: z.string().optional(),\n})\n\nexport type RspackPluginOptionsInput = z.infer<typeof RspackPluginOptionsSchema>\n\nexport const parseRspackPluginOptions = (options: unknown) =>\n parseWithSchema(RspackPluginOptionsSchema, options ?? {}, \"rspack plugin options are invalid\")\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,SAAS,gBAAgBA,OAAuC;AAC9D,MAAI,CAACA,SAAQA,MAAK,WAAW,EAAG,QAAO;AACvC,SAAOA,MACJ;AAAA,IAAI,CAAC,YACJ,OAAO,YAAY,WAAW,QAAQ,eAAe,QAAQ,SAAS,IAAI,OAAO,OAAO;AAAA,EAC1F,EACC,KAAK,GAAG;AACb;AAhFA,wBACA,gBACA,kBACA,iBACA,oBA8Ea,SA8GP;AAhMN;AAAA;AAAA;AAAA,yBAA2B;AAC3B,qBAAe;AACf,uBAAiB;AACjB,sBAA8B;AAC9B,yBAA8B;AA8EvB,IAAM,UAAN,MAAM,iBAAgB,MAAM;AAAA;AAAA,MAEjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEhB,YAAY,gBAAwB,MAAc,SAAiB,OAAiB;AAClF,cAAM,OAAO;AACb,aAAK,OAAO;AACZ,aAAK,SAAS;AACd,aAAK,SAAS;AACd,aAAK,OAAO;AACZ,aAAK,gBAAgB;AACrB,YAAI,MAAM,kBAAmB,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AmB;AAGxE,UAAM,kBAAkB,kBAAAA,QAAK,KAAK,kBAAAA,QAAK,QAAQ,YAAY,GAAG,sBAAsB;AACpF,QAAI,CAAC,gBAAAC,QAAG,WAAW,eAAe,GAAG;AACnC,UAAI;AACF,wBAAAA,QAAG,UAAU,kBAAAD,QAAK,QAAQ,eAAe,GAAG,EAAE,WAAW,KAAK,CAAC;AAC/D,wBAAAC,QAAG;AAAA,UACD;AAAA,UACA;AAAA;AAAA;AAAA;AAAA,UAGA;AAAA,QACF;AAAA,MACF,QAAQ;AAAA,MAAkB;AAAA,IAC5B;AAEA,UAAM,OAAmB;AAAA,MACvB,6BAA6B;AAAA,MAC7B,MAAM,KAAK,KAAK,WAAW;AAAA,MAC3B,SAAS,KAAK,KAAK,WAAW;AAAA,MAC9B,KAAK;AAAA,QACH;AAAA,UACE,QAAQ;AAAA,UACR,SAAS;AAAA,YACP,MAAM;AAAA,YACN,aAAa,KAAK,KAAK,eAAe;AAAA,YACtC,iBAAiB;AAAA,YACjB;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,aAAS,QAAQ,SAAS;AAAA,MACxB,GAAI,SAAS,QAAQ,UAAU,CAAC;AAAA,MAChC,OAAO,CAAC,MAAM,GAAG,QAAQ;AAAA,IAC3B;AAAA,EACF;AACF;AAEO,SAAS,2BACd,OAA4B,CAAC,GACD;AAC5B,SAAO,IAAI,2BAA2B,IAAI;AAC5C;","names":["path","import_node_fs","import_node_path","formatIssuePath","path","path","fs","rule"]}
package/dist/scanner.js CHANGED
@@ -229,8 +229,8 @@ function getDirname() {
229
229
  if (typeof __dirname !== "undefined") {
230
230
  return __dirname;
231
231
  }
232
- if (typeof import_meta !== "undefined" && __importMetaUrl) {
233
- return import_node_path2.default.dirname((0, import_node_url2.fileURLToPath)(__importMetaUrl));
232
+ if (false) {
233
+ return path2.dirname(fileURLToPath2(__importMetaUrl));
234
234
  }
235
235
  return process.cwd();
236
236
  }
@@ -435,14 +435,13 @@ function hasNativeWatchBinding() {
435
435
  return false;
436
436
  }
437
437
  }
438
- var import_node_path2, import_node_url2, import_meta, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
438
+ var import_node_path2, import_node_url2, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
439
439
  var init_native_bridge = __esm({
440
440
  "packages/domain/scanner/src/native-bridge.ts"() {
441
441
  "use strict";
442
- import_node_path2 = __toESM(require("path"), 1);
442
+ import_node_path2 = require("path");
443
443
  import_node_url2 = require("url");
444
444
  init_src();
445
- import_meta = {};
446
445
  log = createDebugLogger("scanner:native");
447
446
  isValidScannerBinding = (module2) => {
448
447
  const candidate = module2;
@@ -742,15 +741,14 @@ var parseScannerWorkerMessage = (message) => parseWithSchema(ScannerWorkerMessag
742
741
 
743
742
  // packages/domain/scanner/src/index.ts
744
743
  init_native_bridge();
745
- var import_meta2 = {};
746
744
  var log2 = createLogger("scanner");
747
745
  var SCAN_WORKER_TIMEOUT_MS = 12e4;
748
746
  function getRuntimeDir() {
749
747
  if (typeof __dirname !== "undefined" && __dirname.length > 0) {
750
748
  return __dirname;
751
749
  }
752
- if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
753
- return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
750
+ if (false) {
751
+ return import_node_path5.default.dirname(fileURLToPath4(__importMetaUrl));
754
752
  }
755
753
  return process.cwd();
756
754
  }
@@ -840,8 +838,8 @@ function resolveScannerWorkerModulePath() {
840
838
  if (typeof __dirname !== "undefined" && __dirname.length > 0) {
841
839
  return __dirname;
842
840
  }
843
- if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
844
- return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
841
+ if (false) {
842
+ return import_node_path5.default.dirname(fileURLToPath4(__importMetaUrl));
845
843
  }
846
844
  return process.cwd();
847
845
  })();