@jk2908/cxx 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,7 +70,7 @@ Because `.cxx` is generated, it is recommended to add `.cxx` to your `.gitignore
70
70
  ```ts
71
71
  import { defineConfig } from 'vite'
72
72
  import react from '@vitejs/plugin-react'
73
- import cxx from '@jk2908/cxx/vite-plugin-cxx'
73
+ import cxx from '@jk2908/cxx/vite'
74
74
 
75
75
  export default defineConfig({
76
76
  plugins: [react(), cxx({ typeSuffix: 'Classes' })],
@@ -84,28 +84,22 @@ The transform always emits minified CSS and CSS Modules class mappings.
84
84
  ## Next
85
85
 
86
86
  ```ts
87
- import path from 'node:path'
88
- import { fileURLToPath } from 'node:url'
89
-
90
87
  import { withCxx } from '@jk2908/cxx/next'
91
88
 
92
- const rootDir = path.dirname(fileURLToPath(import.meta.url))
93
- const turbopackRoot = path.resolve(rootDir, '../..')
94
-
95
89
  /** @type {import('next').NextConfig} */
96
- const nextConfig = {
97
- turbopack: {
98
- root: turbopackRoot,
99
- },
100
- }
90
+ const nextConfig = {}
101
91
 
102
92
  export default withCxx(nextConfig, { typeSuffix: 'Classes' })
103
93
  ```
104
94
 
105
- Use the Next integration when you want `cxx` transforms and generated class-key types inside a Next app. In a monorepo, set `turbopack.root` so the loader resolves the right workspace root.
95
+ Use the Next integration when you want `cxx` transforms and generated class-key types inside a Next app.
106
96
 
107
97
  See [CHANGELOG.md](./CHANGELOG.md) for release notes.
108
98
 
99
+ ## Syntax highlighting
100
+
101
+ The [`vscode-cxx`](https://github.com/jk2908/cxx/tree/main/packages/vscode-cxx) extension provides syntax highlighting for `cxx` and `cxx.tag()` tagged template literals in VS Code. See its [README](https://github.com/jk2908/cxx/tree/main/packages/vscode-cxx) for install instructions.
102
+
109
103
  ## License
110
104
 
111
105
  MIT
package/dist/index.d.ts CHANGED
@@ -37,5 +37,4 @@ export declare function flattenTags(tagsByFile: BuildContext['tagsByFile']): Map
37
37
  * Build-time template tag placeholder used by the transform to emit CSS, classes and href values
38
38
  */
39
39
  export declare const cxx: Cxx;
40
- export declare const css: Cxx;
41
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAU,IAAI,EAAE,MAAM,YAAY,CAAA;AAiB/E;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,WAEpC;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAyBjE;AAeD,qBAAa,iBAAkB,SAAQ,KAAK;gBAC/B,GAAG,EAAE,MAAM;CAGvB;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY;YAnE5B,MAAM;cAAY,MAAM;UAAQ,IAAI;;;;EA0H/E;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,iBA2B1C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,UAepC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,yBAWjE;AAED;;GAEG;AACH,eAAO,MAAM,GAAG,EAAE,GAQhB,CAAA;AAEF,eAAO,MAAM,GAAG,KAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAU,IAAI,EAAE,MAAM,YAAY,CAAA;AAiB/E;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,WAEpC;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAyBjE;AAeD,qBAAa,iBAAkB,SAAQ,KAAK;gBAC/B,GAAG,EAAE,MAAM;CAGvB;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY;YAnE5B,MAAM;cAAY,MAAM;UAAQ,IAAI;;;;EA0H/E;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,iBA2B1C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,UAepC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,yBAWjE;AAED;;GAEG;AACH,eAAO,MAAM,GAAG,EAAE,GAQhB,CAAA"}
package/dist/index.js CHANGED
@@ -181,7 +181,6 @@ var cxx = Object.assign((_) => ["", {}, ""], {
181
181
  ""
182
182
  ]
183
183
  });
184
- var css = cxx;
185
184
  export {
186
185
  writeTypes,
187
186
  tagsToType,
@@ -189,9 +188,8 @@ export {
189
188
  isENOENT,
190
189
  flattenTags,
191
190
  cxx,
192
- css,
193
191
  collect,
194
192
  TagDuplicateError
195
193
  };
196
194
 
197
- //# debugId=6D86A21ED341F54864756E2164756E21
195
+ //# debugId=D5DA13CCB4684E3C64756E2164756E21
package/dist/index.js.map CHANGED
@@ -2,12 +2,12 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/config.ts", "../src/lru.ts", "../src/utils.ts"],
4
4
  "sourcesContent": [
5
- "import { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\n\nimport type { BuildContext, Cxx, PluginConfig, Result, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\n/**\n * LRU cache of `collect` results by file id and last seen source so watcher and transform can\n * reuse the same parsed template/tags\n */\nconst collectCache = new LruCache<{ source: string; template: string; tags: Tags }>()\n\n/**\n * LRU cache for file content. Stores the last written content per file path so `maybeWrite`\n * can skip disk i/o when nothing has changed\n */\nconst fileCache = new LruCache<string>()\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = fileCache.get(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tfileCache.set(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tfileCache.set(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tfileCache.set(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1-3 assigned variable names, 4 plain css body, 5 quote\n// kind, 6 tag name, 7 tagged css body\nconst regex =\n\t/(?:const|var|let)\\s*\\[(\\w+|)\\s*,?\\s*(\\w+|)\\s*,?\\s*(\\w+|)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\5\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\n/**\n * Hash transformed CSS into a stable href for style deduplication\n */\nfunction hashCss(code: Uint8Array) {\n\treturn `cxx-${createHash('sha256').update(code).digest('base64url').slice(0, 12)}`\n}\n\nexport class TagDuplicateError extends Error {\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\n/**\n * Transform `cxx` templates in one source file and collect any exported tag types\n */\nexport function collect(source: string, id: string, config: PluginConfig) {\n\tconst tags: Tags = new Map()\n\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source) return cached\n\n\tconst template = source.replace(\n\t\tregex,\n\t\t(_match, varOne, varTwo, varThree, plainCss, _quote, tag, taggedCss) => {\n\t\t\tconst css = plainCss ?? taggedCss\n\n\t\t\tconst { code, exports = {} } = transform({\n\t\t\t\tminify: true,\n\t\t\t\tcssModules: true,\n\t\t\t\tfilename: id,\n\t\t\t\tcode: new TextEncoder().encode(css),\n\t\t\t})\n\n\t\t\tconst href = hashCss(code)\n\t\t\tconst styles = Object.fromEntries(\n\t\t\t\tObject.entries(exports).map(([k, v]) => [k, v.name]),\n\t\t\t)\n\n\t\t\tif (tag) {\n\t\t\t\tconst suffix =\n\t\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t: 'Classes'\n\t\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\t\tif (tags.has(tagWithSuffix)) throw new TagDuplicateError(tagWithSuffix)\n\n\t\t\t\t// side effect but neccessary\n\t\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tvarOne && `const ${varOne} = \\`${code}\\``,\n\t\t\t\tvarTwo && `const ${varTwo} = ${JSON.stringify(styles)}`,\n\t\t\t\tvarThree && `const ${varThree} = \\`${href}\\``,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join('\\n')\n\t\t},\n\t)\n\n\t// cache\n\tcollectCache.set(id, { source, template, tags })\n\n\treturn {\n\t\ttemplate,\n\t\ttags,\n\t}\n}\n\n/**\n * Write the generated declaration file for the current set of collected tags\n */\nexport async function writeTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\ttry {\n\t\t\tawait fs.rm(filePath, { force: true })\n\t\t\tfileCache.delete(filePath)\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t}\n\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\n\tawait maybeWrite(\n\t\tfilePath,\n\t\t`${AUTOGEN_MSG}\n\n\t\t\timport '${PKG_NAME}'\n\n\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t${tagsToType(tags)}\n\t\t\t}\n\t\t`,\n\t)\n}\n\n/**\n * Render collected tags as a module augmentation for the package entrypoint\n */\nexport function tagsToType(tags: Tags) {\n\treturn [...tags]\n\t\t.map(\n\t\t\t([tag, classes]) => `\n\t\texport type ${tag} = ${\n\t\t\tclasses.length > 0\n\t\t\t\t? classes\n\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t.join(' | ')\n\t\t\t\t: 'never'\n\t\t}\n\t`,\n\t\t)\n\t\t.join('\\n')\n}\n\n/**\n * Merge per-file tag maps into one application-wide tag map\n */\nexport function flattenTags(tagsByFile: BuildContext['tagsByFile']) {\n\tconst tags = new Map<string, string[]>()\n\n\tfor (const fileTags of tagsByFile.values()) {\n\t\tfor (const [name, classes] of fileTags) {\n\t\t\tif (tags.has(name)) throw new TagDuplicateError(name)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn tags\n}\n\n/**\n * Build-time template tag placeholder used by the transform to emit CSS, classes and href values\n */\nexport const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['', {}, ''], {\n\ttag:\n\t\t<ClassName extends string = string>(_: string) =>\n\t\t(_strings: TemplateStringsArray): Result<ClassName> => [\n\t\t\t'',\n\t\t\t{} as Readonly<Record<ClassName, string>>,\n\t\t\t'',\n\t\t],\n})\n\nexport const css = cxx\n",
5
+ "import { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\n\nimport type { BuildContext, Cxx, PluginConfig, Result, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\n/**\n * LRU cache of `collect` results by file id and last seen source so watcher and transform can\n * reuse the same parsed template/tags\n */\nconst collectCache = new LruCache<{ source: string; template: string; tags: Tags }>()\n\n/**\n * LRU cache for file content. Stores the last written content per file path so `maybeWrite`\n * can skip disk i/o when nothing has changed\n */\nconst fileCache = new LruCache<string>()\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = fileCache.get(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tfileCache.set(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tfileCache.set(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tfileCache.set(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1-3 assigned variable names, 4 plain css body, 5 quote\n// kind, 6 tag name, 7 tagged css body\nconst regex =\n\t/(?:const|var|let)\\s*\\[(\\w+|)\\s*,?\\s*(\\w+|)\\s*,?\\s*(\\w+|)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\5\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\n/**\n * Hash transformed CSS into a stable href for style deduplication\n */\nfunction hashCss(code: Uint8Array) {\n\treturn `cxx-${createHash('sha256').update(code).digest('base64url').slice(0, 12)}`\n}\n\nexport class TagDuplicateError extends Error {\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\n/**\n * Transform `cxx` templates in one source file and collect any exported tag types\n */\nexport function collect(source: string, id: string, config: PluginConfig) {\n\tconst tags: Tags = new Map()\n\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source) return cached\n\n\tconst template = source.replace(\n\t\tregex,\n\t\t(_match, varOne, varTwo, varThree, plainCss, _quote, tag, taggedCss) => {\n\t\t\tconst css = plainCss ?? taggedCss\n\n\t\t\tconst { code, exports = {} } = transform({\n\t\t\t\tminify: true,\n\t\t\t\tcssModules: true,\n\t\t\t\tfilename: id,\n\t\t\t\tcode: new TextEncoder().encode(css),\n\t\t\t})\n\n\t\t\tconst href = hashCss(code)\n\t\t\tconst styles = Object.fromEntries(\n\t\t\t\tObject.entries(exports).map(([k, v]) => [k, v.name]),\n\t\t\t)\n\n\t\t\tif (tag) {\n\t\t\t\tconst suffix =\n\t\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t: 'Classes'\n\t\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\t\tif (tags.has(tagWithSuffix)) throw new TagDuplicateError(tagWithSuffix)\n\n\t\t\t\t// side effect but neccessary\n\t\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tvarOne && `const ${varOne} = \\`${code}\\``,\n\t\t\t\tvarTwo && `const ${varTwo} = ${JSON.stringify(styles)}`,\n\t\t\t\tvarThree && `const ${varThree} = \\`${href}\\``,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join('\\n')\n\t\t},\n\t)\n\n\t// cache\n\tcollectCache.set(id, { source, template, tags })\n\n\treturn {\n\t\ttemplate,\n\t\ttags,\n\t}\n}\n\n/**\n * Write the generated declaration file for the current set of collected tags\n */\nexport async function writeTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\ttry {\n\t\t\tawait fs.rm(filePath, { force: true })\n\t\t\tfileCache.delete(filePath)\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t}\n\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\n\tawait maybeWrite(\n\t\tfilePath,\n\t\t`${AUTOGEN_MSG}\n\n\t\t\timport '${PKG_NAME}'\n\n\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t${tagsToType(tags)}\n\t\t\t}\n\t\t`,\n\t)\n}\n\n/**\n * Render collected tags as a module augmentation for the package entrypoint\n */\nexport function tagsToType(tags: Tags) {\n\treturn [...tags]\n\t\t.map(\n\t\t\t([tag, classes]) => `\n\t\texport type ${tag} = ${\n\t\t\tclasses.length > 0\n\t\t\t\t? classes\n\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t.join(' | ')\n\t\t\t\t: 'never'\n\t\t}\n\t`,\n\t\t)\n\t\t.join('\\n')\n}\n\n/**\n * Merge per-file tag maps into one application-wide tag map\n */\nexport function flattenTags(tagsByFile: BuildContext['tagsByFile']) {\n\tconst tags = new Map<string, string[]>()\n\n\tfor (const fileTags of tagsByFile.values()) {\n\t\tfor (const [name, classes] of fileTags) {\n\t\t\tif (tags.has(name)) throw new TagDuplicateError(name)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn tags\n}\n\n/**\n * Build-time template tag placeholder used by the transform to emit CSS, classes and href values\n */\nexport const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['', {}, ''], {\n\ttag:\n\t\t<ClassName extends string = string>(_: string) =>\n\t\t(_strings: TemplateStringsArray): Result<ClassName> => [\n\t\t\t'',\n\t\t\t{} as Readonly<Record<ClassName, string>>,\n\t\t\t'',\n\t\t],\n})\n",
6
6
  "export const NAME = 'cxx'\nexport const PKG_NAME = `@jk2908/${NAME}`\nexport const GENERATED_DIR = `.${NAME}`\nexport const AUTOGEN_MSG = `// auto-generated by ${NAME}`\n",
7
7
  "export const CACHE_MAX_SIZE = 100\n\nexport class LruCache<T> {\n\t#cache: Map<string, T> = new Map()\n\t#maxSize: number\n\n\tconstructor(maxSize = CACHE_MAX_SIZE) {\n\t\tthis.#maxSize = maxSize\n\t}\n\n\tget size() {\n\t\treturn this.#cache.size\n\t}\n\n\t/**\n\t * Retrieve a cached value and promote it to most-recently-used so it won't\n\t * be evicted while still actively referenced\n\t */\n\tget(key: string) {\n\t\tconst cached = this.#cache.get(key)\n\t\tif (this.#cache.has(key)) this.set(key, cached as T)\n\n\t\treturn cached\n\t}\n\n\t/**\n\t * Promote an existing cache entry to most-recently-used by deleting and\n\t * re-inserting it, which moves it to the end of the Map's iteration\n\t * order. If the cache is at capacity, evict the least recently used\n\t * entry (front) before inserting\n\t */\n\tset(key: string, value: T) {\n\t\t// drop any existing entry\n\t\tthis.#cache.delete(key)\n\n\t\tif (this.#cache.size >= this.#maxSize) {\n\t\t\tconst lru = this.#cache.keys().next().value\n\t\t\tif (lru !== undefined) this.#cache.delete(lru)\n\t\t}\n\n\t\tthis.#cache.set(key, value)\n\t}\n\n\tdelete(key: string) {\n\t\treturn this.#cache.delete(key)\n\t}\n\n\tclear() {\n\t\treturn this.#cache.clear()\n\t}\n}\n",
8
8
  "export function capitalise(str: string) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport function pascalise(str: string) {\n\treturn str\n\t\t.split(/[ _-]+/)\n\t\t.map(capitalise)\n\t\t.join('')\n}\n\nexport function debounce<T extends unknown[]>(fn: (...args: T) => void, wait: number) {\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\treturn (...args: T) => {\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\n\t\ttimeoutId = setTimeout(() => {\n\t\t\tfn.apply(null, args)\n\t\t}, wait)\n\t}\n}\n"
9
9
  ],
10
- "mappings": ";AAAA;AACA;AACA;AAEA;;;ACJO,IAAM,OAAO;AACb,IAAM,WAAW,WAAW;AAC5B,IAAM,gBAAgB,IAAI;AAC1B,IAAM,cAAc,wBAAwB;;;ACH5C,IAAM,iBAAiB;AAAA;AAEvB,MAAM,SAAY;AAAA,EACxB,SAAyB,IAAI;AAAA,EAC7B;AAAA,EAEA,WAAW,CAAC,UAAU,gBAAgB;AAAA,IACrC,KAAK,WAAW;AAAA;AAAA,MAGb,IAAI,GAAG;AAAA,IACV,OAAO,KAAK,OAAO;AAAA;AAAA,EAOpB,GAAG,CAAC,KAAa;AAAA,IAChB,MAAM,SAAS,KAAK,OAAO,IAAI,GAAG;AAAA,IAClC,IAAI,KAAK,OAAO,IAAI,GAAG;AAAA,MAAG,KAAK,IAAI,KAAK,MAAW;AAAA,IAEnD,OAAO;AAAA;AAAA,EASR,GAAG,CAAC,KAAa,OAAU;AAAA,IAE1B,KAAK,OAAO,OAAO,GAAG;AAAA,IAEtB,IAAI,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,MACtC,MAAM,MAAM,KAAK,OAAO,KAAK,EAAE,KAAK,EAAE;AAAA,MACtC,IAAI,QAAQ;AAAA,QAAW,KAAK,OAAO,OAAO,GAAG;AAAA,IAC9C;AAAA,IAEA,KAAK,OAAO,IAAI,KAAK,KAAK;AAAA;AAAA,EAG3B,MAAM,CAAC,KAAa;AAAA,IACnB,OAAO,KAAK,OAAO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AAO,GAAG;AAAA,IAC3C,YAAY,MAAM,YAAY,UAAU;AAAA,MACvC,IAAI,KAAK,IAAI,IAAI;AAAA,QAAG,MAAM,IAAI,kBAAkB,IAAI;AAAA,MACpD,KAAK,IAAI,MAAM,OAAO;AAAA,IACvB;AAAA,EACD;AAAA,EAEA,OAAO;AAAA;AAMD,IAAM,MAAW,OAAO,OAAO,CAAC,MAAoC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;AAAA,EACxF,KACC,CAAoC,MACpC,CAAC,aAAsD;AAAA,IACtD;AAAA,IACA,CAAC;AAAA,IACD;AAAA,EACD;AACF,CAAC;",
11
+ "debugId": "D5DA13CCB4684E3C64756E2164756E21",
12
12
  "names": []
13
13
  }
@@ -3,8 +3,8 @@
3
3
  "sources": ["../../src/logger.ts", "../../src/next/index.ts", "../../src/index.ts", "../../src/config.ts", "../../src/lru.ts", "../../src/utils.ts", "../../src/next/cxx-loader.js"],
4
4
  "sourcesContent": [
5
5
  "const LEVELS = {\n\tdebug: 0,\n\tinfo: 1,\n\twarn: 2,\n\terror: 3,\n\tfatal: 4,\n} as const\n\nexport type LogLevel = keyof typeof LEVELS\n\ntype LogEntry = {\n\tts: number\n\tlevel: LogLevel\n\tmessage: string\n\terror?:\n\t\t| Error\n\t\t| {\n\t\t\t\tmessage: string\n\t\t\t\tstack?: string\n\t\t\t\tcause?: unknown\n\t\t }\n}\n\n/**\n * Log messages with different severity levels\n */\nexport class Logger {\n\tstatic #defaultLevel: LogLevel = 'info'\n\n\t#level?: LogLevel\n\n\tconstructor(\n\t\tlevel?: LogLevel,\n\t\tpublic name?: string,\n\t) {\n\t\tthis.#level = level\n\t}\n\n\tstatic set defaultLevel(level: LogLevel) {\n\t\tLogger.#defaultLevel = level\n\t}\n\n\tstatic get defaultLevel() {\n\t\treturn Logger.#defaultLevel\n\t}\n\n\t/**\n\t * Convert a value to an Error instance\n\t */\n\tstatic toError(err: unknown) {\n\t\treturn err instanceof Error ? err : new Error(String(err), { cause: err })\n\t}\n\n\t/**\n\t * Stringify the error for logging\n\t */\n\tstatic print(err: unknown) {\n\t\tif (err instanceof Error) {\n\t\t\treturn err.message + (err.stack ? `\\n${err.stack}` : '')\n\t\t}\n\n\t\t// for plain objects, attempt to stringify with indentation\n\t\t// for readability\n\t\tif (typeof err === 'object' && err !== null) {\n\t\t\ttry {\n\t\t\t\treturn JSON.stringify(err, null, 2)\n\t\t\t} catch {\n\t\t\t\t// if stringify fails (e.g. circular reference), fall back\n\t\t\t\t// to basic string conversion\n\t\t\t\treturn String(err)\n\t\t\t}\n\t\t}\n\n\t\treturn String(err)\n\t}\n\n\tset level(level: LogLevel) {\n\t\tthis.#level = level\n\t}\n\n\tget level() {\n\t\treturn this.#level ?? Logger.#defaultLevel\n\t}\n\n\t/**\n\t * Log a message with a specific level\n\t */\n\tlog(level: LogLevel, message: string, error?: Error) {\n\t\tif (LEVELS[level] < LEVELS[this.level]) return\n\n\t\tconst entry: LogEntry = {\n\t\t\tts: Date.now(),\n\t\t\tlevel,\n\t\t\tmessage,\n\t\t}\n\n\t\tif (level === 'error' || level === 'fatal') {\n\t\t\tentry.error = error ? Logger.toError(error) : new Error(message)\n\t\t}\n\n\t\tconst line = `${this.name ? `[${this.name}]` : ''} [${entry.ts}] [${level.toUpperCase()}] ${message}`\n\t\tconst extra = entry.error ? `\\n${Logger.print(entry.error)}` : ''\n\n\t\tif (level === 'warn') {\n\t\t\tconsole.warn(line, extra)\n\t\t\treturn\n\t\t}\n\n\t\tif (level === 'error' || level === 'fatal') {\n\t\t\tconsole.error(line, extra)\n\t\t\treturn\n\t\t}\n\n\t\tconsole.log(line, extra)\n\t}\n\n\t/**\n\t * Log a debug message\n\t */\n\tdebug(...messages: string[]) {\n\t\tthis.log('debug', messages.join(' '))\n\t}\n\n\t/**\n\t * Log an info message\n\t */\n\tinfo(...messages: string[]) {\n\t\tthis.log('info', messages.join(' '))\n\t}\n\n\t/**\n\t * Log a warning message\n\t */\n\twarn(...messages: string[]) {\n\t\tthis.log('warn', messages.join(' '))\n\t}\n\n\t/**\n\t * Log an error message\n\t */\n\terror(message: string, error?: unknown) {\n\t\tthis.log('error', message, error === undefined ? undefined : Logger.toError(error))\n\t}\n\n\t/**\n\t * Log a fatal error message\n\t */\n\tfatal(message: string, error?: unknown) {\n\t\tthis.log('fatal', message, error === undefined ? undefined : Logger.toError(error))\n\t}\n}\n",
6
- "import type { AsyncSubscription, Event } from '@parcel/watcher'\nimport type { NextConfig } from 'next'\n\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport watcher from '@parcel/watcher'\n\nimport type { Logger } from '../logger.js'\nimport type { PluginConfig, Tags } from '../types.js'\nimport { collect, flattenTags, isENOENT, writeTypes } from '../index.js'\n\nconst nextDir = path.dirname(fileURLToPath(import.meta.url))\nconst loader = path.join(nextDir, 'cxx-loader.cjs')\n\n// keep the latest extracted tags per file so one edit can rebuild the full type surface\nconst tagsByFile: Map<string, Tags> = new Map()\n\n// directory watches are shared, but rebuilds still need the file's config and logger\nconst watchedFiles = new Map<string, { pluginConfig: PluginConfig; logger: Logger }>()\nconst subscriptionsByDir = new Map<string, Promise<AsyncSubscription>>()\n\n/**\n * Rebuild the generated type surface for one watched file after a Parcel event\n */\nasync function rebuildFile(filePath: string, event: Event['type']) {\n\tconst watchedFile = watchedFiles.get(filePath)\n\tif (!watchedFile) return\n\n\tconst { pluginConfig, logger } = watchedFile\n\tconst hadTags = tagsByFile.has(filePath)\n\n\tif (event === 'delete') {\n\t\ttagsByFile.delete(filePath)\n\t\tif (!hadTags) return\n\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\t\tlogger.info(`updated types from ${filePath}`)\n\n\t\treturn\n\t}\n\n\ttry {\n\t\tconst source = await fs.readFile(filePath, 'utf-8')\n\t\tconst { tags } = collect(source, filePath, pluginConfig)\n\t\tconst hasTags = tags.size > 0\n\n\t\tif (hasTags) {\n\t\t\ttagsByFile.set(filePath, tags)\n\t\t} else {\n\t\t\ttagsByFile.delete(filePath)\n\t\t}\n\n\t\tif (!hadTags && !hasTags) return\n\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\t\tlogger.info(`updated types from ${filePath}`)\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t\tif (!hadTags) return\n\n\t\ttagsByFile.delete(filePath)\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\n\t\tlogger.info(`updated types from ${filePath}`)\n\t}\n}\n\n/**\n * Transform one module and, in development, register it with the shared watcher state\n */\nexport function processFile(\n\tsource: string,\n\tfilePath: string,\n\tpluginConfig: PluginConfig,\n\tlogger: Logger,\n) {\n\tconst resolvedFilePath = path.resolve(filePath)\n\tconst directoryPath = path.dirname(resolvedFilePath)\n\tlet subscription = subscriptionsByDir.get(directoryPath)\n\n\tif (process.env.NODE_ENV !== 'production') {\n\t\t// Parcel watches directories, so remember the exact file inputs we care about\n\t\twatchedFiles.set(resolvedFilePath, { pluginConfig, logger })\n\n\t\tif (!subscription) {\n\t\t\t// one subscription per directory is enough; the callback filters back down to watched files\n\t\t\tsubscription = watcher.subscribe(directoryPath, async (err, events) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tlogger.error(`failed to update types from ${directoryPath}`, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Parcel can report unrelated files from the same directory, so ignore anything unregistered\n\t\t\t\tfor (const event of events) {\n\t\t\t\t\tconst eventFilePath = path.resolve(event.path)\n\t\t\t\t\tif (!watchedFiles.has(eventFilePath)) continue\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait rebuildFile(eventFilePath, event.type)\n\t\t\t\t\t} catch (watchErr) {\n\t\t\t\t\t\tlogger.error(`failed to update types from ${eventFilePath}`, watchErr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tsubscriptionsByDir.set(directoryPath, subscription)\n\t\t}\n\t}\n\n\tconst result = collect(source, filePath, pluginConfig)\n\n\tif (result.tags.size > 0) {\n\t\ttagsByFile.set(filePath, result.tags)\n\t} else {\n\t\ttagsByFile.delete(filePath)\n\t}\n\n\tvoid writeTypes(flattenTags(tagsByFile))\n\n\treturn result\n}\n\n/**\n * Close all active Parcel subscriptions before the process exits.\n */\nasync function cleanup() {\n\tawait Promise.all(\n\t\t[...subscriptionsByDir].map(async ([directoryPath, subPromise]) => {\n\t\t\tsubscriptionsByDir.delete(directoryPath)\n\t\t\tawait (await subPromise).unsubscribe()\n\t\t}),\n\t)\n\n\tsubscriptionsByDir.clear()\n}\n\nprocess.once('SIGINT', () => {\n\tcleanup().finally(() => process.exit(130))\n})\n\nprocess.once('SIGTERM', () => {\n\tcleanup().finally(() => process.exit(143))\n})\n\nexport async function withCxx(\n\tnextConfig: NextConfig = {},\n\tpluginConfig: PluginConfig = {},\n) {\n\tconst TURBOPACK_GLOB = '*.{tsx,jsx,ts,js}'\n\n\tconst loaderItem = {\n\t\tloader,\n\t\toptions: {\n\t\t\tpluginConfig,\n\t\t},\n\t}\n\n\tconst currentRule = nextConfig.turbopack?.rules?.[TURBOPACK_GLOB]\n\n\treturn {\n\t\t...nextConfig,\n\t\tturbopack: {\n\t\t\t...nextConfig.turbopack,\n\t\t\trules: {\n\t\t\t\t...nextConfig.turbopack?.rules,\n\t\t\t\t[TURBOPACK_GLOB]: Array.isArray(currentRule)\n\t\t\t\t\t? [...currentRule, loaderItem]\n\t\t\t\t\t: currentRule\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t...currentRule,\n\t\t\t\t\t\t\t\tloaders: [...(currentRule.loaders ?? []), loaderItem],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: { loaders: [loaderItem] },\n\t\t\t},\n\t\t},\n\t}\n}\n",
7
- "import { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\n\nimport type { BuildContext, Cxx, PluginConfig, Result, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\n/**\n * LRU cache of `collect` results by file id and last seen source so watcher and transform can\n * reuse the same parsed template/tags\n */\nconst collectCache = new LruCache<{ source: string; template: string; tags: Tags }>()\n\n/**\n * LRU cache for file content. Stores the last written content per file path so `maybeWrite`\n * can skip disk i/o when nothing has changed\n */\nconst fileCache = new LruCache<string>()\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = fileCache.get(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tfileCache.set(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tfileCache.set(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tfileCache.set(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1-3 assigned variable names, 4 plain css body, 5 quote\n// kind, 6 tag name, 7 tagged css body\nconst regex =\n\t/(?:const|var|let)\\s*\\[(\\w+|)\\s*,?\\s*(\\w+|)\\s*,?\\s*(\\w+|)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\5\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\n/**\n * Hash transformed CSS into a stable href for style deduplication\n */\nfunction hashCss(code: Uint8Array) {\n\treturn `cxx-${createHash('sha256').update(code).digest('base64url').slice(0, 12)}`\n}\n\nexport class TagDuplicateError extends Error {\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\n/**\n * Transform `cxx` templates in one source file and collect any exported tag types\n */\nexport function collect(source: string, id: string, config: PluginConfig) {\n\tconst tags: Tags = new Map()\n\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source) return cached\n\n\tconst template = source.replace(\n\t\tregex,\n\t\t(_match, varOne, varTwo, varThree, plainCss, _quote, tag, taggedCss) => {\n\t\t\tconst css = plainCss ?? taggedCss\n\n\t\t\tconst { code, exports = {} } = transform({\n\t\t\t\tminify: true,\n\t\t\t\tcssModules: true,\n\t\t\t\tfilename: id,\n\t\t\t\tcode: new TextEncoder().encode(css),\n\t\t\t})\n\n\t\t\tconst href = hashCss(code)\n\t\t\tconst styles = Object.fromEntries(\n\t\t\t\tObject.entries(exports).map(([k, v]) => [k, v.name]),\n\t\t\t)\n\n\t\t\tif (tag) {\n\t\t\t\tconst suffix =\n\t\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t: 'Classes'\n\t\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\t\tif (tags.has(tagWithSuffix)) throw new TagDuplicateError(tagWithSuffix)\n\n\t\t\t\t// side effect but neccessary\n\t\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tvarOne && `const ${varOne} = \\`${code}\\``,\n\t\t\t\tvarTwo && `const ${varTwo} = ${JSON.stringify(styles)}`,\n\t\t\t\tvarThree && `const ${varThree} = \\`${href}\\``,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join('\\n')\n\t\t},\n\t)\n\n\t// cache\n\tcollectCache.set(id, { source, template, tags })\n\n\treturn {\n\t\ttemplate,\n\t\ttags,\n\t}\n}\n\n/**\n * Write the generated declaration file for the current set of collected tags\n */\nexport async function writeTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\ttry {\n\t\t\tawait fs.rm(filePath, { force: true })\n\t\t\tfileCache.delete(filePath)\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t}\n\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\n\tawait maybeWrite(\n\t\tfilePath,\n\t\t`${AUTOGEN_MSG}\n\n\t\t\timport '${PKG_NAME}'\n\n\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t${tagsToType(tags)}\n\t\t\t}\n\t\t`,\n\t)\n}\n\n/**\n * Render collected tags as a module augmentation for the package entrypoint\n */\nexport function tagsToType(tags: Tags) {\n\treturn [...tags]\n\t\t.map(\n\t\t\t([tag, classes]) => `\n\t\texport type ${tag} = ${\n\t\t\tclasses.length > 0\n\t\t\t\t? classes\n\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t.join(' | ')\n\t\t\t\t: 'never'\n\t\t}\n\t`,\n\t\t)\n\t\t.join('\\n')\n}\n\n/**\n * Merge per-file tag maps into one application-wide tag map\n */\nexport function flattenTags(tagsByFile: BuildContext['tagsByFile']) {\n\tconst tags = new Map<string, string[]>()\n\n\tfor (const fileTags of tagsByFile.values()) {\n\t\tfor (const [name, classes] of fileTags) {\n\t\t\tif (tags.has(name)) throw new TagDuplicateError(name)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn tags\n}\n\n/**\n * Build-time template tag placeholder used by the transform to emit CSS, classes and href values\n */\nexport const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['', {}, ''], {\n\ttag:\n\t\t<ClassName extends string = string>(_: string) =>\n\t\t(_strings: TemplateStringsArray): Result<ClassName> => [\n\t\t\t'',\n\t\t\t{} as Readonly<Record<ClassName, string>>,\n\t\t\t'',\n\t\t],\n})\n\nexport const css = cxx\n",
6
+ "import type { AsyncSubscription, Event } from '@parcel/watcher'\nimport type { NextConfig } from 'next'\n\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport watcher from '@parcel/watcher'\n\nimport type { Logger } from '../logger.js'\nimport type { PluginConfig, Tags } from '../types.js'\nimport { collect, flattenTags, isENOENT, writeTypes } from '../index.js'\n\nconst nextDir = path.dirname(fileURLToPath(import.meta.url))\nconst loader = path.join(nextDir, 'cxx-loader.cjs')\n\n// keep the latest extracted tags per file so one edit can rebuild the full type surface\nconst tagsByFile: Map<string, Tags> = new Map()\n\n// directory watches are shared, but rebuilds still need the file's config and logger\nconst watchedFiles = new Map<string, { pluginConfig: PluginConfig; logger: Logger }>()\nconst subscriptionsByDir = new Map<string, Promise<AsyncSubscription>>()\n\n/**\n * Rebuild the generated type surface for one watched file after a Parcel event\n */\nasync function rebuildFile(filePath: string, event: Event['type']) {\n\tconst watchedFile = watchedFiles.get(filePath)\n\tif (!watchedFile) return\n\n\tconst { pluginConfig, logger } = watchedFile\n\tconst hadTags = tagsByFile.has(filePath)\n\n\tif (event === 'delete') {\n\t\ttagsByFile.delete(filePath)\n\t\tif (!hadTags) return\n\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\t\tlogger.info(`updated types from ${filePath}`)\n\n\t\treturn\n\t}\n\n\ttry {\n\t\tconst source = await fs.readFile(filePath, 'utf-8')\n\t\tconst { tags } = collect(source, filePath, pluginConfig)\n\t\tconst hasTags = tags.size > 0\n\n\t\tif (hasTags) {\n\t\t\ttagsByFile.set(filePath, tags)\n\t\t} else {\n\t\t\ttagsByFile.delete(filePath)\n\t\t}\n\n\t\tif (!hadTags && !hasTags) return\n\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\t\tlogger.info(`updated types from ${filePath}`)\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t\tif (!hadTags) return\n\n\t\ttagsByFile.delete(filePath)\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\n\t\tlogger.info(`updated types from ${filePath}`)\n\t}\n}\n\n/**\n * Transform one module and, in development, register it with the shared watcher state\n */\nexport function processFile(\n\tsource: string,\n\tfilePath: string,\n\tpluginConfig: PluginConfig,\n\tlogger: Logger,\n) {\n\tconst resolvedFilePath = path.resolve(filePath)\n\tconst directoryPath = path.dirname(resolvedFilePath)\n\tlet subscription = subscriptionsByDir.get(directoryPath)\n\n\tif (process.env.NODE_ENV !== 'production') {\n\t\t// Parcel watches directories, so remember the exact file inputs we care about\n\t\twatchedFiles.set(resolvedFilePath, { pluginConfig, logger })\n\n\t\tif (!subscription) {\n\t\t\t// one subscription per directory is enough; the callback filters back down to watched files\n\t\t\tsubscription = watcher.subscribe(directoryPath, async (err, events) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tlogger.error(`failed to update types from ${directoryPath}`, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Parcel can report unrelated files from the same directory, so ignore anything unregistered\n\t\t\t\tfor (const event of events) {\n\t\t\t\t\tconst eventFilePath = path.resolve(event.path)\n\t\t\t\t\tif (!watchedFiles.has(eventFilePath)) continue\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait rebuildFile(eventFilePath, event.type)\n\t\t\t\t\t} catch (watchErr) {\n\t\t\t\t\t\tlogger.error(`failed to update types from ${eventFilePath}`, watchErr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tsubscriptionsByDir.set(directoryPath, subscription)\n\t\t}\n\t}\n\n\tconst result = collect(source, filePath, pluginConfig)\n\n\tif (result.tags.size > 0) {\n\t\ttagsByFile.set(filePath, result.tags)\n\t} else {\n\t\ttagsByFile.delete(filePath)\n\t}\n\n\tvoid writeTypes(flattenTags(tagsByFile))\n\n\treturn result\n}\n\n/**\n * Close all active Parcel subscriptions before the process exits\n */\nasync function cleanup() {\n\tawait Promise.all(\n\t\t[...subscriptionsByDir].map(async ([directoryPath, subPromise]) => {\n\t\t\tsubscriptionsByDir.delete(directoryPath)\n\t\t\tawait (await subPromise).unsubscribe()\n\t\t}),\n\t)\n\n\tsubscriptionsByDir.clear()\n}\n\nprocess.once('SIGINT', () => {\n\tcleanup().finally(() => process.exit(130))\n})\n\nprocess.once('SIGTERM', () => {\n\tcleanup().finally(() => process.exit(143))\n})\n\nexport async function withCxx(\n\tnextConfig: NextConfig = {},\n\tpluginConfig: PluginConfig = {},\n) {\n\tconst TURBOPACK_GLOB = '*.{tsx,jsx,ts,js}'\n\n\tconst loaderItem = {\n\t\tloader,\n\t\toptions: {\n\t\t\tpluginConfig,\n\t\t},\n\t}\n\n\tconst currentRule = nextConfig.turbopack?.rules?.[TURBOPACK_GLOB]\n\n\treturn {\n\t\t...nextConfig,\n\t\tturbopack: {\n\t\t\t...nextConfig.turbopack,\n\t\t\trules: {\n\t\t\t\t...nextConfig.turbopack?.rules,\n\t\t\t\t[TURBOPACK_GLOB]: Array.isArray(currentRule)\n\t\t\t\t\t? [...currentRule, loaderItem]\n\t\t\t\t\t: currentRule\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t...currentRule,\n\t\t\t\t\t\t\t\tloaders: [...(currentRule.loaders ?? []), loaderItem],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: { loaders: [loaderItem] },\n\t\t\t},\n\t\t},\n\t}\n}\n",
7
+ "import { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\n\nimport type { BuildContext, Cxx, PluginConfig, Result, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\n/**\n * LRU cache of `collect` results by file id and last seen source so watcher and transform can\n * reuse the same parsed template/tags\n */\nconst collectCache = new LruCache<{ source: string; template: string; tags: Tags }>()\n\n/**\n * LRU cache for file content. Stores the last written content per file path so `maybeWrite`\n * can skip disk i/o when nothing has changed\n */\nconst fileCache = new LruCache<string>()\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = fileCache.get(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tfileCache.set(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tfileCache.set(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tfileCache.set(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1-3 assigned variable names, 4 plain css body, 5 quote\n// kind, 6 tag name, 7 tagged css body\nconst regex =\n\t/(?:const|var|let)\\s*\\[(\\w+|)\\s*,?\\s*(\\w+|)\\s*,?\\s*(\\w+|)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\5\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\n/**\n * Hash transformed CSS into a stable href for style deduplication\n */\nfunction hashCss(code: Uint8Array) {\n\treturn `cxx-${createHash('sha256').update(code).digest('base64url').slice(0, 12)}`\n}\n\nexport class TagDuplicateError extends Error {\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\n/**\n * Transform `cxx` templates in one source file and collect any exported tag types\n */\nexport function collect(source: string, id: string, config: PluginConfig) {\n\tconst tags: Tags = new Map()\n\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source) return cached\n\n\tconst template = source.replace(\n\t\tregex,\n\t\t(_match, varOne, varTwo, varThree, plainCss, _quote, tag, taggedCss) => {\n\t\t\tconst css = plainCss ?? taggedCss\n\n\t\t\tconst { code, exports = {} } = transform({\n\t\t\t\tminify: true,\n\t\t\t\tcssModules: true,\n\t\t\t\tfilename: id,\n\t\t\t\tcode: new TextEncoder().encode(css),\n\t\t\t})\n\n\t\t\tconst href = hashCss(code)\n\t\t\tconst styles = Object.fromEntries(\n\t\t\t\tObject.entries(exports).map(([k, v]) => [k, v.name]),\n\t\t\t)\n\n\t\t\tif (tag) {\n\t\t\t\tconst suffix =\n\t\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t: 'Classes'\n\t\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\t\tif (tags.has(tagWithSuffix)) throw new TagDuplicateError(tagWithSuffix)\n\n\t\t\t\t// side effect but neccessary\n\t\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tvarOne && `const ${varOne} = \\`${code}\\``,\n\t\t\t\tvarTwo && `const ${varTwo} = ${JSON.stringify(styles)}`,\n\t\t\t\tvarThree && `const ${varThree} = \\`${href}\\``,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join('\\n')\n\t\t},\n\t)\n\n\t// cache\n\tcollectCache.set(id, { source, template, tags })\n\n\treturn {\n\t\ttemplate,\n\t\ttags,\n\t}\n}\n\n/**\n * Write the generated declaration file for the current set of collected tags\n */\nexport async function writeTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\ttry {\n\t\t\tawait fs.rm(filePath, { force: true })\n\t\t\tfileCache.delete(filePath)\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t}\n\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\n\tawait maybeWrite(\n\t\tfilePath,\n\t\t`${AUTOGEN_MSG}\n\n\t\t\timport '${PKG_NAME}'\n\n\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t${tagsToType(tags)}\n\t\t\t}\n\t\t`,\n\t)\n}\n\n/**\n * Render collected tags as a module augmentation for the package entrypoint\n */\nexport function tagsToType(tags: Tags) {\n\treturn [...tags]\n\t\t.map(\n\t\t\t([tag, classes]) => `\n\t\texport type ${tag} = ${\n\t\t\tclasses.length > 0\n\t\t\t\t? classes\n\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t.join(' | ')\n\t\t\t\t: 'never'\n\t\t}\n\t`,\n\t\t)\n\t\t.join('\\n')\n}\n\n/**\n * Merge per-file tag maps into one application-wide tag map\n */\nexport function flattenTags(tagsByFile: BuildContext['tagsByFile']) {\n\tconst tags = new Map<string, string[]>()\n\n\tfor (const fileTags of tagsByFile.values()) {\n\t\tfor (const [name, classes] of fileTags) {\n\t\t\tif (tags.has(name)) throw new TagDuplicateError(name)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn tags\n}\n\n/**\n * Build-time template tag placeholder used by the transform to emit CSS, classes and href values\n */\nexport const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['', {}, ''], {\n\ttag:\n\t\t<ClassName extends string = string>(_: string) =>\n\t\t(_strings: TemplateStringsArray): Result<ClassName> => [\n\t\t\t'',\n\t\t\t{} as Readonly<Record<ClassName, string>>,\n\t\t\t'',\n\t\t],\n})\n",
8
8
  "export const NAME = 'cxx'\nexport const PKG_NAME = `@jk2908/${NAME}`\nexport const GENERATED_DIR = `.${NAME}`\nexport const AUTOGEN_MSG = `// auto-generated by ${NAME}`\n",
9
9
  "export const CACHE_MAX_SIZE = 100\n\nexport class LruCache<T> {\n\t#cache: Map<string, T> = new Map()\n\t#maxSize: number\n\n\tconstructor(maxSize = CACHE_MAX_SIZE) {\n\t\tthis.#maxSize = maxSize\n\t}\n\n\tget size() {\n\t\treturn this.#cache.size\n\t}\n\n\t/**\n\t * Retrieve a cached value and promote it to most-recently-used so it won't\n\t * be evicted while still actively referenced\n\t */\n\tget(key: string) {\n\t\tconst cached = this.#cache.get(key)\n\t\tif (this.#cache.has(key)) this.set(key, cached as T)\n\n\t\treturn cached\n\t}\n\n\t/**\n\t * Promote an existing cache entry to most-recently-used by deleting and\n\t * re-inserting it, which moves it to the end of the Map's iteration\n\t * order. If the cache is at capacity, evict the least recently used\n\t * entry (front) before inserting\n\t */\n\tset(key: string, value: T) {\n\t\t// drop any existing entry\n\t\tthis.#cache.delete(key)\n\n\t\tif (this.#cache.size >= this.#maxSize) {\n\t\t\tconst lru = this.#cache.keys().next().value\n\t\t\tif (lru !== undefined) this.#cache.delete(lru)\n\t\t}\n\n\t\tthis.#cache.set(key, value)\n\t}\n\n\tdelete(key: string) {\n\t\treturn this.#cache.delete(key)\n\t}\n\n\tclear() {\n\t\treturn this.#cache.clear()\n\t}\n}\n",
10
10
  "export function capitalise(str: string) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport function pascalise(str: string) {\n\treturn str\n\t\t.split(/[ _-]+/)\n\t\t.map(capitalise)\n\t\t.join('')\n}\n\nexport function debounce<T extends unknown[]>(fn: (...args: T) => void, wait: number) {\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\treturn (...args: T) => {\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\n\t\ttimeoutId = setTimeout(() => {\n\t\t\tfn.apply(null, args)\n\t\t}, wait)\n\t}\n}\n",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRo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,MAAM,CAAA;AAQtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AA2DrD;;GAEG;AACH,wBAAgB,WAAW,CAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM;;;;;;;EA8Cd;AAwBD,wBAAsB,OAAO,CAC5B,UAAU,GAAE,UAAe,EAC3B,YAAY,GAAE,YAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+Bk2E,CAAC;uBAAsC,CAAC;;;;;;;;;;;;;;;;mBAAsn5B,CAAC;kBAA+B,CAAC;gBAA6B,CAAC;;mBAAuD,CAAC;kBAA+B,CAAC;gBAA6B,CAAC;;;;;;;;;;;;;eAA8lF,CAAC;cAAwB,CAAC;cAAwB,CAAC;;;;;;;;;;;;gBAAo9D,CAAC;;;sBAAie,CAAC;yBAA4H,CAAC;;;;;sBAAkiB,CAAC;;;;;;;;;iBAA4+C,CAAC;;;;;6BAA+sB,CAAC;sBAAoC,CAAC;;aAAoC,CAAC;;6BAA0D,CAAC;oBAA8B,CAAC;0BAAkE,CAAC;;qBAA2C,CAAC;mBAAiC,CAAC;;wBAA+C,CAAC;eAAmD,CAAC;iBAA4C,CAAC;2BAAyC,CAAC;;cAA6L,CAAC;oBAAyP,CAAC;iCAA8S,CAAC;;;;;;;;;;;;yBAAm0D,CAAC;6BAAwC,CAAC;;;;;;;iBAAowB,CAAC;sBAAgC,CAAC;kBAA4B,CAAC;;;;;;;;;;;sBAA21C,CAAC;;;GAD514C"}
@@ -181,7 +181,6 @@ var cxx = Object.assign((_) => ["", {}, ""], {
181
181
  ""
182
182
  ]
183
183
  });
184
- var css = cxx;
185
184
 
186
185
  // src/next/index.ts
187
186
  import fs2 from "node:fs/promises";
@@ -306,4 +305,4 @@ export {
306
305
  processFile
307
306
  };
308
307
 
309
- //# debugId=2C5447B2EBFD802A64756E2164756E21
308
+ //# debugId=9A17D8885429CB9164756E2164756E21
@@ -2,13 +2,13 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/config.ts", "../src/lru.ts", "../src/utils.ts", "../src/next/index.ts"],
4
4
  "sourcesContent": [
5
- "import { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\n\nimport type { BuildContext, Cxx, PluginConfig, Result, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\n/**\n * LRU cache of `collect` results by file id and last seen source so watcher and transform can\n * reuse the same parsed template/tags\n */\nconst collectCache = new LruCache<{ source: string; template: string; tags: Tags }>()\n\n/**\n * LRU cache for file content. Stores the last written content per file path so `maybeWrite`\n * can skip disk i/o when nothing has changed\n */\nconst fileCache = new LruCache<string>()\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = fileCache.get(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tfileCache.set(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tfileCache.set(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tfileCache.set(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1-3 assigned variable names, 4 plain css body, 5 quote\n// kind, 6 tag name, 7 tagged css body\nconst regex =\n\t/(?:const|var|let)\\s*\\[(\\w+|)\\s*,?\\s*(\\w+|)\\s*,?\\s*(\\w+|)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\5\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\n/**\n * Hash transformed CSS into a stable href for style deduplication\n */\nfunction hashCss(code: Uint8Array) {\n\treturn `cxx-${createHash('sha256').update(code).digest('base64url').slice(0, 12)}`\n}\n\nexport class TagDuplicateError extends Error {\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\n/**\n * Transform `cxx` templates in one source file and collect any exported tag types\n */\nexport function collect(source: string, id: string, config: PluginConfig) {\n\tconst tags: Tags = new Map()\n\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source) return cached\n\n\tconst template = source.replace(\n\t\tregex,\n\t\t(_match, varOne, varTwo, varThree, plainCss, _quote, tag, taggedCss) => {\n\t\t\tconst css = plainCss ?? taggedCss\n\n\t\t\tconst { code, exports = {} } = transform({\n\t\t\t\tminify: true,\n\t\t\t\tcssModules: true,\n\t\t\t\tfilename: id,\n\t\t\t\tcode: new TextEncoder().encode(css),\n\t\t\t})\n\n\t\t\tconst href = hashCss(code)\n\t\t\tconst styles = Object.fromEntries(\n\t\t\t\tObject.entries(exports).map(([k, v]) => [k, v.name]),\n\t\t\t)\n\n\t\t\tif (tag) {\n\t\t\t\tconst suffix =\n\t\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t: 'Classes'\n\t\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\t\tif (tags.has(tagWithSuffix)) throw new TagDuplicateError(tagWithSuffix)\n\n\t\t\t\t// side effect but neccessary\n\t\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tvarOne && `const ${varOne} = \\`${code}\\``,\n\t\t\t\tvarTwo && `const ${varTwo} = ${JSON.stringify(styles)}`,\n\t\t\t\tvarThree && `const ${varThree} = \\`${href}\\``,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join('\\n')\n\t\t},\n\t)\n\n\t// cache\n\tcollectCache.set(id, { source, template, tags })\n\n\treturn {\n\t\ttemplate,\n\t\ttags,\n\t}\n}\n\n/**\n * Write the generated declaration file for the current set of collected tags\n */\nexport async function writeTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\ttry {\n\t\t\tawait fs.rm(filePath, { force: true })\n\t\t\tfileCache.delete(filePath)\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t}\n\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\n\tawait maybeWrite(\n\t\tfilePath,\n\t\t`${AUTOGEN_MSG}\n\n\t\t\timport '${PKG_NAME}'\n\n\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t${tagsToType(tags)}\n\t\t\t}\n\t\t`,\n\t)\n}\n\n/**\n * Render collected tags as a module augmentation for the package entrypoint\n */\nexport function tagsToType(tags: Tags) {\n\treturn [...tags]\n\t\t.map(\n\t\t\t([tag, classes]) => `\n\t\texport type ${tag} = ${\n\t\t\tclasses.length > 0\n\t\t\t\t? classes\n\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t.join(' | ')\n\t\t\t\t: 'never'\n\t\t}\n\t`,\n\t\t)\n\t\t.join('\\n')\n}\n\n/**\n * Merge per-file tag maps into one application-wide tag map\n */\nexport function flattenTags(tagsByFile: BuildContext['tagsByFile']) {\n\tconst tags = new Map<string, string[]>()\n\n\tfor (const fileTags of tagsByFile.values()) {\n\t\tfor (const [name, classes] of fileTags) {\n\t\t\tif (tags.has(name)) throw new TagDuplicateError(name)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn tags\n}\n\n/**\n * Build-time template tag placeholder used by the transform to emit CSS, classes and href values\n */\nexport const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['', {}, ''], {\n\ttag:\n\t\t<ClassName extends string = string>(_: string) =>\n\t\t(_strings: TemplateStringsArray): Result<ClassName> => [\n\t\t\t'',\n\t\t\t{} as Readonly<Record<ClassName, string>>,\n\t\t\t'',\n\t\t],\n})\n\nexport const css = cxx\n",
5
+ "import { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\n\nimport type { BuildContext, Cxx, PluginConfig, Result, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\n/**\n * LRU cache of `collect` results by file id and last seen source so watcher and transform can\n * reuse the same parsed template/tags\n */\nconst collectCache = new LruCache<{ source: string; template: string; tags: Tags }>()\n\n/**\n * LRU cache for file content. Stores the last written content per file path so `maybeWrite`\n * can skip disk i/o when nothing has changed\n */\nconst fileCache = new LruCache<string>()\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = fileCache.get(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tfileCache.set(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tfileCache.set(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tfileCache.set(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1-3 assigned variable names, 4 plain css body, 5 quote\n// kind, 6 tag name, 7 tagged css body\nconst regex =\n\t/(?:const|var|let)\\s*\\[(\\w+|)\\s*,?\\s*(\\w+|)\\s*,?\\s*(\\w+|)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\5\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\n/**\n * Hash transformed CSS into a stable href for style deduplication\n */\nfunction hashCss(code: Uint8Array) {\n\treturn `cxx-${createHash('sha256').update(code).digest('base64url').slice(0, 12)}`\n}\n\nexport class TagDuplicateError extends Error {\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\n/**\n * Transform `cxx` templates in one source file and collect any exported tag types\n */\nexport function collect(source: string, id: string, config: PluginConfig) {\n\tconst tags: Tags = new Map()\n\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source) return cached\n\n\tconst template = source.replace(\n\t\tregex,\n\t\t(_match, varOne, varTwo, varThree, plainCss, _quote, tag, taggedCss) => {\n\t\t\tconst css = plainCss ?? taggedCss\n\n\t\t\tconst { code, exports = {} } = transform({\n\t\t\t\tminify: true,\n\t\t\t\tcssModules: true,\n\t\t\t\tfilename: id,\n\t\t\t\tcode: new TextEncoder().encode(css),\n\t\t\t})\n\n\t\t\tconst href = hashCss(code)\n\t\t\tconst styles = Object.fromEntries(\n\t\t\t\tObject.entries(exports).map(([k, v]) => [k, v.name]),\n\t\t\t)\n\n\t\t\tif (tag) {\n\t\t\t\tconst suffix =\n\t\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t: 'Classes'\n\t\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\t\tif (tags.has(tagWithSuffix)) throw new TagDuplicateError(tagWithSuffix)\n\n\t\t\t\t// side effect but neccessary\n\t\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tvarOne && `const ${varOne} = \\`${code}\\``,\n\t\t\t\tvarTwo && `const ${varTwo} = ${JSON.stringify(styles)}`,\n\t\t\t\tvarThree && `const ${varThree} = \\`${href}\\``,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join('\\n')\n\t\t},\n\t)\n\n\t// cache\n\tcollectCache.set(id, { source, template, tags })\n\n\treturn {\n\t\ttemplate,\n\t\ttags,\n\t}\n}\n\n/**\n * Write the generated declaration file for the current set of collected tags\n */\nexport async function writeTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\ttry {\n\t\t\tawait fs.rm(filePath, { force: true })\n\t\t\tfileCache.delete(filePath)\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t}\n\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\n\tawait maybeWrite(\n\t\tfilePath,\n\t\t`${AUTOGEN_MSG}\n\n\t\t\timport '${PKG_NAME}'\n\n\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t${tagsToType(tags)}\n\t\t\t}\n\t\t`,\n\t)\n}\n\n/**\n * Render collected tags as a module augmentation for the package entrypoint\n */\nexport function tagsToType(tags: Tags) {\n\treturn [...tags]\n\t\t.map(\n\t\t\t([tag, classes]) => `\n\t\texport type ${tag} = ${\n\t\t\tclasses.length > 0\n\t\t\t\t? classes\n\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t.join(' | ')\n\t\t\t\t: 'never'\n\t\t}\n\t`,\n\t\t)\n\t\t.join('\\n')\n}\n\n/**\n * Merge per-file tag maps into one application-wide tag map\n */\nexport function flattenTags(tagsByFile: BuildContext['tagsByFile']) {\n\tconst tags = new Map<string, string[]>()\n\n\tfor (const fileTags of tagsByFile.values()) {\n\t\tfor (const [name, classes] of fileTags) {\n\t\t\tif (tags.has(name)) throw new TagDuplicateError(name)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn tags\n}\n\n/**\n * Build-time template tag placeholder used by the transform to emit CSS, classes and href values\n */\nexport const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['', {}, ''], {\n\ttag:\n\t\t<ClassName extends string = string>(_: string) =>\n\t\t(_strings: TemplateStringsArray): Result<ClassName> => [\n\t\t\t'',\n\t\t\t{} as Readonly<Record<ClassName, string>>,\n\t\t\t'',\n\t\t],\n})\n",
6
6
  "export const NAME = 'cxx'\nexport const PKG_NAME = `@jk2908/${NAME}`\nexport const GENERATED_DIR = `.${NAME}`\nexport const AUTOGEN_MSG = `// auto-generated by ${NAME}`\n",
7
7
  "export const CACHE_MAX_SIZE = 100\n\nexport class LruCache<T> {\n\t#cache: Map<string, T> = new Map()\n\t#maxSize: number\n\n\tconstructor(maxSize = CACHE_MAX_SIZE) {\n\t\tthis.#maxSize = maxSize\n\t}\n\n\tget size() {\n\t\treturn this.#cache.size\n\t}\n\n\t/**\n\t * Retrieve a cached value and promote it to most-recently-used so it won't\n\t * be evicted while still actively referenced\n\t */\n\tget(key: string) {\n\t\tconst cached = this.#cache.get(key)\n\t\tif (this.#cache.has(key)) this.set(key, cached as T)\n\n\t\treturn cached\n\t}\n\n\t/**\n\t * Promote an existing cache entry to most-recently-used by deleting and\n\t * re-inserting it, which moves it to the end of the Map's iteration\n\t * order. If the cache is at capacity, evict the least recently used\n\t * entry (front) before inserting\n\t */\n\tset(key: string, value: T) {\n\t\t// drop any existing entry\n\t\tthis.#cache.delete(key)\n\n\t\tif (this.#cache.size >= this.#maxSize) {\n\t\t\tconst lru = this.#cache.keys().next().value\n\t\t\tif (lru !== undefined) this.#cache.delete(lru)\n\t\t}\n\n\t\tthis.#cache.set(key, value)\n\t}\n\n\tdelete(key: string) {\n\t\treturn this.#cache.delete(key)\n\t}\n\n\tclear() {\n\t\treturn this.#cache.clear()\n\t}\n}\n",
8
8
  "export function capitalise(str: string) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport function pascalise(str: string) {\n\treturn str\n\t\t.split(/[ _-]+/)\n\t\t.map(capitalise)\n\t\t.join('')\n}\n\nexport function debounce<T extends unknown[]>(fn: (...args: T) => void, wait: number) {\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\treturn (...args: T) => {\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\n\t\ttimeoutId = setTimeout(() => {\n\t\t\tfn.apply(null, args)\n\t\t}, wait)\n\t}\n}\n",
9
- "import type { AsyncSubscription, Event } from '@parcel/watcher'\nimport type { NextConfig } from 'next'\n\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport watcher from '@parcel/watcher'\n\nimport type { Logger } from '../logger.js'\nimport type { PluginConfig, Tags } from '../types.js'\nimport { collect, flattenTags, isENOENT, writeTypes } from '../index.js'\n\nconst nextDir = path.dirname(fileURLToPath(import.meta.url))\nconst loader = path.join(nextDir, 'cxx-loader.cjs')\n\n// keep the latest extracted tags per file so one edit can rebuild the full type surface\nconst tagsByFile: Map<string, Tags> = new Map()\n\n// directory watches are shared, but rebuilds still need the file's config and logger\nconst watchedFiles = new Map<string, { pluginConfig: PluginConfig; logger: Logger }>()\nconst subscriptionsByDir = new Map<string, Promise<AsyncSubscription>>()\n\n/**\n * Rebuild the generated type surface for one watched file after a Parcel event\n */\nasync function rebuildFile(filePath: string, event: Event['type']) {\n\tconst watchedFile = watchedFiles.get(filePath)\n\tif (!watchedFile) return\n\n\tconst { pluginConfig, logger } = watchedFile\n\tconst hadTags = tagsByFile.has(filePath)\n\n\tif (event === 'delete') {\n\t\ttagsByFile.delete(filePath)\n\t\tif (!hadTags) return\n\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\t\tlogger.info(`updated types from ${filePath}`)\n\n\t\treturn\n\t}\n\n\ttry {\n\t\tconst source = await fs.readFile(filePath, 'utf-8')\n\t\tconst { tags } = collect(source, filePath, pluginConfig)\n\t\tconst hasTags = tags.size > 0\n\n\t\tif (hasTags) {\n\t\t\ttagsByFile.set(filePath, tags)\n\t\t} else {\n\t\t\ttagsByFile.delete(filePath)\n\t\t}\n\n\t\tif (!hadTags && !hasTags) return\n\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\t\tlogger.info(`updated types from ${filePath}`)\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t\tif (!hadTags) return\n\n\t\ttagsByFile.delete(filePath)\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\n\t\tlogger.info(`updated types from ${filePath}`)\n\t}\n}\n\n/**\n * Transform one module and, in development, register it with the shared watcher state\n */\nexport function processFile(\n\tsource: string,\n\tfilePath: string,\n\tpluginConfig: PluginConfig,\n\tlogger: Logger,\n) {\n\tconst resolvedFilePath = path.resolve(filePath)\n\tconst directoryPath = path.dirname(resolvedFilePath)\n\tlet subscription = subscriptionsByDir.get(directoryPath)\n\n\tif (process.env.NODE_ENV !== 'production') {\n\t\t// Parcel watches directories, so remember the exact file inputs we care about\n\t\twatchedFiles.set(resolvedFilePath, { pluginConfig, logger })\n\n\t\tif (!subscription) {\n\t\t\t// one subscription per directory is enough; the callback filters back down to watched files\n\t\t\tsubscription = watcher.subscribe(directoryPath, async (err, events) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tlogger.error(`failed to update types from ${directoryPath}`, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Parcel can report unrelated files from the same directory, so ignore anything unregistered\n\t\t\t\tfor (const event of events) {\n\t\t\t\t\tconst eventFilePath = path.resolve(event.path)\n\t\t\t\t\tif (!watchedFiles.has(eventFilePath)) continue\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait rebuildFile(eventFilePath, event.type)\n\t\t\t\t\t} catch (watchErr) {\n\t\t\t\t\t\tlogger.error(`failed to update types from ${eventFilePath}`, watchErr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tsubscriptionsByDir.set(directoryPath, subscription)\n\t\t}\n\t}\n\n\tconst result = collect(source, filePath, pluginConfig)\n\n\tif (result.tags.size > 0) {\n\t\ttagsByFile.set(filePath, result.tags)\n\t} else {\n\t\ttagsByFile.delete(filePath)\n\t}\n\n\tvoid writeTypes(flattenTags(tagsByFile))\n\n\treturn result\n}\n\n/**\n * Close all active Parcel subscriptions before the process exits.\n */\nasync function cleanup() {\n\tawait Promise.all(\n\t\t[...subscriptionsByDir].map(async ([directoryPath, subPromise]) => {\n\t\t\tsubscriptionsByDir.delete(directoryPath)\n\t\t\tawait (await subPromise).unsubscribe()\n\t\t}),\n\t)\n\n\tsubscriptionsByDir.clear()\n}\n\nprocess.once('SIGINT', () => {\n\tcleanup().finally(() => process.exit(130))\n})\n\nprocess.once('SIGTERM', () => {\n\tcleanup().finally(() => process.exit(143))\n})\n\nexport async function withCxx(\n\tnextConfig: NextConfig = {},\n\tpluginConfig: PluginConfig = {},\n) {\n\tconst TURBOPACK_GLOB = '*.{tsx,jsx,ts,js}'\n\n\tconst loaderItem = {\n\t\tloader,\n\t\toptions: {\n\t\t\tpluginConfig,\n\t\t},\n\t}\n\n\tconst currentRule = nextConfig.turbopack?.rules?.[TURBOPACK_GLOB]\n\n\treturn {\n\t\t...nextConfig,\n\t\tturbopack: {\n\t\t\t...nextConfig.turbopack,\n\t\t\trules: {\n\t\t\t\t...nextConfig.turbopack?.rules,\n\t\t\t\t[TURBOPACK_GLOB]: Array.isArray(currentRule)\n\t\t\t\t\t? [...currentRule, loaderItem]\n\t\t\t\t\t: currentRule\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t...currentRule,\n\t\t\t\t\t\t\t\tloaders: [...(currentRule.loaders ?? []), loaderItem],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: { loaders: [loaderItem] },\n\t\t\t},\n\t\t},\n\t}\n}\n"
9
+ "import type { AsyncSubscription, Event } from '@parcel/watcher'\nimport type { NextConfig } from 'next'\n\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport watcher from '@parcel/watcher'\n\nimport type { Logger } from '../logger.js'\nimport type { PluginConfig, Tags } from '../types.js'\nimport { collect, flattenTags, isENOENT, writeTypes } from '../index.js'\n\nconst nextDir = path.dirname(fileURLToPath(import.meta.url))\nconst loader = path.join(nextDir, 'cxx-loader.cjs')\n\n// keep the latest extracted tags per file so one edit can rebuild the full type surface\nconst tagsByFile: Map<string, Tags> = new Map()\n\n// directory watches are shared, but rebuilds still need the file's config and logger\nconst watchedFiles = new Map<string, { pluginConfig: PluginConfig; logger: Logger }>()\nconst subscriptionsByDir = new Map<string, Promise<AsyncSubscription>>()\n\n/**\n * Rebuild the generated type surface for one watched file after a Parcel event\n */\nasync function rebuildFile(filePath: string, event: Event['type']) {\n\tconst watchedFile = watchedFiles.get(filePath)\n\tif (!watchedFile) return\n\n\tconst { pluginConfig, logger } = watchedFile\n\tconst hadTags = tagsByFile.has(filePath)\n\n\tif (event === 'delete') {\n\t\ttagsByFile.delete(filePath)\n\t\tif (!hadTags) return\n\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\t\tlogger.info(`updated types from ${filePath}`)\n\n\t\treturn\n\t}\n\n\ttry {\n\t\tconst source = await fs.readFile(filePath, 'utf-8')\n\t\tconst { tags } = collect(source, filePath, pluginConfig)\n\t\tconst hasTags = tags.size > 0\n\n\t\tif (hasTags) {\n\t\t\ttagsByFile.set(filePath, tags)\n\t\t} else {\n\t\t\ttagsByFile.delete(filePath)\n\t\t}\n\n\t\tif (!hadTags && !hasTags) return\n\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\t\tlogger.info(`updated types from ${filePath}`)\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t\tif (!hadTags) return\n\n\t\ttagsByFile.delete(filePath)\n\t\tawait writeTypes(flattenTags(tagsByFile))\n\n\t\tlogger.info(`updated types from ${filePath}`)\n\t}\n}\n\n/**\n * Transform one module and, in development, register it with the shared watcher state\n */\nexport function processFile(\n\tsource: string,\n\tfilePath: string,\n\tpluginConfig: PluginConfig,\n\tlogger: Logger,\n) {\n\tconst resolvedFilePath = path.resolve(filePath)\n\tconst directoryPath = path.dirname(resolvedFilePath)\n\tlet subscription = subscriptionsByDir.get(directoryPath)\n\n\tif (process.env.NODE_ENV !== 'production') {\n\t\t// Parcel watches directories, so remember the exact file inputs we care about\n\t\twatchedFiles.set(resolvedFilePath, { pluginConfig, logger })\n\n\t\tif (!subscription) {\n\t\t\t// one subscription per directory is enough; the callback filters back down to watched files\n\t\t\tsubscription = watcher.subscribe(directoryPath, async (err, events) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tlogger.error(`failed to update types from ${directoryPath}`, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Parcel can report unrelated files from the same directory, so ignore anything unregistered\n\t\t\t\tfor (const event of events) {\n\t\t\t\t\tconst eventFilePath = path.resolve(event.path)\n\t\t\t\t\tif (!watchedFiles.has(eventFilePath)) continue\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait rebuildFile(eventFilePath, event.type)\n\t\t\t\t\t} catch (watchErr) {\n\t\t\t\t\t\tlogger.error(`failed to update types from ${eventFilePath}`, watchErr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tsubscriptionsByDir.set(directoryPath, subscription)\n\t\t}\n\t}\n\n\tconst result = collect(source, filePath, pluginConfig)\n\n\tif (result.tags.size > 0) {\n\t\ttagsByFile.set(filePath, result.tags)\n\t} else {\n\t\ttagsByFile.delete(filePath)\n\t}\n\n\tvoid writeTypes(flattenTags(tagsByFile))\n\n\treturn result\n}\n\n/**\n * Close all active Parcel subscriptions before the process exits\n */\nasync function cleanup() {\n\tawait Promise.all(\n\t\t[...subscriptionsByDir].map(async ([directoryPath, subPromise]) => {\n\t\t\tsubscriptionsByDir.delete(directoryPath)\n\t\t\tawait (await subPromise).unsubscribe()\n\t\t}),\n\t)\n\n\tsubscriptionsByDir.clear()\n}\n\nprocess.once('SIGINT', () => {\n\tcleanup().finally(() => process.exit(130))\n})\n\nprocess.once('SIGTERM', () => {\n\tcleanup().finally(() => process.exit(143))\n})\n\nexport async function withCxx(\n\tnextConfig: NextConfig = {},\n\tpluginConfig: PluginConfig = {},\n) {\n\tconst TURBOPACK_GLOB = '*.{tsx,jsx,ts,js}'\n\n\tconst loaderItem = {\n\t\tloader,\n\t\toptions: {\n\t\t\tpluginConfig,\n\t\t},\n\t}\n\n\tconst currentRule = nextConfig.turbopack?.rules?.[TURBOPACK_GLOB]\n\n\treturn {\n\t\t...nextConfig,\n\t\tturbopack: {\n\t\t\t...nextConfig.turbopack,\n\t\t\trules: {\n\t\t\t\t...nextConfig.turbopack?.rules,\n\t\t\t\t[TURBOPACK_GLOB]: Array.isArray(currentRule)\n\t\t\t\t\t? [...currentRule, loaderItem]\n\t\t\t\t\t: currentRule\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t...currentRule,\n\t\t\t\t\t\t\t\tloaders: [...(currentRule.loaders ?? []), loaderItem],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: { loaders: [loaderItem] },\n\t\t\t},\n\t\t},\n\t}\n}\n"
10
10
  ],
11
- "mappings": ";AAAA;AACA;AACA;AAEA;;;ACJO,IAAM,OAAO;AACb,IAAM,WAAW,WAA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EvB,MAAM,aAAa;AAAA,IAClB;AAAA,IACA,SAAS;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM,cAAc,WAAW,WAAW,QAAQ;AAAA,EAElD,OAAO;AAAA,OACH;AAAA,IACH,WAAW;AAAA,SACP,WAAW;AAAA,MACd,OAAO;AAAA,WACH,WAAW,WAAW;AAAA,SACxB,iBAAiB,MAAM,QAAQ,WAAW,IACxC,CAAC,GAAG,aAAa,UAAU,IAC3B,cACC;AAAA,aACG;AAAA,UACH,SAAS,CAAC,GAAI,YAAY,WAAW,CAAC,GAAI,UAAU;AAAA,QACrD,IACC,EAAE,SAAS,CAAC,UAAU,EAAE;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AAAA;",
12
+ "debugId": "9A17D8885429CB9164756E2164756E21",
13
13
  "names": []
14
14
  }
@@ -181,7 +181,6 @@ var cxx = Object.assign((_) => ["", {}, ""], {
181
181
  ""
182
182
  ]
183
183
  });
