@jk2908/cxx 0.3.6 → 0.4.0
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 +51 -18
- package/dist/build.d.ts +17 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +72 -18
- package/dist/build.js.map +3 -3
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -4
- package/dist/index.js.map +5 -4
- package/dist/next/cxx-loader.cjs +55 -19
- package/dist/next/cxx-loader.cjs.map +4 -4
- package/dist/next/index.d.ts +6 -5
- package/dist/next/index.d.ts.map +1 -1
- package/dist/next/index.js +73 -19
- package/dist/next/index.js.map +4 -4
- package/dist/style.d.ts +6 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/types.d.ts +35 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +77 -22
- package/dist/vite/index.js.map +4 -4
- package/package.json +1 -1
- package/src/build.ts +91 -24
- package/src/index.ts +41 -14
- package/src/next/index.ts +10 -2
- package/src/style.tsx +14 -0
- package/src/types.ts +52 -9
- package/src/vite/index.ts +10 -4
package/README.md
CHANGED
|
@@ -11,34 +11,40 @@ npm install @jk2908/cxx lightningcss react react-dom
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
|
-
import { cxx } from '@jk2908/cxx'
|
|
14
|
+
import { cxx, Style } from '@jk2908/cxx'
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
.
|
|
18
|
-
display: flex;
|
|
16
|
+
const button = cxx.embed`
|
|
17
|
+
.button {
|
|
18
|
+
display: inline-flex;
|
|
19
19
|
gap: 0.75rem;
|
|
20
20
|
}
|
|
21
21
|
`
|
|
22
22
|
|
|
23
|
-
export function
|
|
23
|
+
export function Button() {
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</header>
|
|
25
|
+
<button className={button.styles.button}>
|
|
26
|
+
<Style {...button.styleProps} />
|
|
27
|
+
Click me
|
|
28
|
+
</button>
|
|
30
29
|
)
|
|
31
30
|
}
|
|
32
31
|
```
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
`cxx.embed` and `cxx.extract` are build-time markers. Use the Vite or Next integration so the placeholders are replaced before runtime. String interpolation inside the template is not supported.
|
|
34
|
+
|
|
35
|
+
`cxx.embed` returns `{ styles, styleProps }`:
|
|
36
|
+
|
|
37
|
+
- `styles` is the generated CSS Modules class map.
|
|
38
|
+
- `styleProps` describes the embedded style resource. Pass it to `Style`.
|
|
39
|
+
|
|
40
|
+
`Style` renders a `<style>` element for embedded resources. `styleProps` includes `precedence: 'default'`; pass another value after spreading to override it: `<Style {...button.styleProps} precedence="medium" />`. Other native `<style>` props such as `media` are passed through.
|
|
35
41
|
|
|
36
42
|
Named blocks can opt into generated class-key types:
|
|
37
43
|
|
|
38
44
|
```tsx
|
|
39
|
-
import { cxx, type HeroClasses } from '@jk2908/cxx'
|
|
45
|
+
import { cxx, Style, type HeroClasses } from '@jk2908/cxx'
|
|
40
46
|
|
|
41
|
-
const
|
|
47
|
+
const hero = cxx.embed.tag<HeroClasses>('hero')`
|
|
42
48
|
.hero {
|
|
43
49
|
display: flex;
|
|
44
50
|
}
|
|
@@ -50,21 +56,48 @@ const [css, styles, href] = cxx.tag<HeroClasses>('hero')`
|
|
|
50
56
|
|
|
51
57
|
export function Hero() {
|
|
52
58
|
return (
|
|
53
|
-
<section className={styles.hero}>
|
|
54
|
-
<
|
|
59
|
+
<section className={hero.styles.hero}>
|
|
60
|
+
<Style {...hero.styleProps} />
|
|
61
|
+
<p className={hero.styles.copy}>Type-safe class names.</p>
|
|
55
62
|
</section>
|
|
56
63
|
)
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
// `styles.coppy` is a type error
|
|
66
|
+
// `hero.styles.coppy` is a type error
|
|
60
67
|
```
|
|
61
68
|
|
|
62
|
-
The string passed to `cxx.tag(...)` is turned into the exported type name by appending `typeSuffix` and then normalising the whole result into Pascal Case. With the default suffix, `cxx.tag('hero')` becomes `HeroClasses`, and `cxx.tag('marketing-banner')` becomes `MarketingBannerClasses`. If `typeSuffix` is `false`, those become `Hero` and `MarketingBanner` instead.
|
|
69
|
+
The string passed to `cxx.embed.tag(...)` is turned into the exported type name by appending `typeSuffix` and then normalising the whole result into Pascal Case. With the default suffix, `cxx.embed.tag('hero')` becomes `HeroClasses`, and `cxx.embed.tag('marketing-banner')` becomes `MarketingBannerClasses`. If `typeSuffix` is `false`, those become `Hero` and `MarketingBanner` instead.
|
|
63
70
|
|
|
64
71
|
Generated class-key types are imported from the root package, not a separate generated subpath.
|
|
65
72
|
|
|
66
73
|
Because `.cxx` is generated, it is recommended to add `.cxx` to your `.gitignore`.
|
|
67
74
|
|
|
75
|
+
## Embedded and extracted styles
|
|
76
|
+
|
|
77
|
+
There is no implicit default. Choose how the CSS is delivered:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
const button = cxx.embed`
|
|
81
|
+
.button { color: red; }
|
|
82
|
+
`
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`cxx.embed` keeps the CSS text in the module and renders it as a hoisted `<style>` element through `Style`.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
const button = cxx.extract`
|
|
89
|
+
.button { color: red; }
|
|
90
|
+
`
|
|
91
|
+
|
|
92
|
+
export function Button() {
|
|
93
|
+
return <button className={button.styles.button}>Click me</button>
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`cxx.extract` hands the CSS to the bundler as a stylesheet. It returns only `{ mode: 'extract', styles }`; there is no `styleProps` and no `Style` to render.
|
|
98
|
+
|
|
99
|
+
Both the Vite and Next integrations generate a CSS import next to the source file. The bundler owns the emitted stylesheet, chunk association, preload, and HMR.
|
|
100
|
+
|
|
68
101
|
## Vite
|
|
69
102
|
|
|
70
103
|
```ts
|
|
@@ -111,7 +144,7 @@ See [CHANGELOG.md](./CHANGELOG.md) for release notes.
|
|
|
111
144
|
|
|
112
145
|
## Syntax highlighting
|
|
113
146
|
|
|
114
|
-
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.
|
|
147
|
+
The [`vscode-cxx`](https://github.com/jk2908/cxx/tree/main/packages/vscode-cxx) extension provides syntax highlighting for `cxx.embed.tag()` and `cxx.extract.tag()` tagged template literals in VS Code. See its [README](https://github.com/jk2908/cxx/tree/main/packages/vscode-cxx) for install instructions.
|
|
115
148
|
|
|
116
149
|
## License
|
|
117
150
|
|
package/dist/build.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { type SourceMap } from 'magic-string';
|
|
2
2
|
import type { PluginConfig, Tags } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* LRU cache of `collect` results by file id + last seen source + config so watcher and transform
|
|
5
|
+
* can reuse the same parsed template/tags.
|
|
6
|
+
*/
|
|
7
|
+
export type StyleSheet = {
|
|
8
|
+
hash: string;
|
|
9
|
+
css: string;
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* Returns whether the error was caused by a missing file or directory.
|
|
5
13
|
*/
|
|
@@ -25,8 +33,17 @@ export declare function collect(source: string, id: string, config: PluginConfig
|
|
|
25
33
|
config: string;
|
|
26
34
|
template: string;
|
|
27
35
|
tags: Tags;
|
|
36
|
+
sheets: StyleSheet[];
|
|
28
37
|
map: SourceMap | null;
|
|
29
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Write generated styles next to their source file and return relative import specifiers.
|
|
41
|
+
*/
|
|
42
|
+
export declare function writeStyleSheets(filePath: string, sheets: StyleSheet[]): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Insert style imports after any leading module directive.
|
|
45
|
+
*/
|
|
46
|
+
export declare function injectStyleImports(template: string, imports: string[]): string;
|
|
30
47
|
/**
|
|
31
48
|
* Persist one file's tags to its own partial, then rebuild the shared types soon. Rebuilding is
|
|
32
49
|
* debounced and serialised, so a large build does not re-read every partial per file.
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAQA,OAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,KAAK,EAAwB,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAW1E;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACX,CAAA;AAiBD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,WAEpC;AAqCD;;;GAGG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAUjE;AAkBD,qBAAa,iBAAkB,SAAQ,KAAK;IAC3C,IAAI,SAAsB;gBAEd,GAAG,EAAE,MAAM;CAGvB;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACzC,IAAI,SAAoB;gBAEZ,GAAG,EAAE,MAAM;CAMvB;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY;YA9G/D,MAAM;YACN,MAAM;cACJ,MAAM;UACV,IAAI;YACF,UAAU,EAAE;SACf,SAAS,GAAG,IAAI;EAuMrB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,YAUtE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAWrE;AAsHD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,iBAmB7D;AAgBD;;GAEG;AACH,wBAAgB,UAAU,kBAgBzB;AAED,eAAO,MAAM,iBAAiB,aAA0C,CAAA;AA4BxE;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,iBAanE;AAyBD;;;GAGG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,iBA8BjE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,UAepC"}
|
package/dist/build.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/build.ts
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
4
|
import fs from "node:fs/promises";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import { transform } from "lightningcss";
|
|
@@ -173,10 +174,11 @@ async function maybeWrite(filePath, content) {
|
|
|
173
174
|
await writeFileAtomic(filePath, content);
|
|
174
175
|
return true;
|
|
175
176
|
}
|
|
176
|
-
var regex =
|
|
177
|
+
var regex = /\bcxx\.(embed|extract)(?:\.tag(?:\s*<[^>]+>)?\s*\(\s*(['"])(.*?)\2\s*\))?\s*`([\s\S]*?)`/g;
|
|
177
178
|
var IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
178
179
|
function hashCss(code) {
|
|
179
|
-
|
|
180
|
+
const hash = createHash("sha256").update(code).digest("base64url").slice(0, 12);
|
|
181
|
+
return { href: `cxx-${hash}`, key: hash };
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
class DuplicateTagError extends Error {
|
|
@@ -198,14 +200,15 @@ function collect(source, id, config) {
|
|
|
198
200
|
if (cached?.source === source && cached.config === configKey)
|
|
199
201
|
return cached;
|
|
200
202
|
const tags = new Map;
|
|
203
|
+
const sheets = [];
|
|
201
204
|
const magic = new MagicString(source);
|
|
202
205
|
let matched = false;
|
|
203
206
|
regex.lastIndex = 0;
|
|
204
207
|
let match;
|
|
205
208
|
while (match = regex.exec(source)) {
|
|
206
209
|
matched = true;
|
|
207
|
-
const [,
|
|
208
|
-
const
|
|
210
|
+
const [, rawMode, , tag, css] = match;
|
|
211
|
+
const mode = rawMode === "extract" ? "extract" : "embed";
|
|
209
212
|
const matchIndex = match.index;
|
|
210
213
|
const { code, exports: classExports = {} } = (() => {
|
|
211
214
|
try {
|
|
@@ -221,7 +224,8 @@ function collect(source, id, config) {
|
|
|
221
224
|
throw new Error(`Failed to compile cxx CSS at ${id}:${line}`, { cause: err });
|
|
222
225
|
}
|
|
223
226
|
})();
|
|
224
|
-
const href = hashCss(code);
|
|
227
|
+
const { href, key } = hashCss(code);
|
|
228
|
+
const cssText = decoder.decode(code);
|
|
225
229
|
const styles = Object.fromEntries(Object.entries(classExports).map(([k, v]) => [k, v.name]));
|
|
226
230
|
if (tag) {
|
|
227
231
|
const suffix = typeof config.typeSuffix === "string" ? config.typeSuffix : config.typeSuffix === false ? "" : "Classes";
|
|
@@ -232,25 +236,55 @@ function collect(source, id, config) {
|
|
|
232
236
|
throw new DuplicateTagError(tagWithSuffix);
|
|
233
237
|
tags.set(tagWithSuffix, Object.keys(styles));
|
|
234
238
|
}
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
let replacement;
|
|
240
|
+
if (mode === "extract") {
|
|
241
|
+
sheets.push({ hash: key, css: cssText });
|
|
242
|
+
replacement = `{
|
|
243
|
+
mode: 'extract',
|
|
244
|
+
styles: ${JSON.stringify(styles)}
|
|
245
|
+
}`;
|
|
246
|
+
} else {
|
|
247
|
+
const styleProps = {
|
|
248
|
+
mode: "embed",
|
|
249
|
+
href,
|
|
250
|
+
css: cssText,
|
|
251
|
+
precedence: "default"
|
|
252
|
+
};
|
|
253
|
+
replacement = `{
|
|
254
|
+
mode: 'embed',
|
|
255
|
+
styles: ${JSON.stringify(styles)},
|
|
256
|
+
styleProps: ${JSON.stringify(styleProps)}
|
|
257
|
+
}`;
|
|
244
258
|
}
|
|
245
|
-
magic.overwrite(matchIndex, matchIndex + match[0].length,
|
|
246
|
-
`));
|
|
259
|
+
magic.overwrite(matchIndex, matchIndex + match[0].length, replacement);
|
|
247
260
|
}
|
|
248
261
|
const template = magic.toString();
|
|
249
262
|
const map = matched ? magic.generateMap({ source: id, includeContent: true, hires: true }) : null;
|
|
250
|
-
const result = { source, config: configKey, template, tags, map };
|
|
263
|
+
const result = { source, config: configKey, template, tags, sheets, map };
|
|
251
264
|
collectCache.set(id, result);
|
|
252
265
|
return result;
|
|
253
266
|
}
|
|
267
|
+
function writeStyleSheets(filePath, sheets) {
|
|
268
|
+
if (sheets.length === 0)
|
|
269
|
+
return [];
|
|
270
|
+
const dir = path.join(path.dirname(filePath), ".cxx");
|
|
271
|
+
mkdirSync(dir, { recursive: true });
|
|
272
|
+
return sheets.map((sheet) => {
|
|
273
|
+
writeFileSync(path.join(dir, `${sheet.hash}.css`), sheet.css);
|
|
274
|
+
return `./.cxx/${sheet.hash}.css`;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function injectStyleImports(template, imports) {
|
|
278
|
+
if (imports.length === 0)
|
|
279
|
+
return template;
|
|
280
|
+
const directive = /^(?:\s|\/\/[^\n]*\n|\/\*[\s\S]*?\*\/)*(['"])use (?:client|server)\1;?/.exec(template);
|
|
281
|
+
const at = directive ? directive[0].length : 0;
|
|
282
|
+
const lines = imports.map((specifier) => `import ${JSON.stringify(specifier)};`).join(`
|
|
283
|
+
`);
|
|
284
|
+
return `${template.slice(0, at)}
|
|
285
|
+
${lines}
|
|
286
|
+
${template.slice(at)}`;
|
|
287
|
+
}
|
|
254
288
|
function renderTypes(tags) {
|
|
255
289
|
return [
|
|
256
290
|
AUTOGEN_MSG,
|
|
@@ -385,7 +419,25 @@ async function refreshFile(file, config) {
|
|
|
385
419
|
const tags = source.includes("cxx") ? collect(source, file, config).tags : new Map;
|
|
386
420
|
await writeTypesForFile(file, tags);
|
|
387
421
|
}
|
|
422
|
+
async function sweepTmpFiles() {
|
|
423
|
+
for (const dir of [GENERATED_DIR, PARTIAL_DIR]) {
|
|
424
|
+
let entries;
|
|
425
|
+
try {
|
|
426
|
+
entries = await fs.readdir(dir);
|
|
427
|
+
} catch (err) {
|
|
428
|
+
if (isENOENT(err))
|
|
429
|
+
continue;
|
|
430
|
+
throw err;
|
|
431
|
+
}
|
|
432
|
+
for (const entry of entries) {
|
|
433
|
+
if (entry.endsWith(".tmp")) {
|
|
434
|
+
await fs.rm(path.join(dir, entry), { force: true });
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
388
439
|
async function seedTypes(root, config) {
|
|
440
|
+
await sweepTmpFiles();
|
|
389
441
|
async function scan(dir) {
|
|
390
442
|
let entries;
|
|
391
443
|
try {
|
|
@@ -422,12 +474,14 @@ export {
|
|
|
422
474
|
SOURCE_EXTENSIONS,
|
|
423
475
|
collect,
|
|
424
476
|
flushTypes,
|
|
477
|
+
injectStyleImports,
|
|
425
478
|
isENOENT,
|
|
426
479
|
maybeWrite,
|
|
427
480
|
refreshFile,
|
|
428
481
|
seedTypes,
|
|
429
482
|
tagsToType,
|
|
483
|
+
writeStyleSheets,
|
|
430
484
|
writeTypesForFile
|
|
431
485
|
};
|
|
432
486
|
|
|
433
|
-
//# debugId=
|
|
487
|
+
//# debugId=FCDBA526AA3D2F1864756E2164756E21
|
package/dist/build.js.map
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/build.ts", "../src/config.ts", "../src/logger.ts", "../src/lru.ts", "../src/utils.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import type { Dirent } from 'node:fs'\n\nimport { createHash } from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\nimport MagicString, { type SourceMap } from 'magic-string'\n\nimport type { PluginConfig, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, NAME, PKG_NAME } from './config.js'\nimport { Logger } from './logger.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\nconst logger = new Logger(NAME)\n\nconst decoder = new TextDecoder()\nconst encoder = new TextEncoder()\n\n/**\n * LRU cache of `collect` results by file id + last seen source + config so watcher and transform\n * can reuse the same parsed template/tags.\n */\nconst collectCache = new LruCache<{\n\tsource: string\n\tconfig: string\n\ttemplate: string\n\ttags: Tags\n\tmap: SourceMap | null\n}>()\n\n/**\n * Serialises type file writes inside a single process so overlapping writes can't interleave or\n * land out of order.\n */\nlet writeChain: Promise<void> = Promise.resolve()\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 by writing to a unique temporary file and renaming it into place, so concurrent\n * writers never observe a partial file. The temp file is cleaned up if the rename fails.\n */\nasync function writeFileAtomic(filePath: string, content: string) {\n\tconst tmp = `${filePath}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`\n\n\tawait fs.writeFile(tmp, content)\n\n\ttry {\n\t\tawait fs.rename(tmp, filePath)\n\t} catch (err) {\n\t\tawait fs.rm(tmp, { force: true })\n\t\tthrow err\n\t}\n}\n\n/**\n * Run a write task after all previously queued writes have settled. A rejection doesn't break the\n * chain for later tasks.\n */\nfunction enqueueWrite<T>(task: () => Promise<T>) {\n\t// wait for the previous write to finish, then run this one, even if the previous one failed\n\tconst run = writeChain.then(task, task)\n\n\t// move the queue on to this write, but turn either outcome into success so it never rejects\n\twriteChain = run.then(\n\t\t() => undefined,\n\t\t() => undefined,\n\t)\n\n\t// return the real promise, so the caller still sees this write's value or error\n\treturn run\n}\n\n/**\n * Write a file only if the content differs from what is already on disk, so watchers are not woken\n * by a needless mtime change.\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) return false\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait writeFileAtomic(filePath, content)\n\n\treturn true\n}\n\n// matches `[css, classes, href] = cxx\\`...\\`` and `cxx.tag<T>('name')\\`...\\``\n// capture groups: 1 optional `export `, 2-4 assigned variable names, 5 plain\n// css body, 6 quote kind, 7 tag name, 8 tagged css body\nconst regex =\n\t/((?:export\\s+)?)(?:const|var|let)\\s*\\[(\\w*)\\s*,?\\s*(\\w*)\\s*,?\\s*(\\w*)\\s*\\]\\s*=\\s*cxx(?:\\s*`([\\s\\S]*?)`|\\s*\\.\\s*tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\6\\s*\\)\\s*`([\\s\\S]*?)`)/gm\n\nconst IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/\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 DuplicateTagError extends Error {\n\tname = 'DuplicateTagError'\n\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\nexport class InvalidTagError extends Error {\n\tname = 'InvalidTagError'\n\n\tconstructor(tag: string) {\n\t\tsuper(\n\t\t\t`Tag \"${tag}\" does not map to a valid TypeScript identifier. ` +\n\t\t\t\t`Use letters, numbers, spaces, \"_\" or \"-\"`,\n\t\t)\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 configKey = JSON.stringify(config)\n\n\t// reuse the last result when the source and config are unchanged\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source && cached.config === configKey) return cached\n\n\tconst tags: Tags = new Map()\n\tconst magic = new MagicString(source)\n\n\tlet matched = false\n\n\t// the regex is global, so reset its cursor before scanning\n\tregex.lastIndex = 0\n\n\tlet match: RegExpExecArray | null\n\n\t// walk every cxx template and replace it in place\n\twhile ((match = regex.exec(source))) {\n\t\tmatched = true\n\n\t\t// capture groups: export, three bindings, plain css, (quote), tag, tagged css\n\t\tconst [, exp, varOne, varTwo, varThree, plainCss, , tag, taggedCss] = match\n\t\tconst css = plainCss ?? taggedCss\n\t\tconst matchIndex = match.index\n\n\t\t// compile the CSS to minified CSS Modules, reporting the source line on failure\n\t\tconst { code, exports: classExports = {} } = (() => {\n\t\t\ttry {\n\t\t\t\treturn transform({\n\t\t\t\t\tminify: true,\n\t\t\t\t\tcssModules: true,\n\t\t\t\t\tfilename: id,\n\t\t\t\t\tcode: encoder.encode(css),\n\t\t\t\t})\n\t\t\t} catch (err) {\n\t\t\t\tconst line = source.slice(0, matchIndex).split('\\n').length\n\t\t\t\tthrow new Error(`Failed to compile cxx CSS at ${id}:${line}`, { cause: err })\n\t\t\t}\n\t\t})()\n\n\t\tconst href = hashCss(code)\n\t\t// map each class name to its generated (scoped) name\n\t\tconst styles = Object.fromEntries(\n\t\t\tObject.entries(classExports).map(([k, v]) => [k, v.name]),\n\t\t)\n\n\t\tif (tag) {\n\t\t\tconst suffix =\n\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t? ''\n\t\t\t\t\t\t: 'Classes'\n\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\tif (!IDENTIFIER.test(tagWithSuffix)) throw new InvalidTagError(tag)\n\t\t\tif (tags.has(tagWithSuffix)) throw new DuplicateTagError(tagWithSuffix)\n\n\t\t\t// side effect but necessary\n\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t}\n\n\t\tconst statements: string[] = []\n\n\t\tif (varOne) {\n\t\t\tstatements.push(`${exp}const ${varOne} = ${JSON.stringify(decoder.decode(code))}`)\n\t\t}\n\n\t\tif (varTwo) {\n\t\t\tstatements.push(`${exp}const ${varTwo} = ${JSON.stringify(styles)}`)\n\t\t}\n\n\t\tif (varThree) {\n\t\t\tstatements.push(`${exp}const ${varThree} = ${JSON.stringify(href)}`)\n\t\t}\n\n\t\t// swap the template for the generated declarations, keeping the export keyword\n\t\tmagic.overwrite(matchIndex, matchIndex + match[0].length, statements.join('\\n'))\n\t}\n\n\tconst template = magic.toString()\n\t// only build a map when something was actually rewritten\n\tconst map = matched\n\t\t? magic.generateMap({ source: id, includeContent: true, hires: true })\n\t\t: null\n\tconst result = { source, config: configKey, template, tags, map }\n\n\tcollectCache.set(id, result)\n\n\treturn result\n}\n\n/**\n * Render the generated declaration file contents for a set of collected tags.\n */\nfunction renderTypes(tags: Tags) {\n\treturn [\n\t\tAUTOGEN_MSG,\n\t\t'',\n\t\t`import '${PKG_NAME}'`,\n\t\t'',\n\t\t`declare module '${PKG_NAME}' {`,\n\t\ttagsToType(tags),\n\t\t'}',\n\t\t'',\n\t].join('\\n')\n}\n\n/**\n * Write (or remove) the generated `index.d.ts` for a full tag surface.\n */\nasync function writeRenderedTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\tawait fs.rm(filePath, { force: true })\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\tawait maybeWrite(filePath, renderTypes(tags))\n}\n\nconst PARTIAL_DIR = path.join(GENERATED_DIR, 'tags')\n\n// wait this long after the last file before rebuilding, so a burst of files\n// only re-reads the partials once\nconst REBUILD_WAIT = 100\n\nlet rebuildTimer: ReturnType<typeof setTimeout> | null = null\n\n/**\n * Map a source file to its partial file, named by a hash of the absolute path so each file has\n * exactly one partial.\n */\nfunction partialPath(filePath: string) {\n\treturn path.join(\n\t\tPARTIAL_DIR,\n\t\t`${createHash('sha1').update(filePath).digest('hex')}.json`,\n\t)\n}\n\ntype DuplicateTag = {\n\ttag: string\n\tfiles: string[]\n}\n\n/**\n * Read every per-file partial and merge them into one tag map. Partials whose source file no\n * longer exists are pruned, and duplicate tag names are reported with the files that define them.\n */\nasync function readPartials(): Promise<{ tags: Tags; duplicates: DuplicateTag[] }> {\n\tlet entries: string[]\n\n\ttry {\n\t\tentries = await fs.readdir(PARTIAL_DIR)\n\t} catch (err) {\n\t\tif (isENOENT(err)) return { tags: new Map(), duplicates: [] }\n\t\tthrow err\n\t}\n\n\tconst tags: Tags = new Map()\n\tconst fileByTag = new Map<string, string>()\n\tconst duplicates: DuplicateTag[] = []\n\n\tfor (const entry of entries) {\n\t\tif (!entry.endsWith('.json')) continue\n\n\t\tconst partial = path.join(PARTIAL_DIR, entry)\n\t\tlet parsed: { file: string; tags: Record<string, string[]> }\n\n\t\ttry {\n\t\t\tparsed = JSON.parse(await fs.readFile(partial, 'utf-8'))\n\t\t} catch {\n\t\t\tcontinue\n\t\t}\n\n\t\tlet source: string\n\n\t\ttry {\n\t\t\tsource = await fs.readFile(parsed.file, 'utf-8')\n\t\t} catch {\n\t\t\tawait fs.rm(partial, { force: true })\n\t\t\tcontinue\n\t\t}\n\n\t\t// drop partials for files that no longer use cxx, so their tags do not linger\n\t\tif (!source.includes('cxx')) {\n\t\t\tawait fs.rm(partial, { force: true })\n\t\t\tcontinue\n\t\t}\n\n\t\tfor (const [name, classes] of Object.entries(parsed.tags)) {\n\t\t\tconst existing = fileByTag.get(name)\n\n\t\t\tif (existing) {\n\t\t\t\tduplicates.push({ tag: name, files: [existing, parsed.file] })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfileByTag.set(name, parsed.file)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn { tags, duplicates }\n}\n\n/**\n * Persist one file's tags to its own partial, then rebuild the shared types soon. Rebuilding is\n * debounced and serialised, so a large build does not re-read every partial per file.\n */\nexport function writeTypesForFile(filePath: string, tags: Tags) {\n\treturn enqueueWrite(async () => {\n\t\tawait fs.mkdir(PARTIAL_DIR, { recursive: true })\n\n\t\tconst partial = partialPath(filePath)\n\n\t\tif (!tags.size) {\n\t\t\tawait fs.rm(partial, { force: true })\n\t\t} else {\n\t\t\tawait writeFileAtomic(\n\t\t\t\tpartial,\n\t\t\t\tJSON.stringify({ file: filePath, tags: Object.fromEntries(tags) }),\n\t\t\t)\n\t\t}\n\t})\n\t\t.then(() => scheduleRebuild())\n\t\t.catch(err => {\n\t\t\tlogger.error(`failed to write types for ${filePath}`, err)\n\t\t})\n}\n\n/**\n * Queue a rebuild of `index.d.ts` after a short delay, so a burst of writes only rebuilds once.\n */\nfunction scheduleRebuild() {\n\tif (rebuildTimer) clearTimeout(rebuildTimer)\n\n\trebuildTimer = setTimeout(() => {\n\t\trebuildTimer = null\n\t\tflushTypes().catch(err => {\n\t\t\tlogger.error('failed to generate types', err)\n\t\t})\n\t}, REBUILD_WAIT)\n}\n\n/**\n * Rebuild `index.d.ts` from every partial.\n */\nexport function flushTypes() {\n\tif (rebuildTimer) {\n\t\tclearTimeout(rebuildTimer)\n\t\trebuildTimer = null\n\t}\n\n\treturn enqueueWrite(async () => {\n\t\tconst { tags, duplicates } = await readPartials()\n\t\tawait writeRenderedTypes(tags)\n\n\t\tfor (const duplicate of duplicates) {\n\t\t\tlogger.error(\n\t\t\t\t`Tag \"${duplicate.tag}\" is defined in multiple files: ${duplicate.files.join(', ')}`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nexport const SOURCE_EXTENSIONS = new Set(['.js', '.jsx', '.ts', '.tsx'])\n\n// directories that never contain source we transform\nconst SKIP_DIRS = new Set(['node_modules', 'dist', 'build', 'coverage', 'out'])\n\n/**\n * Run `fn` for every item, with at most `concurrency` calls in flight.\n */\nasync function runWithConcurrency<T>(\n\titems: T[],\n\tconcurrency: number,\n\tfn: (item: T) => Promise<void>,\n) {\n\tlet cursor = 0\n\n\tconst workers = Array.from(\n\t\t{ length: Math.min(concurrency, items.length) },\n\t\tasync () => {\n\t\t\twhile (cursor < items.length) {\n\t\t\t\tconst index = cursor++\n\t\t\t\tawait fn(items[index])\n\t\t\t}\n\t\t},\n\t)\n\n\tawait Promise.all(workers)\n}\n\n/**\n * Read one file, collect its tags, and persist them. A file with no `cxx` usage has its partial\n * removed, so stale tags drop out.\n */\nexport async function refreshFile(file: string, config: PluginConfig) {\n\tlet source: string\n\n\ttry {\n\t\tsource = await fs.readFile(file, 'utf-8')\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t\tawait writeTypesForFile(file, new Map())\n\t\treturn\n\t}\n\n\tconst tags = source.includes('cxx') ? collect(source, file, config).tags : new Map()\n\tawait writeTypesForFile(file, tags)\n}\n\n/**\n * Walk every source file under `root` and seed the type surface, so a fresh checkout (and a build\n * with no edits) has types without waiting for a transform.\n */\nexport async function seedTypes(root: string, config: PluginConfig) {\n\tasync function scan(dir: string) {\n\t\tlet entries: Dirent[]\n\n\t\ttry {\n\t\t\tentries = await fs.readdir(dir, { withFileTypes: true })\n\t\t} catch {\n\t\t\treturn\n\t\t}\n\n\t\tawait runWithConcurrency(entries, 8, async entry => {\n\t\t\tif (entry.name.startsWith('.') || SKIP_DIRS.has(entry.name)) return\n\n\t\t\tconst full = path.join(dir, entry.name)\n\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait scan(full)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!SOURCE_EXTENSIONS.has(path.extname(entry.name))) return\n\n\t\t\tawait refreshFile(full, config)\n\t\t})\n\t}\n\n\tawait scan(root)\n\tawait flushTypes()\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.toSorted(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n\t\t.map(([tag, classes]) => {\n\t\t\tconst union =\n\t\t\t\tclasses.length > 0\n\t\t\t\t\t? classes\n\t\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t\t.join(' | ')\n\t\t\t\t\t: 'never'\n\n\t\t\treturn `\\texport type ${tag} = ${union}`\n\t\t})\n\t\t.join('\\n')\n}\n",
|
|
5
|
+
"import type { Dirent } from 'node:fs'\n\nimport { createHash } from 'node:crypto'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { transform } from 'lightningcss'\nimport MagicString, { type SourceMap } from 'magic-string'\n\nimport type { EmbedStyleDescriptor, PluginConfig, Tags } from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, NAME, PKG_NAME } from './config.js'\nimport { Logger } from './logger.js'\nimport { LruCache } from './lru.js'\nimport { pascalise } from './utils.js'\n\nconst logger = new Logger(NAME)\n\nconst decoder = new TextDecoder()\nconst encoder = new TextEncoder()\n\n/**\n * LRU cache of `collect` results by file id + last seen source + config so watcher and transform\n * can reuse the same parsed template/tags.\n */\nexport type StyleSheet = {\n\thash: string\n\tcss: string\n}\n\nconst collectCache = new LruCache<{\n\tsource: string\n\tconfig: string\n\ttemplate: string\n\ttags: Tags\n\tsheets: StyleSheet[]\n\tmap: SourceMap | null\n}>()\n\n/**\n * Serialises type file writes inside a single process so overlapping writes can't interleave or\n * land out of order.\n */\nlet writeChain: Promise<void> = Promise.resolve()\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 by writing to a unique temporary file and renaming it into place, so concurrent\n * writers never observe a partial file. The temp file is cleaned up if the rename fails.\n */\nasync function writeFileAtomic(filePath: string, content: string) {\n\tconst tmp = `${filePath}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`\n\n\tawait fs.writeFile(tmp, content)\n\n\ttry {\n\t\tawait fs.rename(tmp, filePath)\n\t} catch (err) {\n\t\tawait fs.rm(tmp, { force: true })\n\t\tthrow err\n\t}\n}\n\n/**\n * Run a write task after all previously queued writes have settled. A rejection doesn't break the\n * chain for later tasks.\n */\nfunction enqueueWrite<T>(task: () => Promise<T>) {\n\t// wait for the previous write to finish, then run this one, even if the previous one failed\n\tconst run = writeChain.then(task, task)\n\n\t// move the queue on to this write, but turn either outcome into success so it never rejects\n\twriteChain = run.then(\n\t\t() => undefined,\n\t\t() => undefined,\n\t)\n\n\t// return the real promise, so the caller still sees this write's value or error\n\treturn run\n}\n\n/**\n * Write a file only if the content differs from what is already on disk, so watchers are not woken\n * by a needless mtime change.\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) return false\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait writeFileAtomic(filePath, content)\n\n\treturn true\n}\n\n// matches cxx.embed and cxx.extract, with an optional `.tag('name')`.\n// capture groups: 1 mode, 2 quote kind, 3 tag name, 4 css body\nconst regex =\n\t/\\bcxx\\.(embed|extract)(?:\\.tag(?:\\s*<[^>]+>)?\\s*\\(\\s*(['\"])(.*?)\\2\\s*\\))?\\s*`([\\s\\S]*?)`/g\n\nconst IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/\n\n/**\n * Hash transformed CSS into a stable href and asset key.\n */\nfunction hashCss(code: Uint8Array) {\n\tconst hash = createHash('sha256').update(code).digest('base64url').slice(0, 12)\n\n\treturn { href: `cxx-${hash}`, key: hash }\n}\n\nexport class DuplicateTagError extends Error {\n\tname = 'DuplicateTagError'\n\n\tconstructor(tag: string) {\n\t\tsuper(`Tag ${tag} has already been seen. Tags must be unique across your application`)\n\t}\n}\n\nexport class InvalidTagError extends Error {\n\tname = 'InvalidTagError'\n\n\tconstructor(tag: string) {\n\t\tsuper(\n\t\t\t`Tag \"${tag}\" does not map to a valid TypeScript identifier. ` +\n\t\t\t\t`Use letters, numbers, spaces, \"_\" or \"-\"`,\n\t\t)\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 configKey = JSON.stringify(config)\n\n\t// reuse the last result when the source and config are unchanged\n\tconst cached = collectCache.get(id)\n\tif (cached?.source === source && cached.config === configKey) return cached\n\n\tconst tags: Tags = new Map()\n\tconst sheets: StyleSheet[] = []\n\tconst magic = new MagicString(source)\n\n\tlet matched = false\n\n\t// the regex is global, so reset its cursor before scanning\n\tregex.lastIndex = 0\n\n\tlet match: RegExpExecArray | null\n\n\t// walk every cxx template and replace it in place\n\twhile ((match = regex.exec(source))) {\n\t\tmatched = true\n\n\t\tconst [, rawMode, , tag, css] = match\n\t\tconst mode = rawMode === 'extract' ? 'extract' : 'embed'\n\t\tconst matchIndex = match.index\n\n\t\t// compile the CSS to minified CSS Modules, reporting the source line on failure\n\t\tconst { code, exports: classExports = {} } = (() => {\n\t\t\ttry {\n\t\t\t\treturn transform({\n\t\t\t\t\tminify: true,\n\t\t\t\t\tcssModules: true,\n\t\t\t\t\tfilename: id,\n\t\t\t\t\tcode: encoder.encode(css),\n\t\t\t\t})\n\t\t\t} catch (err) {\n\t\t\t\tconst line = source.slice(0, matchIndex).split('\\n').length\n\t\t\t\tthrow new Error(`Failed to compile cxx CSS at ${id}:${line}`, { cause: err })\n\t\t\t}\n\t\t})()\n\n\t\tconst { href, key } = hashCss(code)\n\t\tconst cssText = decoder.decode(code)\n\n\t\t// map each class name to its generated (scoped) name\n\t\tconst styles = Object.fromEntries(\n\t\t\tObject.entries(classExports).map(([k, v]) => [k, v.name]),\n\t\t)\n\n\t\tif (tag) {\n\t\t\tconst suffix =\n\t\t\t\ttypeof config.typeSuffix === 'string'\n\t\t\t\t\t? config.typeSuffix\n\t\t\t\t\t: config.typeSuffix === false\n\t\t\t\t\t\t? ''\n\t\t\t\t\t\t: 'Classes'\n\t\t\tconst tagWithSuffix = pascalise(`${tag}${suffix}`)\n\n\t\t\tif (!IDENTIFIER.test(tagWithSuffix)) throw new InvalidTagError(tag)\n\t\t\tif (tags.has(tagWithSuffix)) throw new DuplicateTagError(tagWithSuffix)\n\n\t\t\t// side effect but necessary\n\t\t\ttags.set(tagWithSuffix, Object.keys(styles))\n\t\t}\n\n\t\tlet replacement: string\n\n\t\tif (mode === 'extract') {\n\t\t\tsheets.push({ hash: key, css: cssText })\n\t\t\treplacement = `{\\n\\tmode: 'extract',\\n\\tstyles: ${JSON.stringify(styles)}\\n}`\n\t\t} else {\n\t\t\tconst styleProps: EmbedStyleDescriptor = {\n\t\t\t\tmode: 'embed',\n\t\t\t\thref,\n\t\t\t\tcss: cssText,\n\t\t\t\tprecedence: 'default',\n\t\t\t}\n\n\t\t\treplacement = `{\\n\\tmode: 'embed',\\n\\tstyles: ${JSON.stringify(styles)},\\n\\tstyleProps: ${JSON.stringify(styleProps)}\\n}`\n\t\t}\n\n\t\tmagic.overwrite(matchIndex, matchIndex + match[0].length, replacement)\n\t}\n\n\tconst template = magic.toString()\n\t// only build a map when something was actually rewritten\n\tconst map = matched\n\t\t? magic.generateMap({ source: id, includeContent: true, hires: true })\n\t\t: null\n\tconst result = { source, config: configKey, template, tags, sheets, map }\n\n\tcollectCache.set(id, result)\n\n\treturn result\n}\n\n/**\n * Write generated styles next to their source file and return relative import specifiers.\n */\nexport function writeStyleSheets(filePath: string, sheets: StyleSheet[]) {\n\tif (sheets.length === 0) return []\n\n\tconst dir = path.join(path.dirname(filePath), '.cxx')\n\tmkdirSync(dir, { recursive: true })\n\n\treturn sheets.map(sheet => {\n\t\twriteFileSync(path.join(dir, `${sheet.hash}.css`), sheet.css)\n\t\treturn `./.cxx/${sheet.hash}.css`\n\t})\n}\n\n/**\n * Insert style imports after any leading module directive.\n */\nexport function injectStyleImports(template: string, imports: string[]) {\n\tif (imports.length === 0) return template\n\n\tconst directive =\n\t\t/^(?:\\s|\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/)*(['\"])use (?:client|server)\\1;?/.exec(template)\n\tconst at = directive ? directive[0].length : 0\n\tconst lines = imports\n\t\t.map(specifier => `import ${JSON.stringify(specifier)};`)\n\t\t.join('\\n')\n\n\treturn `${template.slice(0, at)}\\n${lines}\\n${template.slice(at)}`\n}\n\n/**\n * Render the generated declaration file contents for a set of collected tags.\n */\nfunction renderTypes(tags: Tags) {\n\treturn [\n\t\tAUTOGEN_MSG,\n\t\t'',\n\t\t`import '${PKG_NAME}'`,\n\t\t'',\n\t\t`declare module '${PKG_NAME}' {`,\n\t\ttagsToType(tags),\n\t\t'}',\n\t\t'',\n\t].join('\\n')\n}\n\n/**\n * Write (or remove) the generated `index.d.ts` for a full tag surface.\n */\nasync function writeRenderedTypes(tags: Tags) {\n\tconst filePath = path.join(GENERATED_DIR, 'index.d.ts')\n\n\tif (!tags.size) {\n\t\tawait fs.rm(filePath, { force: true })\n\t\treturn\n\t}\n\n\tawait fs.mkdir(GENERATED_DIR, { recursive: true })\n\tawait maybeWrite(filePath, renderTypes(tags))\n}\n\nconst PARTIAL_DIR = path.join(GENERATED_DIR, 'tags')\n\n// wait this long after the last file before rebuilding, so a burst of files\n// only re-reads the partials once\nconst REBUILD_WAIT = 100\n\nlet rebuildTimer: ReturnType<typeof setTimeout> | null = null\n\n/**\n * Map a source file to its partial file, named by a hash of the absolute path so each file has\n * exactly one partial.\n */\nfunction partialPath(filePath: string) {\n\treturn path.join(\n\t\tPARTIAL_DIR,\n\t\t`${createHash('sha1').update(filePath).digest('hex')}.json`,\n\t)\n}\n\ntype DuplicateTag = {\n\ttag: string\n\tfiles: string[]\n}\n\n/**\n * Read every per-file partial and merge them into one tag map. Partials whose source file no\n * longer exists are pruned, and duplicate tag names are reported with the files that define them.\n */\nasync function readPartials(): Promise<{ tags: Tags; duplicates: DuplicateTag[] }> {\n\tlet entries: string[]\n\n\ttry {\n\t\tentries = await fs.readdir(PARTIAL_DIR)\n\t} catch (err) {\n\t\tif (isENOENT(err)) return { tags: new Map(), duplicates: [] }\n\t\tthrow err\n\t}\n\n\tconst tags: Tags = new Map()\n\tconst fileByTag = new Map<string, string>()\n\tconst duplicates: DuplicateTag[] = []\n\n\tfor (const entry of entries) {\n\t\tif (!entry.endsWith('.json')) continue\n\n\t\tconst partial = path.join(PARTIAL_DIR, entry)\n\t\tlet parsed: { file: string; tags: Record<string, string[]> }\n\n\t\ttry {\n\t\t\tparsed = JSON.parse(await fs.readFile(partial, 'utf-8'))\n\t\t} catch {\n\t\t\tcontinue\n\t\t}\n\n\t\tlet source: string\n\n\t\ttry {\n\t\t\tsource = await fs.readFile(parsed.file, 'utf-8')\n\t\t} catch {\n\t\t\tawait fs.rm(partial, { force: true })\n\t\t\tcontinue\n\t\t}\n\n\t\t// drop partials for files that no longer use cxx, so their tags do not linger\n\t\tif (!source.includes('cxx')) {\n\t\t\tawait fs.rm(partial, { force: true })\n\t\t\tcontinue\n\t\t}\n\n\t\tfor (const [name, classes] of Object.entries(parsed.tags)) {\n\t\t\tconst existing = fileByTag.get(name)\n\n\t\t\tif (existing) {\n\t\t\t\tduplicates.push({ tag: name, files: [existing, parsed.file] })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfileByTag.set(name, parsed.file)\n\t\t\ttags.set(name, classes)\n\t\t}\n\t}\n\n\treturn { tags, duplicates }\n}\n\n/**\n * Persist one file's tags to its own partial, then rebuild the shared types soon. Rebuilding is\n * debounced and serialised, so a large build does not re-read every partial per file.\n */\nexport function writeTypesForFile(filePath: string, tags: Tags) {\n\treturn enqueueWrite(async () => {\n\t\tawait fs.mkdir(PARTIAL_DIR, { recursive: true })\n\n\t\tconst partial = partialPath(filePath)\n\n\t\tif (!tags.size) {\n\t\t\tawait fs.rm(partial, { force: true })\n\t\t} else {\n\t\t\tawait writeFileAtomic(\n\t\t\t\tpartial,\n\t\t\t\tJSON.stringify({ file: filePath, tags: Object.fromEntries(tags) }),\n\t\t\t)\n\t\t}\n\t})\n\t\t.then(() => scheduleRebuild())\n\t\t.catch(err => {\n\t\t\tlogger.error(`failed to write types for ${filePath}`, err)\n\t\t})\n}\n\n/**\n * Queue a rebuild of `index.d.ts` after a short delay, so a burst of writes only rebuilds once.\n */\nfunction scheduleRebuild() {\n\tif (rebuildTimer) clearTimeout(rebuildTimer)\n\n\trebuildTimer = setTimeout(() => {\n\t\trebuildTimer = null\n\t\tflushTypes().catch(err => {\n\t\t\tlogger.error('failed to generate types', err)\n\t\t})\n\t}, REBUILD_WAIT)\n}\n\n/**\n * Rebuild `index.d.ts` from every partial.\n */\nexport function flushTypes() {\n\tif (rebuildTimer) {\n\t\tclearTimeout(rebuildTimer)\n\t\trebuildTimer = null\n\t}\n\n\treturn enqueueWrite(async () => {\n\t\tconst { tags, duplicates } = await readPartials()\n\t\tawait writeRenderedTypes(tags)\n\n\t\tfor (const duplicate of duplicates) {\n\t\t\tlogger.error(\n\t\t\t\t`Tag \"${duplicate.tag}\" is defined in multiple files: ${duplicate.files.join(', ')}`,\n\t\t\t)\n\t\t}\n\t})\n}\n\nexport const SOURCE_EXTENSIONS = new Set(['.js', '.jsx', '.ts', '.tsx'])\n\n// directories that never contain source we transform\nconst SKIP_DIRS = new Set(['node_modules', 'dist', 'build', 'coverage', 'out'])\n\n/**\n * Run `fn` for every item, with at most `concurrency` calls in flight.\n */\nasync function runWithConcurrency<T>(\n\titems: T[],\n\tconcurrency: number,\n\tfn: (item: T) => Promise<void>,\n) {\n\tlet cursor = 0\n\n\tconst workers = Array.from(\n\t\t{ length: Math.min(concurrency, items.length) },\n\t\tasync () => {\n\t\t\twhile (cursor < items.length) {\n\t\t\t\tconst index = cursor++\n\t\t\t\tawait fn(items[index])\n\t\t\t}\n\t\t},\n\t)\n\n\tawait Promise.all(workers)\n}\n\n/**\n * Read one file, collect its tags, and persist them. A file with no `cxx` usage has its partial\n * removed, so stale tags drop out.\n */\nexport async function refreshFile(file: string, config: PluginConfig) {\n\tlet source: string\n\n\ttry {\n\t\tsource = await fs.readFile(file, 'utf-8')\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t\tawait writeTypesForFile(file, new Map())\n\t\treturn\n\t}\n\n\tconst tags = source.includes('cxx') ? collect(source, file, config).tags : new Map()\n\tawait writeTypesForFile(file, tags)\n}\n\n/**\n * Remove orphaned `.tmp` files left by a write that was killed before its rename. Only the seed\n * does this, because it runs once at startup before any write is in flight.\n */\nasync function sweepTmpFiles() {\n\tfor (const dir of [GENERATED_DIR, PARTIAL_DIR]) {\n\t\tlet entries: string[]\n\n\t\ttry {\n\t\t\tentries = await fs.readdir(dir)\n\t\t} catch (err) {\n\t\t\tif (isENOENT(err)) continue\n\t\t\tthrow err\n\t\t}\n\n\t\tfor (const entry of entries) {\n\t\t\tif (entry.endsWith('.tmp')) {\n\t\t\t\tawait fs.rm(path.join(dir, entry), { force: true })\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Walk every source file under `root` and seed the type surface, so a fresh checkout (and a build\n * with no edits) has types without waiting for a transform.\n */\nexport async function seedTypes(root: string, config: PluginConfig) {\n\tawait sweepTmpFiles()\n\n\tasync function scan(dir: string) {\n\t\tlet entries: Dirent[]\n\n\t\ttry {\n\t\t\tentries = await fs.readdir(dir, { withFileTypes: true })\n\t\t} catch {\n\t\t\treturn\n\t\t}\n\n\t\tawait runWithConcurrency(entries, 8, async entry => {\n\t\t\tif (entry.name.startsWith('.') || SKIP_DIRS.has(entry.name)) return\n\n\t\t\tconst full = path.join(dir, entry.name)\n\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait scan(full)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!SOURCE_EXTENSIONS.has(path.extname(entry.name))) return\n\n\t\t\tawait refreshFile(full, config)\n\t\t})\n\t}\n\n\tawait scan(root)\n\tawait flushTypes()\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.toSorted(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n\t\t.map(([tag, classes]) => {\n\t\t\tconst union =\n\t\t\t\tclasses.length > 0\n\t\t\t\t\t? classes\n\t\t\t\t\t\t\t.toSorted((a, b) => a.length - b.length)\n\t\t\t\t\t\t\t.map(c => `'${c}'`)\n\t\t\t\t\t\t\t.join(' | ')\n\t\t\t\t\t: 'never'\n\n\t\t\treturn `\\texport type ${tag} = ${union}`\n\t\t})\n\t\t.join('\\n')\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
|
"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\nconst defaultLevel: LogLevel = process.env['NODE_ENV'] === 'production' ? 'error' : 'info'\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\t#level: LogLevel = defaultLevel\n\n\tconstructor(public name?: string) {}\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\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",
|
|
8
8
|
"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",
|
|
9
9
|
"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"
|
|
10
10
|
],
|
|
11
|
-
"mappings": ";AAEA;AACA;AACA;AAEA;AACA;;;ACPO,IAAM,OAAO;AACb,IAAM,WAAW,WAAW;AAC5B,IAAM,gBAAgB,IAAI;AAC1B,IAAM,cAAc,wBAAwB;;;ACHnD,IAAM,SAAS;AAAA,EACd,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACR;AAIA,IAAM,eAAyB,QAAQ,IAAI,gBAAgB,eAAe,U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,IAAI;AAAA,QAAG;AAAA,MAE7D,MAAM,OAAO,KAAK,KAAK,KAAK,MAAM,IAAI;AAAA,MAEtC,IAAI,MAAM,YAAY,GAAG;AAAA,QACxB,MAAM,KAAK,IAAI;AAAA,QACf;AAAA,MACD;AAAA,MAEA,IAAI,CAAC,kBAAkB,IAAI,KAAK,QAAQ,MAAM,IAAI,CAAC;AAAA,QAAG;AAAA,MAEtD,MAAM,YAAY,MAAM,MAAM;AAAA,KAC9B;AAAA;AAAA,EAGF,MAAM,KAAK,IAAI;AAAA,EACf,MAAM,WAAW;AAAA;AAMX,SAAS,UAAU,CAAC,MAAY;AAAA,EACtC,OAAO,CAAC,GAAG,IAAI,EACb,SAAS,EAAE,KAAK,OAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAE,EACnD,IAAI,EAAE,KAAK,aAAa;AAAA,IACxB,MAAM,QACL,QAAQ,SAAS,IACd,QACC,SAAS,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,EACtC,IAAI,OAAK,IAAI,IAAI,EACjB,KAAK,KAAK,IACX;AAAA,IAEJ,OAAO,gBAAiB,SAAS;AAAA,GACjC,EACA,KAAK;AAAA,CAAI;AAAA;",
|
|
12
|
+
"debugId": "FCDBA526AA3D2F1864756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Cxx } from './types.js';
|
|
2
|
-
export
|
|
2
|
+
export { Style } from './style.js';
|
|
3
|
+
export type { Cxx, EmbedResult, EmbedStyleDescriptor, EmbedStyleTag, ExtractResult, ExtractStyleTag, Result, StyleMode, StyleProps, } from './types.js';
|
|
3
4
|
/**
|
|
4
|
-
* Build-time template tag
|
|
5
|
+
* Build-time template tag namespace used by the transform to emit class maps
|
|
6
|
+
* and style descriptors.
|
|
5
7
|
*/
|
|
6
8
|
export declare const cxx: Cxx;
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,GAAG,EAKH,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EACX,GAAG,EACH,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,eAAe,EACf,MAAM,EACN,SAAS,EACT,UAAU,GACV,MAAM,YAAY,CAAA;AAoCnB;;;GAGG;AACH,eAAO,MAAM,GAAG,EAAE,GAAwB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
|
+
// src/style.tsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
function Style(props) {
|
|
4
|
+
const { mode: _mode, href, css, precedence, ...rest } = props;
|
|
5
|
+
return /* @__PURE__ */ jsx("style", {
|
|
6
|
+
...rest,
|
|
7
|
+
href,
|
|
8
|
+
precedence,
|
|
9
|
+
children: css
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
1
13
|
// src/index.ts
|
|
2
14
|
function untransformed() {
|
|
3
15
|
throw new Error("cxx template was not transformed. Make sure the cxx Vite plugin or Next integration is configured and applies to this file.");
|
|
4
16
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
17
|
+
function tag(_) {
|
|
18
|
+
return (_strings) => untransformed();
|
|
19
|
+
}
|
|
20
|
+
function embedTag() {
|
|
21
|
+
return Object.assign((_) => untransformed(), { tag });
|
|
22
|
+
}
|
|
23
|
+
function extractTag() {
|
|
24
|
+
return Object.assign((_) => untransformed(), {
|
|
25
|
+
tag
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
var embed = embedTag();
|
|
29
|
+
var extract = extractTag();
|
|
30
|
+
var cxx = { embed, extract };
|
|
8
31
|
export {
|
|
32
|
+
Style,
|
|
9
33
|
cxx
|
|
10
34
|
};
|
|
11
35
|
|
|
12
|
-
//# debugId=
|
|
36
|
+
//# debugId=65740A9C769E035864756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts"],
|
|
3
|
+
"sources": ["../src/style.tsx", "../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import type {
|
|
5
|
+
"import type { StyleProps } from './types.js'\n\n/**\n * Render an embedded style descriptor as a hoisted style element.\n */\nexport function Style(props: StyleProps) {\n\tconst { mode: _mode, href, css, precedence, ...rest } = props\n\n\treturn (\n\t\t<style {...rest} href={href} precedence={precedence}>\n\t\t\t{css}\n\t\t</style>\n\t)\n}\n",
|
|
6
|
+
"import type {\n\tCxx,\n\tEmbedResult,\n\tEmbedStyleTag,\n\tExtractResult,\n\tExtractStyleTag,\n} from './types.js'\n\nexport { Style } from './style.js'\nexport type {\n\tCxx,\n\tEmbedResult,\n\tEmbedStyleDescriptor,\n\tEmbedStyleTag,\n\tExtractResult,\n\tExtractStyleTag,\n\tResult,\n\tStyleMode,\n\tStyleProps,\n} from './types.js'\n\n/**\n * Hit when a `cxx` template reaches runtime, which means the build transform did\n * not run. Throws so the problem is obvious instead of rendering empty styles.\n *\n * @example\n * ```ts\n * // no cxx plugin configured\n * const button = cxx.embed`.a { color: red; }`\n * // error: cxx template was not transformed ...\n * ```\n */\nfunction untransformed(): never {\n\tthrow new Error(\n\t\t'cxx template was not transformed. Make sure the cxx Vite plugin or Next integration is configured and applies to this file.',\n\t)\n}\n\nfunction tag<_ClassName extends string = string>(_: string) {\n\treturn (_strings: TemplateStringsArray): never => untransformed()\n}\n\nfunction embedTag(): EmbedStyleTag {\n\treturn Object.assign((_: TemplateStringsArray): EmbedResult => untransformed(), { tag })\n}\n\nfunction extractTag(): ExtractStyleTag {\n\treturn Object.assign((_: TemplateStringsArray): ExtractResult => untransformed(), {\n\t\ttag,\n\t})\n}\n\nconst embed = embedTag()\nconst extract = extractTag()\n\n/**\n * Build-time template tag namespace used by the transform to emit class maps\n * and style descriptors.\n */\nexport const cxx: Cxx = { embed, extract }\n"
|
|
6
7
|
],
|
|
7
|
-
"mappings": ";
|
|
8
|
-
"debugId": "
|
|
8
|
+
"mappings": ";;AAKO,SAAS,KAAK,CAAC,OAAmB;AAAA,EACxC,QAAQ,MAAM,OAAO,MAAM,KAAK,eAAe,SAAS;AAAA,EAExD,uBACC,IAEE,SAFF;AAAA,OAAW;AAAA,IAAM;AAAA,IAAY;AAAA,IAA7B,UACE;AAAA,GACA;AAAA;;;ACqBJ,SAAS,aAAa,GAAU;AAAA,EAC/B,MAAM,IAAI,MACT,6HACD;AAAA;AAGD,SAAS,GAAuC,CAAC,GAAW;AAAA,EAC3D,OAAO,CAAC,aAA0C,cAAc;AAAA;AAGjE,SAAS,QAAQ,GAAkB;AAAA,EAClC,OAAO,OAAO,OAAO,CAAC,MAAyC,cAAc,GAAG,EAAE,IAAI,CAAC;AAAA;AAGxF,SAAS,UAAU,GAAoB;AAAA,EACtC,OAAO,OAAO,OAAO,CAAC,MAA2C,cAAc,GAAG;AAAA,IACjF;AAAA,EACD,CAAC;AAAA;AAGF,IAAM,QAAQ,SAAS;AACvB,IAAM,UAAU,WAAW;AAMpB,IAAM,MAAW,EAAE,OAAO,QAAQ;",
|
|
9
|
+
"debugId": "65740A9C769E035864756E2164756E21",
|
|
9
10
|
"names": []
|
|
10
11
|
}
|