184
- var css = cxx;
185
184
 
186
185
  // src/vite/index.ts
187
186
  import { realpathSync } from "node:fs";
@@ -377,4 +376,4 @@ export {
377
376
  cxx2 as default
378
377
  };
379
378
 
380
- //# debugId=9CEC5805EA61D63264756E2164756E21
379
+ //# debugId=1D46DAA8A3CB5F1264756E2164756E21
@@ -2,14 +2,14 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/config.ts", "../src/lru.ts", "../src/utils.ts", "../src/vite/index.ts", "../src/logger.ts"],
4
4
  "sourcesContent": [
5
- "import { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\n\nimport type { BuildContext, Cxx, PluginConfig, Result, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\n/**\n * LRU cache of `collect` results by file id and last seen source so watcher and transform can\n * reuse the same parsed template/tags\n */\nconst collectCache = new LruCache<{ source: string; template: string; tags: Tags }>()\n\n/**\n * LRU cache for file content. Stores the last written content per file path so `maybeWrite`\n * can skip disk i/o when nothing has changed\n */\nconst fileCache = new LruCache<string>()\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = fileCache.get(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tfileCache.set(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tfileCache.set(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tfileCache.set(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1-3 assigned variable names, 4 plain css body, 5 quote\n// kind, 6 tag name, 7 tagged css body\nconst regex =\n\t/(?:const|var|let)\\s*\\[(\\w+|)\\s*,?\\s*(\\w+|)\\s*,?\\s*(\\w+|)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\5\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\n/**\n * Hash transformed CSS into a stable href for style deduplication\n */\nfunction hashCss(code: Uint8Array) {\n\treturn `cxx-${createHash('sha256').update(code).digest('base64url').slice(0, 12)}`\n}\n\nexport class TagDuplicateError extends Error {\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\n/**\n * Transform `cxx` templates in one source file and collect any exported tag types\n */\nexport function collect(source: string, id: string, config: PluginConfig) {\n\tconst tags: Tags = new Map()\n\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source) return cached\n\n\tconst template = source.replace(\n\t\tregex,\n\t\t(_match, varOne, varTwo, varThree, plainCss, _quote, tag, taggedCss) => {\n\t\t\tconst css = plainCss ?? taggedCss\n\n\t\t\tconst { code, exports = {} } = transform({\n\t\t\t\tminify: true,\n\t\t\t\tcssModules: true,\n\t\t\t\tfilename: id,\n\t\t\t\tcode: new TextEncoder().encode(css),\n\t\t\t})\n\n\t\t\tconst href = hashCss(code)\n\t\t\tconst styles = Object.fromEntries(\n\t\t\t\tObject.entries(exports).map(([k, v]) => [k, v.name]),\n\t\t\t)\n\n\t\t\tif (tag) {\n\t\t\t\tconst suffix =\n\t\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t: 'Classes'\n\t\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\t\tif (tags.has(tagWithSuffix)) throw new TagDuplicateError(tagWithSuffix)\n\n\t\t\t\t// side effect but neccessary\n\t\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tvarOne && `const ${varOne} = \\`${code}\\``,\n\t\t\t\tvarTwo && `const ${varTwo} = ${JSON.stringify(styles)}`,\n\t\t\t\tvarThree && `const ${varThree} = \\`${href}\\``,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join('\\n')\n\t\t},\n\t)\n\n\t// cache\n\tcollectCache.set(id, { source, template, tags })\n\n\treturn {\n\t\ttemplate,\n\t\ttags,\n\t}\n}\n\n/**\n * Write the generated declaration file for the current set of collected tags\n */\nexport async function writeTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\ttry {\n\t\t\tawait fs.rm(filePath, { force: true })\n\t\t\tfileCache.delete(filePath)\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t}\n\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\n\tawait maybeWrite(\n\t\tfilePath,\n\t\t`${AUTOGEN_MSG}\n\n\t\t\timport '${PKG_NAME}'\n\n\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t${tagsToType(tags)}\n\t\t\t}\n\t\t`,\n\t)\n}\n\n/**\n * Render collected tags as a module augmentation for the package entrypoint\n */\nexport function tagsToType(tags: Tags) {\n\treturn [...tags]\n\t\t.map(\n\t\t\t([tag, classes]) => `\n\t\texport type ${tag} = ${\n\t\t\tclasses.length > 0\n\t\t\t\t? classes\n\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t.join(' | ')\n\t\t\t\t: 'never'\n\t\t}\n\t`,\n\t\t)\n\t\t.join('\\n')\n}\n\n/**\n * Merge per-file tag maps into one application-wide tag map\n */\nexport function flattenTags(tagsByFile: BuildContext['tagsByFile']) {\n\tconst tags = new Map<string, string[]>()\n\n\tfor (const fileTags of tagsByFile.values()) {\n\t\tfor (const [name, classes] of fileTags) {\n\t\t\tif (tags.has(name)) throw new TagDuplicateError(name)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn tags\n}\n\n/**\n * Build-time template tag placeholder used by the transform to emit CSS, classes and href values\n */\nexport const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['', {}, ''], {\n\ttag:\n\t\t<ClassName extends string = string>(_: string) =>\n\t\t(_strings: TemplateStringsArray): Result<ClassName> => [\n\t\t\t'',\n\t\t\t{} as Readonly<Record<ClassName, string>>,\n\t\t\t'',\n\t\t],\n})\n\nexport const css = cxx\n",
5
+ "import { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\n\nimport type { BuildContext, Cxx, PluginConfig, Result, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\n/**\n * LRU cache of `collect` results by file id and last seen source so watcher and transform can\n * reuse the same parsed template/tags\n */\nconst collectCache = new LruCache<{ source: string; template: string; tags: Tags }>()\n\n/**\n * LRU cache for file content. Stores the last written content per file path so `maybeWrite`\n * can skip disk i/o when nothing has changed\n */\nconst fileCache = new LruCache<string>()\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = fileCache.get(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tfileCache.set(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tfileCache.set(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tfileCache.set(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1-3 assigned variable names, 4 plain css body, 5 quote\n// kind, 6 tag name, 7 tagged css body\nconst regex =\n\t/(?:const|var|let)\\s*\\[(\\w+|)\\s*,?\\s*(\\w+|)\\s*,?\\s*(\\w+|)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\5\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\n/**\n * Hash transformed CSS into a stable href for style deduplication\n */\nfunction hashCss(code: Uint8Array) {\n\treturn `cxx-${createHash('sha256').update(code).digest('base64url').slice(0, 12)}`\n}\n\nexport class TagDuplicateError extends Error {\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\n/**\n * Transform `cxx` templates in one source file and collect any exported tag types\n */\nexport function collect(source: string, id: string, config: PluginConfig) {\n\tconst tags: Tags = new Map()\n\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source) return cached\n\n\tconst template = source.replace(\n\t\tregex,\n\t\t(_match, varOne, varTwo, varThree, plainCss, _quote, tag, taggedCss) => {\n\t\t\tconst css = plainCss ?? taggedCss\n\n\t\t\tconst { code, exports = {} } = transform({\n\t\t\t\tminify: true,\n\t\t\t\tcssModules: true,\n\t\t\t\tfilename: id,\n\t\t\t\tcode: new TextEncoder().encode(css),\n\t\t\t})\n\n\t\t\tconst href = hashCss(code)\n\t\t\tconst styles = Object.fromEntries(\n\t\t\t\tObject.entries(exports).map(([k, v]) => [k, v.name]),\n\t\t\t)\n\n\t\t\tif (tag) {\n\t\t\t\tconst suffix =\n\t\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t: 'Classes'\n\t\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\t\tif (tags.has(tagWithSuffix)) throw new TagDuplicateError(tagWithSuffix)\n\n\t\t\t\t// side effect but neccessary\n\t\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tvarOne && `const ${varOne} = \\`${code}\\``,\n\t\t\t\tvarTwo && `const ${varTwo} = ${JSON.stringify(styles)}`,\n\t\t\t\tvarThree && `const ${varThree} = \\`${href}\\``,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join('\\n')\n\t\t},\n\t)\n\n\t// cache\n\tcollectCache.set(id, { source, template, tags })\n\n\treturn {\n\t\ttemplate,\n\t\ttags,\n\t}\n}\n\n/**\n * Write the generated declaration file for the current set of collected tags\n */\nexport async function writeTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\ttry {\n\t\t\tawait fs.rm(filePath, { force: true })\n\t\t\tfileCache.delete(filePath)\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t}\n\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\n\tawait maybeWrite(\n\t\tfilePath,\n\t\t`${AUTOGEN_MSG}\n\n\t\t\timport '${PKG_NAME}'\n\n\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t${tagsToType(tags)}\n\t\t\t}\n\t\t`,\n\t)\n}\n\n/**\n * Render collected tags as a module augmentation for the package entrypoint\n */\nexport function tagsToType(tags: Tags) {\n\treturn [...tags]\n\t\t.map(\n\t\t\t([tag, classes]) => `\n\t\texport type ${tag} = ${\n\t\t\tclasses.length > 0\n\t\t\t\t? classes\n\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t.join(' | ')\n\t\t\t\t: 'never'\n\t\t}\n\t`,\n\t\t)\n\t\t.join('\\n')\n}\n\n/**\n * Merge per-file tag maps into one application-wide tag map\n */\nexport function flattenTags(tagsByFile: BuildContext['tagsByFile']) {\n\tconst tags = new Map<string, string[]>()\n\n\tfor (const fileTags of tagsByFile.values()) {\n\t\tfor (const [name, classes] of fileTags) {\n\t\t\tif (tags.has(name)) throw new TagDuplicateError(name)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn tags\n}\n\n/**\n * Build-time template tag placeholder used by the transform to emit CSS, classes and href values\n */\nexport const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['', {}, ''], {\n\ttag:\n\t\t<ClassName extends string = string>(_: string) =>\n\t\t(_strings: TemplateStringsArray): Result<ClassName> => [\n\t\t\t'',\n\t\t\t{} as Readonly<Record<ClassName, string>>,\n\t\t\t'',\n\t\t],\n})\n",
6
6
  "export const NAME = 'cxx'\nexport const PKG_NAME = `@jk2908/${NAME}`\nexport const GENERATED_DIR = `.${NAME}`\nexport const AUTOGEN_MSG = `// auto-generated by ${NAME}`\n",
7
7
  "export const CACHE_MAX_SIZE = 100\n\nexport class LruCache<T> {\n\t#cache: Map<string, T> = new Map()\n\t#maxSize: number\n\n\tconstructor(maxSize = CACHE_MAX_SIZE) {\n\t\tthis.#maxSize = maxSize\n\t}\n\n\tget size() {\n\t\treturn this.#cache.size\n\t}\n\n\t/**\n\t * Retrieve a cached value and promote it to most-recently-used so it won't\n\t * be evicted while still actively referenced\n\t */\n\tget(key: string) {\n\t\tconst cached = this.#cache.get(key)\n\t\tif (this.#cache.has(key)) this.set(key, cached as T)\n\n\t\treturn cached\n\t}\n\n\t/**\n\t * Promote an existing cache entry to most-recently-used by deleting and\n\t * re-inserting it, which moves it to the end of the Map's iteration\n\t * order. If the cache is at capacity, evict the least recently used\n\t * entry (front) before inserting\n\t */\n\tset(key: string, value: T) {\n\t\t// drop any existing entry\n\t\tthis.#cache.delete(key)\n\n\t\tif (this.#cache.size >= this.#maxSize) {\n\t\t\tconst lru = this.#cache.keys().next().value\n\t\t\tif (lru !== undefined) this.#cache.delete(lru)\n\t\t}\n\n\t\tthis.#cache.set(key, value)\n\t}\n\n\tdelete(key: string) {\n\t\treturn this.#cache.delete(key)\n\t}\n\n\tclear() {\n\t\treturn this.#cache.clear()\n\t}\n}\n",
8
8
  "export function capitalise(str: string) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport function pascalise(str: string) {\n\treturn str\n\t\t.split(/[ _-]+/)\n\t\t.map(capitalise)\n\t\t.join('')\n}\n\nexport function debounce<T extends unknown[]>(fn: (...args: T) => void, wait: number) {\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\treturn (...args: T) => {\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\n\t\ttimeoutId = setTimeout(() => {\n\t\t\tfn.apply(null, args)\n\t\t}, wait)\n\t}\n}\n",
9
9
  "import { realpathSync } from 'node:fs'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { type Plugin, type ViteDevServer } from 'vite'\n\nimport type { BuildContext, PluginConfig } from '../types.js'\nimport { GENERATED_DIR } from '../config.js'\nimport { collect, flattenTags, isENOENT, writeTypes } from '../index.js'\nimport { Logger } from '../logger.js'\nimport { debounce } from '../utils.js'\n\nconst ACCEPTED_EXTENSIONS = new Set(['.js', '.jsx', '.ts', '.tsx'])\n\nfunction normaliseWatchPath(p: string) {\n\treturn p.replace(/\\\\/g, '/')\n}\n\nexport default function cxx(pluginConfig: PluginConfig = {}) {\n\tconst buildContext = {\n\t\ttagsByFile: new Map(),\n\t} satisfies BuildContext\n\n\tconst logger = new Logger(\n\t\t(pluginConfig?.logger?.level ?? process.env.NODE_ENV === 'production')\n\t\t\t? 'error'\n\t\t\t: 'debug',\n\t)\n\n\t// write generated files into a hidden folder at the project root\n\t// keep the generated surface out of src\n\tconst watchRoot = normaliseWatchPath(realpathSync.native(process.cwd()))\n\tconst watchedRoots = [`${watchRoot}/`]\n\n\tlet rebuildRunning = false\n\tlet rebuildQueued = false\n\n\t// watcher events can arrive through symlinked paths like /var while cwd has\n\t// already resolved to /private/var, so canonicalise the parent dir once and\n\t// reattach the file name for stable prefix checks\n\tfunction resolveWatchFile(filePath: string) {\n\t\tconst absolutePath = path.resolve(watchRoot, filePath)\n\t\tconst parentPath = path.dirname(absolutePath)\n\n\t\ttry {\n\t\t\tconst resolvedParentPath = normaliseWatchPath(realpathSync.native(parentPath))\n\n\t\t\treturn normaliseWatchPath(\n\t\t\t\tpath.join(resolvedParentPath, path.basename(absolutePath)),\n\t\t\t)\n\t\t} catch {\n\t\t\treturn normaliseWatchPath(absolutePath)\n\t\t}\n\t}\n\n\tfunction watchedFile(filePath: string) {\n\t\tconst resolvedPath = resolveWatchFile(filePath)\n\n\t\treturn (\n\t\t\twatchedRoots.some(root => resolvedPath.startsWith(root)) &&\n\t\t\t!resolvedPath.includes(`/${GENERATED_DIR}/`) &&\n\t\t\tACCEPTED_EXTENSIONS.has(path.extname(resolvedPath))\n\t\t)\n\t}\n\n\tconst rebuild = debounce((event: 'add' | 'change' | 'unlink', filePath: string) => {\n\t\tfunction queue() {\n\t\t\tvoid (async () => {\n\t\t\t\t// collapse bursts of file events into one active rebuild plus a single\n\t\t\t\t// queued rerun when changes land mid-build\n\t\t\t\tif (rebuildRunning) {\n\t\t\t\t\trebuildQueued = true\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\trebuildRunning = true\n\n\t\t\t\tdo {\n\t\t\t\t\trebuildQueued = false\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst hadTags = buildContext.tagsByFile.has(file)\n\t\t\t\t\t\tlet hasTags = false\n\n\t\t\t\t\t\tif (event === 'unlink') {\n\t\t\t\t\t\t\tbuildContext.tagsByFile.delete(file)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst source = await fs.readFile(file, 'utf-8')\n\t\t\t\t\t\t\tconst { tags } = collect(source, file, pluginConfig)\n\n\t\t\t\t\t\t\thasTags = tags.size > 0\n\n\t\t\t\t\t\t\tif (hasTags) {\n\t\t\t\t\t\t\t\tbuildContext.tagsByFile.set(file, tags)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbuildContext.tagsByFile.delete(file)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!hadTags && !hasTags) continue\n\n\t\t\t\t\t\tawait writeTypes(flattenTags(buildContext.tagsByFile))\n\t\t\t\t\t\tlogger.info(`updated types from ${file}`)\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tif (isENOENT(err)) {\n\t\t\t\t\t\t\tif (!buildContext.tagsByFile.has(file)) continue\n\n\t\t\t\t\t\t\tbuildContext.tagsByFile.delete(file)\n\t\t\t\t\t\t\tawait writeTypes(flattenTags(buildContext.tagsByFile))\n\n\t\t\t\t\t\t\tlogger.info(`updated types from ${file}`)\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlogger.error(`failed to update types from ${file}`, err)\n\t\t\t\t\t}\n\t\t\t\t} while (rebuildQueued)\n\n\t\t\t\trebuildRunning = false\n\t\t\t})()\n\t\t}\n\n\t\t// ignore anything outside the watched content dirs\n\t\tif (!watchedFile(filePath)) return\n\n\t\tconst file = resolveWatchFile(filePath)\n\t\tqueue()\n\t}, 75)\n\n\treturn {\n\t\tname: 'cxx',\n\t\tenforce: 'pre',\n\t\ttransform(code, id) {\n\t\t\tconst { template, tags } = collect(code, id, pluginConfig)\n\n\t\t\tif (tags.size) buildContext.tagsByFile.set(id, tags)\n\n\t\t\treturn {\n\t\t\t\tcode: template,\n\t\t\t\tmap: null,\n\t\t\t}\n\t\t},\n\t\tconfigureServer(server: ViteDevServer) {\n\t\t\tlogger.info('Watching for changes...')\n\n\t\t\tserver.watcher\n\t\t\t\t.on('add', (p: string) => rebuild('add', p))\n\t\t\t\t.on('change', (p: string) => rebuild('change', p))\n\t\t\t\t.on('unlink', (p: string) => rebuild('unlink', p))\n\t\t},\n\t\tasync writeBundle() {\n\t\t\tawait writeTypes(flattenTags(buildContext.tagsByFile))\n\t\t},\n\t} satisfies Plugin\n}\n",
10
10
  "const LEVELS = {\n\tdebug: 0,\n\tinfo: 1,\n\twarn: 2,\n\terror: 3,\n\tfatal: 4,\n} as const\n\nexport type LogLevel = keyof typeof LEVELS\n\ntype LogEntry = {\n\tts: number\n\tlevel: LogLevel\n\tmessage: string\n\terror?:\n\t\t| Error\n\t\t| {\n\t\t\t\tmessage: string\n\t\t\t\tstack?: string\n\t\t\t\tcause?: unknown\n\t\t }\n}\n\n/**\n * Log messages with different severity levels\n */\nexport class Logger {\n\tstatic #defaultLevel: LogLevel = 'info'\n\n\t#level?: LogLevel\n\n\tconstructor(\n\t\tlevel?: LogLevel,\n\t\tpublic name?: string,\n\t) {\n\t\tthis.#level = level\n\t}\n\n\tstatic set defaultLevel(level: LogLevel) {\n\t\tLogger.#defaultLevel = level\n\t}\n\n\tstatic get defaultLevel() {\n\t\treturn Logger.#defaultLevel\n\t}\n\n\t/**\n\t * Convert a value to an Error instance\n\t */\n\tstatic toError(err: unknown) {\n\t\treturn err instanceof Error ? err : new Error(String(err), { cause: err })\n\t}\n\n\t/**\n\t * Stringify the error for logging\n\t */\n\tstatic print(err: unknown) {\n\t\tif (err instanceof Error) {\n\t\t\treturn err.message + (err.stack ? `\\n${err.stack}` : '')\n\t\t}\n\n\t\t// for plain objects, attempt to stringify with indentation\n\t\t// for readability\n\t\tif (typeof err === 'object' && err !== null) {\n\t\t\ttry {\n\t\t\t\treturn JSON.stringify(err, null, 2)\n\t\t\t} catch {\n\t\t\t\t// if stringify fails (e.g. circular reference), fall back\n\t\t\t\t// to basic string conversion\n\t\t\t\treturn String(err)\n\t\t\t}\n\t\t}\n\n\t\treturn String(err)\n\t}\n\n\tset level(level: LogLevel) {\n\t\tthis.#level = level\n\t}\n\n\tget level() {\n\t\treturn this.#level ?? Logger.#defaultLevel\n\t}\n\n\t/**\n\t * Log a message with a specific level\n\t */\n\tlog(level: LogLevel, message: string, error?: Error) {\n\t\tif (LEVELS[level] < LEVELS[this.level]) return\n\n\t\tconst entry: LogEntry = {\n\t\t\tts: Date.now(),\n\t\t\tlevel,\n\t\t\tmessage,\n\t\t}\n\n\t\tif (level === 'error' || level === 'fatal') {\n\t\t\tentry.error = error ? Logger.toError(error) : new Error(message)\n\t\t}\n\n\t\tconst line = `${this.name ? `[${this.name}]` : ''} [${entry.ts}] [${level.toUpperCase()}] ${message}`\n\t\tconst extra = entry.error ? `\\n${Logger.print(entry.error)}` : ''\n\n\t\tif (level === 'warn') {\n\t\t\tconsole.warn(line, extra)\n\t\t\treturn\n\t\t}\n\n\t\tif (level === 'error' || level === 'fatal') {\n\t\t\tconsole.error(line, extra)\n\t\t\treturn\n\t\t}\n\n\t\tconsole.log(line, extra)\n\t}\n\n\t/**\n\t * Log a debug message\n\t */\n\tdebug(...messages: string[]) {\n\t\tthis.log('debug', messages.join(' '))\n\t}\n\n\t/**\n\t * Log an info message\n\t */\n\tinfo(...messages: string[]) {\n\t\tthis.log('info', messages.join(' '))\n\t}\n\n\t/**\n\t * Log a warning message\n\t */\n\twarn(...messages: string[]) {\n\t\tthis.log('warn', messages.join(' '))\n\t}\n\n\t/**\n\t * Log an error message\n\t */\n\terror(message: string, error?: unknown) {\n\t\tthis.log('error', message, error === undefined ? undefined : Logger.toError(error))\n\t}\n\n\t/**\n\t * Log a fatal error message\n\t */\n\tfatal(message: string, error?: unknown) {\n\t\tthis.log('fatal', message, error === undefined ? undefined : Logger.toError(error))\n\t}\n}\n"
11
11
  ],
12
- "mappings": ";AAAA;AACA;AACA;AAEA;;;ACJO,IAAM,OAAO;AACb,IAAM,WAAW,WAAW;AAC5B,IAAM,gBAAgB,IAAI;AAC1B,IAAM,cAAc,wBAAwB;;;ACH5C,IAAM,iBAAiB;AAAA;AAEvB,MAAM,SAAY;AAAA,EACxB,SAAyB,IAAI;AAAA,EAC7B;AAAA,EAEA,WAAW,CAAC,UAAU,gBAAgB;AAAA,IACrC,KAAK,WAAW;AAAA;AAAA,MAGb,IAAI,GAAG;AAAA,IACV,OAAO,KAAK,OAAO;AAAA;AAAA,EAOpB,GAAG,CAAC,KAAa;AAAA,IAChB,MAAM,SAAS,KAAK,OAAO,IAAI,GAAG;AAAA,IAClC,IAAI,KAAK,OAAO,IAAI,GAAG;AAAA,MAAG,KAAK,IAAI,KAAK,MAAW;AAAA,IAEnD,OAAO;AAAA;AAAA,EASR,GAAG,CAAC,KAAa,OAAU;AAAA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,OAAO,CAAC,MAAc,QAAQ,OAAO,CAAC,CAAC,EAC1C,GAAG,UAAU,CAAC,MAAc,QAAQ,UAAU,CAAC,CAAC,EAChD,GAAG,UAAU,CAAC,MAAc,QAAQ,UAAU,CAAC,CAAC;AAAA;AAAA,SAE7C,YAAW,GAAG;AAAA,MACnB,MAAM,WAAW,YAAY,aAAa,UAAU,CAAC;AAAA;AAAA,EAEvD;AAAA;",
13
+ "debugId": "1D46DAA8A3CB5F1264756E2164756E21",
14
14
  "names": []
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jk2908/cxx",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "author": "Jerome Kenway",
6
6
  "repository": {
@@ -44,7 +44,7 @@
44
44
  "types": "./dist/next/index.d.ts",
45
45
  "default": "./dist/next/index.js"
46
46
  },
47
- "./vite-plugin-cxx": {
47
+ "./vite": {
48
48
  "types": "./dist/vite/index.d.ts",
49
49
  "default": "./dist/vite/index.js"
50
50
  }
package/src/index.ts CHANGED
@@ -217,5 +217,3 @@ export const cxx: Cxx = Object.assign((_: TemplateStringsArray): Result => ['',
217
217
  '',
218
218
  ],
219
219
  })
220
-
221
- export const css = cxx
package/src/next/index.ts CHANGED
@@ -123,7 +123,7 @@ export function processFile(
123
123
  }
124
124
 
125
125
  /**
126
- * Close all active Parcel subscriptions before the process exits.
126
+ * Close all active Parcel subscriptions before the process exits
127
127
  */
128
128
  async function cleanup() {
129
129
  await Promise.all(