@tenphi/tasty 0.0.0-snapshot.08a6610
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/LICENSE +21 -0
- package/README.md +666 -0
- package/dist/_virtual/_rolldown/runtime.js +8 -0
- package/dist/chunks/cacheKey.js +70 -0
- package/dist/chunks/cacheKey.js.map +1 -0
- package/dist/chunks/definitions.d.ts +37 -0
- package/dist/chunks/definitions.js +259 -0
- package/dist/chunks/definitions.js.map +1 -0
- package/dist/chunks/renderChunk.js +61 -0
- package/dist/chunks/renderChunk.js.map +1 -0
- package/dist/config.d.ts +311 -0
- package/dist/config.js +458 -0
- package/dist/config.js.map +1 -0
- package/dist/core/index.d.ts +32 -0
- package/dist/core/index.js +26 -0
- package/dist/debug.d.ts +204 -0
- package/dist/debug.js +733 -0
- package/dist/debug.js.map +1 -0
- package/dist/hooks/useGlobalStyles.d.ts +30 -0
- package/dist/hooks/useGlobalStyles.js +83 -0
- package/dist/hooks/useGlobalStyles.js.map +1 -0
- package/dist/hooks/useKeyframes.d.ts +56 -0
- package/dist/hooks/useKeyframes.js +69 -0
- package/dist/hooks/useKeyframes.js.map +1 -0
- package/dist/hooks/useProperty.d.ts +79 -0
- package/dist/hooks/useProperty.js +114 -0
- package/dist/hooks/useProperty.js.map +1 -0
- package/dist/hooks/useRawCSS.d.ts +53 -0
- package/dist/hooks/useRawCSS.js +40 -0
- package/dist/hooks/useRawCSS.js.map +1 -0
- package/dist/hooks/useStyles.d.ts +45 -0
- package/dist/hooks/useStyles.js +248 -0
- package/dist/hooks/useStyles.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +33 -0
- package/dist/injector/index.d.ts +165 -0
- package/dist/injector/index.js +162 -0
- package/dist/injector/index.js.map +1 -0
- package/dist/injector/injector.d.ts +148 -0
- package/dist/injector/injector.js +430 -0
- package/dist/injector/injector.js.map +1 -0
- package/dist/injector/sheet-manager.d.ts +136 -0
- package/dist/injector/sheet-manager.js +729 -0
- package/dist/injector/sheet-manager.js.map +1 -0
- package/dist/injector/types.d.ts +144 -0
- package/dist/keyframes/index.js +206 -0
- package/dist/keyframes/index.js.map +1 -0
- package/dist/parser/classify.js +319 -0
- package/dist/parser/classify.js.map +1 -0
- package/dist/parser/const.js +33 -0
- package/dist/parser/const.js.map +1 -0
- package/dist/parser/lru.js +109 -0
- package/dist/parser/lru.js.map +1 -0
- package/dist/parser/parser.d.ts +25 -0
- package/dist/parser/parser.js +116 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/tokenizer.js +69 -0
- package/dist/parser/tokenizer.js.map +1 -0
- package/dist/parser/types.d.ts +51 -0
- package/dist/parser/types.js +46 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/pipeline/conditions.d.ts +134 -0
- package/dist/pipeline/conditions.js +406 -0
- package/dist/pipeline/conditions.js.map +1 -0
- package/dist/pipeline/exclusive.js +231 -0
- package/dist/pipeline/exclusive.js.map +1 -0
- package/dist/pipeline/index.d.ts +53 -0
- package/dist/pipeline/index.js +660 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/materialize.js +856 -0
- package/dist/pipeline/materialize.js.map +1 -0
- package/dist/pipeline/parseStateKey.d.ts +15 -0
- package/dist/pipeline/parseStateKey.js +451 -0
- package/dist/pipeline/parseStateKey.js.map +1 -0
- package/dist/pipeline/simplify.js +516 -0
- package/dist/pipeline/simplify.js.map +1 -0
- package/dist/pipeline/warnings.js +18 -0
- package/dist/pipeline/warnings.js.map +1 -0
- package/dist/plugins/okhsl-plugin.d.ts +35 -0
- package/dist/plugins/okhsl-plugin.js +371 -0
- package/dist/plugins/okhsl-plugin.js.map +1 -0
- package/dist/plugins/types.d.ts +76 -0
- package/dist/properties/index.js +236 -0
- package/dist/properties/index.js.map +1 -0
- package/dist/properties/property-type-resolver.d.ts +24 -0
- package/dist/properties/property-type-resolver.js +91 -0
- package/dist/properties/property-type-resolver.js.map +1 -0
- package/dist/ssr/astro.d.ts +29 -0
- package/dist/ssr/astro.js +65 -0
- package/dist/ssr/astro.js.map +1 -0
- package/dist/ssr/async-storage.d.ts +17 -0
- package/dist/ssr/async-storage.js +35 -0
- package/dist/ssr/async-storage.js.map +1 -0
- package/dist/ssr/collect-auto-properties.js +40 -0
- package/dist/ssr/collect-auto-properties.js.map +1 -0
- package/dist/ssr/collector.d.ts +85 -0
- package/dist/ssr/collector.js +183 -0
- package/dist/ssr/collector.js.map +1 -0
- package/dist/ssr/context.d.ts +8 -0
- package/dist/ssr/context.js +14 -0
- package/dist/ssr/context.js.map +1 -0
- package/dist/ssr/format-global-rules.js +22 -0
- package/dist/ssr/format-global-rules.js.map +1 -0
- package/dist/ssr/format-keyframes.js +70 -0
- package/dist/ssr/format-keyframes.js.map +1 -0
- package/dist/ssr/format-property.js +48 -0
- package/dist/ssr/format-property.js.map +1 -0
- package/dist/ssr/format-rules.js +70 -0
- package/dist/ssr/format-rules.js.map +1 -0
- package/dist/ssr/hydrate.d.ts +22 -0
- package/dist/ssr/hydrate.js +50 -0
- package/dist/ssr/hydrate.js.map +1 -0
- package/dist/ssr/index.d.ts +5 -0
- package/dist/ssr/index.js +12 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/next.d.ts +45 -0
- package/dist/ssr/next.js +71 -0
- package/dist/ssr/next.js.map +1 -0
- package/dist/ssr/ssr-collector-ref.js +12 -0
- package/dist/ssr/ssr-collector-ref.js.map +1 -0
- package/dist/states/index.d.ts +49 -0
- package/dist/states/index.js +416 -0
- package/dist/states/index.js.map +1 -0
- package/dist/static/index.d.ts +5 -0
- package/dist/static/index.js +5 -0
- package/dist/static/tastyStatic.d.ts +46 -0
- package/dist/static/tastyStatic.js +31 -0
- package/dist/static/tastyStatic.js.map +1 -0
- package/dist/static/types.d.ts +49 -0
- package/dist/static/types.js +24 -0
- package/dist/static/types.js.map +1 -0
- package/dist/styles/align.d.ts +15 -0
- package/dist/styles/align.js +14 -0
- package/dist/styles/align.js.map +1 -0
- package/dist/styles/border.d.ts +25 -0
- package/dist/styles/border.js +114 -0
- package/dist/styles/border.js.map +1 -0
- package/dist/styles/color.d.ts +14 -0
- package/dist/styles/color.js +23 -0
- package/dist/styles/color.js.map +1 -0
- package/dist/styles/createStyle.js +77 -0
- package/dist/styles/createStyle.js.map +1 -0
- package/dist/styles/dimension.js +97 -0
- package/dist/styles/dimension.js.map +1 -0
- package/dist/styles/display.d.ts +37 -0
- package/dist/styles/display.js +67 -0
- package/dist/styles/display.js.map +1 -0
- package/dist/styles/fade.d.ts +15 -0
- package/dist/styles/fade.js +58 -0
- package/dist/styles/fade.js.map +1 -0
- package/dist/styles/fill.d.ts +42 -0
- package/dist/styles/fill.js +52 -0
- package/dist/styles/fill.js.map +1 -0
- package/dist/styles/flow.d.ts +16 -0
- package/dist/styles/flow.js +12 -0
- package/dist/styles/flow.js.map +1 -0
- package/dist/styles/gap.d.ts +31 -0
- package/dist/styles/gap.js +37 -0
- package/dist/styles/gap.js.map +1 -0
- package/dist/styles/height.d.ts +17 -0
- package/dist/styles/height.js +20 -0
- package/dist/styles/height.js.map +1 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/index.js +9 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/inset.d.ts +52 -0
- package/dist/styles/inset.js +150 -0
- package/dist/styles/inset.js.map +1 -0
- package/dist/styles/justify.d.ts +15 -0
- package/dist/styles/justify.js +14 -0
- package/dist/styles/justify.js.map +1 -0
- package/dist/styles/list.d.ts +16 -0
- package/dist/styles/list.js +98 -0
- package/dist/styles/list.js.map +1 -0
- package/dist/styles/margin.d.ts +24 -0
- package/dist/styles/margin.js +104 -0
- package/dist/styles/margin.js.map +1 -0
- package/dist/styles/outline.d.ts +29 -0
- package/dist/styles/outline.js +65 -0
- package/dist/styles/outline.js.map +1 -0
- package/dist/styles/padding.d.ts +24 -0
- package/dist/styles/padding.js +104 -0
- package/dist/styles/padding.js.map +1 -0
- package/dist/styles/predefined.d.ts +71 -0
- package/dist/styles/predefined.js +238 -0
- package/dist/styles/predefined.js.map +1 -0
- package/dist/styles/preset.d.ts +47 -0
- package/dist/styles/preset.js +126 -0
- package/dist/styles/preset.js.map +1 -0
- package/dist/styles/radius.d.ts +14 -0
- package/dist/styles/radius.js +51 -0
- package/dist/styles/radius.js.map +1 -0
- package/dist/styles/scrollbar.d.ts +25 -0
- package/dist/styles/scrollbar.js +48 -0
- package/dist/styles/scrollbar.js.map +1 -0
- package/dist/styles/shadow.d.ts +14 -0
- package/dist/styles/shadow.js +24 -0
- package/dist/styles/shadow.js.map +1 -0
- package/dist/styles/transition.d.ts +14 -0
- package/dist/styles/transition.js +158 -0
- package/dist/styles/transition.js.map +1 -0
- package/dist/styles/types.d.ts +508 -0
- package/dist/styles/width.d.ts +17 -0
- package/dist/styles/width.js +20 -0
- package/dist/styles/width.js.map +1 -0
- package/dist/tasty.d.ts +981 -0
- package/dist/tasty.js +206 -0
- package/dist/tasty.js.map +1 -0
- package/dist/types.d.ts +184 -0
- package/dist/utils/cache-wrapper.js +26 -0
- package/dist/utils/cache-wrapper.js.map +1 -0
- package/dist/utils/case-converter.js +8 -0
- package/dist/utils/case-converter.js.map +1 -0
- package/dist/utils/colors.d.ts +5 -0
- package/dist/utils/colors.js +9 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/css-types.d.ts +7 -0
- package/dist/utils/dotize.d.ts +26 -0
- package/dist/utils/dotize.js +122 -0
- package/dist/utils/dotize.js.map +1 -0
- package/dist/utils/filter-base-props.d.ts +15 -0
- package/dist/utils/filter-base-props.js +45 -0
- package/dist/utils/filter-base-props.js.map +1 -0
- package/dist/utils/get-display-name.d.ts +7 -0
- package/dist/utils/get-display-name.js +10 -0
- package/dist/utils/get-display-name.js.map +1 -0
- package/dist/utils/hsl-to-rgb.js +38 -0
- package/dist/utils/hsl-to-rgb.js.map +1 -0
- package/dist/utils/is-dev-env.js +19 -0
- package/dist/utils/is-dev-env.js.map +1 -0
- package/dist/utils/is-valid-element-type.js +15 -0
- package/dist/utils/is-valid-element-type.js.map +1 -0
- package/dist/utils/merge-styles.d.ts +7 -0
- package/dist/utils/merge-styles.js +146 -0
- package/dist/utils/merge-styles.js.map +1 -0
- package/dist/utils/mod-attrs.d.ts +8 -0
- package/dist/utils/mod-attrs.js +21 -0
- package/dist/utils/mod-attrs.js.map +1 -0
- package/dist/utils/okhsl-to-rgb.js +296 -0
- package/dist/utils/okhsl-to-rgb.js.map +1 -0
- package/dist/utils/process-tokens.d.ts +31 -0
- package/dist/utils/process-tokens.js +171 -0
- package/dist/utils/process-tokens.js.map +1 -0
- package/dist/utils/resolve-recipes.d.ts +17 -0
- package/dist/utils/resolve-recipes.js +147 -0
- package/dist/utils/resolve-recipes.js.map +1 -0
- package/dist/utils/selector-transform.js +32 -0
- package/dist/utils/selector-transform.js.map +1 -0
- package/dist/utils/string.js +8 -0
- package/dist/utils/string.js.map +1 -0
- package/dist/utils/styles.d.ts +177 -0
- package/dist/utils/styles.js +730 -0
- package/dist/utils/styles.js.map +1 -0
- package/dist/utils/typography.d.ts +47 -0
- package/dist/utils/typography.js +43 -0
- package/dist/utils/typography.js.map +1 -0
- package/dist/utils/warnings.d.ts +16 -0
- package/dist/utils/warnings.js +16 -0
- package/dist/utils/warnings.js.map +1 -0
- package/dist/zero/babel.d.ts +147 -0
- package/dist/zero/babel.js +331 -0
- package/dist/zero/babel.js.map +1 -0
- package/dist/zero/css-writer.d.ts +45 -0
- package/dist/zero/css-writer.js +74 -0
- package/dist/zero/css-writer.js.map +1 -0
- package/dist/zero/extractor.d.ts +24 -0
- package/dist/zero/extractor.js +215 -0
- package/dist/zero/extractor.js.map +1 -0
- package/dist/zero/index.d.ts +3 -0
- package/dist/zero/index.js +4 -0
- package/dist/zero/next.d.ts +74 -0
- package/dist/zero/next.js +129 -0
- package/dist/zero/next.js.map +1 -0
- package/docs/adoption.md +286 -0
- package/docs/comparison.md +413 -0
- package/docs/configuration.md +242 -0
- package/docs/debug.md +505 -0
- package/docs/design-system.md +401 -0
- package/docs/dsl.md +540 -0
- package/docs/getting-started.md +201 -0
- package/docs/injector.md +528 -0
- package/docs/methodology.md +501 -0
- package/docs/runtime.md +291 -0
- package/docs/ssr.md +382 -0
- package/docs/styles.md +574 -0
- package/docs/tasty-static.md +421 -0
- package/package.json +209 -0
- package/tasty.config.ts +14 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { extractLocalProperties, hasLocalProperties } from "../properties/index.js";
|
|
2
|
+
import { PropertyTypeResolver } from "../properties/property-type-resolver.js";
|
|
3
|
+
import { renderStyles } from "../pipeline/index.js";
|
|
4
|
+
import { categorizeStyleKeys } from "../chunks/definitions.js";
|
|
5
|
+
import { generateChunkCacheKey } from "../chunks/cacheKey.js";
|
|
6
|
+
import { renderStylesForChunk } from "../chunks/renderChunk.js";
|
|
7
|
+
import { extractAnimationNamesFromStyles, extractLocalKeyframes, filterUsedKeyframes, hasLocalKeyframes, mergeKeyframes } from "../keyframes/index.js";
|
|
8
|
+
import { createHash } from "crypto";
|
|
9
|
+
|
|
10
|
+
//#region src/zero/extractor.ts
|
|
11
|
+
/**
|
|
12
|
+
* Generate a deterministic className from a cache key using content hash.
|
|
13
|
+
* This ensures the same styles always produce the same className,
|
|
14
|
+
* regardless of build order or incremental compilation.
|
|
15
|
+
*/
|
|
16
|
+
function generateClassName(cacheKey) {
|
|
17
|
+
return `ts${createHash("md5").update(cacheKey).digest("hex").slice(0, 6)}`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Extract styles using chunking (for className mode).
|
|
21
|
+
* Returns multiple classes, one per chunk.
|
|
22
|
+
*/
|
|
23
|
+
function extractStylesWithChunks(styles) {
|
|
24
|
+
const chunks = [];
|
|
25
|
+
const chunkMap = categorizeStyleKeys(styles);
|
|
26
|
+
for (const [chunkName, chunkStyleKeys] of chunkMap) {
|
|
27
|
+
if (chunkStyleKeys.length === 0) continue;
|
|
28
|
+
const cacheKey = generateChunkCacheKey(styles, chunkName, chunkStyleKeys);
|
|
29
|
+
const renderResult = renderStylesForChunk(styles, chunkName, chunkStyleKeys);
|
|
30
|
+
if (renderResult.rules.length === 0) continue;
|
|
31
|
+
const className = generateClassName(cacheKey);
|
|
32
|
+
const selector = `.${className}.${className}`;
|
|
33
|
+
const css = formatRulesToCSS(renderResult.rules, selector);
|
|
34
|
+
chunks.push({
|
|
35
|
+
className,
|
|
36
|
+
css
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return chunks;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extract styles for a specific selector (for global/selector mode).
|
|
43
|
+
* Returns a single CSS block.
|
|
44
|
+
*/
|
|
45
|
+
function extractStylesForSelector(selector, styles) {
|
|
46
|
+
return {
|
|
47
|
+
selector,
|
|
48
|
+
css: formatRulesDirectly(renderStyles(styles, selector))
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Format StyleResult[] to CSS string.
|
|
53
|
+
* Prefixes each rule's selector with the base selector.
|
|
54
|
+
* Used for chunked styles where rules have relative selectors.
|
|
55
|
+
*/
|
|
56
|
+
function formatRulesToCSS(rules, baseSelector) {
|
|
57
|
+
return rules.map((rule) => {
|
|
58
|
+
let css = `${(Array.isArray(rule.selector) ? rule.selector : rule.selector ? rule.selector.split("|||") : [""]).map((part) => {
|
|
59
|
+
let selector;
|
|
60
|
+
if (!part) selector = baseSelector;
|
|
61
|
+
else if (part.startsWith(":") || part.startsWith("[")) selector = `${baseSelector}${part}`;
|
|
62
|
+
else if (part.startsWith(">") || part.startsWith("+") || part.startsWith("~")) selector = `${baseSelector}${part}`;
|
|
63
|
+
else selector = `${baseSelector}${part}`;
|
|
64
|
+
if (rule.rootPrefix) selector = `${rule.rootPrefix} ${selector}`;
|
|
65
|
+
return selector;
|
|
66
|
+
}).join(", ")} { ${rule.declarations} }`;
|
|
67
|
+
if (rule.atRules && rule.atRules.length > 0) for (const atRule of [...rule.atRules].reverse()) css = `${atRule} {\n ${css}\n}`;
|
|
68
|
+
return css;
|
|
69
|
+
}).join("\n\n");
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Format StyleResult[] to CSS string directly without prefixing.
|
|
73
|
+
* Used for global styles where rules already have the full selector.
|
|
74
|
+
*/
|
|
75
|
+
function formatRulesDirectly(rules) {
|
|
76
|
+
return rules.map((rule) => {
|
|
77
|
+
let css = `${rule.rootPrefix ? `${rule.rootPrefix} ${rule.selector}` : rule.selector} { ${rule.declarations} }`;
|
|
78
|
+
if (rule.atRules && rule.atRules.length > 0) for (const atRule of [...rule.atRules].reverse()) css = `${atRule} {\n ${css}\n}`;
|
|
79
|
+
return css;
|
|
80
|
+
}).join("\n\n");
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Generate a deterministic keyframes name from content hash.
|
|
84
|
+
* This ensures the same keyframes content always produces the same name,
|
|
85
|
+
* enabling automatic deduplication across elements and files.
|
|
86
|
+
*/
|
|
87
|
+
function generateKeyframesName(steps) {
|
|
88
|
+
const content = JSON.stringify(steps);
|
|
89
|
+
return `kf${createHash("md5").update(content).digest("hex").slice(0, 6)}`;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Extract keyframes that are used in styles.
|
|
93
|
+
* Merges local @keyframes with global keyframes, filters to only used ones.
|
|
94
|
+
* Generates hash-based names from content for automatic deduplication.
|
|
95
|
+
*
|
|
96
|
+
* @param styles - The styles object (may contain @keyframes and animation properties)
|
|
97
|
+
* @param globalKeyframes - Optional global keyframes from config
|
|
98
|
+
* @returns Keyframes to inject and name mapping for replacement
|
|
99
|
+
*/
|
|
100
|
+
function extractKeyframesFromStyles(styles, globalKeyframes) {
|
|
101
|
+
const emptyResult = {
|
|
102
|
+
keyframes: [],
|
|
103
|
+
nameMap: /* @__PURE__ */ new Map()
|
|
104
|
+
};
|
|
105
|
+
const usedNames = extractAnimationNamesFromStyles(styles);
|
|
106
|
+
if (usedNames.size === 0) return emptyResult;
|
|
107
|
+
const usedKeyframes = filterUsedKeyframes(mergeKeyframes(hasLocalKeyframes(styles) ? extractLocalKeyframes(styles) : null, globalKeyframes ?? null), usedNames);
|
|
108
|
+
if (!usedKeyframes) return emptyResult;
|
|
109
|
+
const seenHashes = /* @__PURE__ */ new Set();
|
|
110
|
+
const nameMap = /* @__PURE__ */ new Map();
|
|
111
|
+
const keyframesToEmit = [];
|
|
112
|
+
for (const [originalName, steps] of Object.entries(usedKeyframes)) {
|
|
113
|
+
const hashedName = generateKeyframesName(steps);
|
|
114
|
+
nameMap.set(originalName, hashedName);
|
|
115
|
+
if (!seenHashes.has(hashedName)) {
|
|
116
|
+
seenHashes.add(hashedName);
|
|
117
|
+
const css = keyframesToCSS(hashedName, steps);
|
|
118
|
+
keyframesToEmit.push({
|
|
119
|
+
name: hashedName,
|
|
120
|
+
css
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
keyframes: keyframesToEmit,
|
|
126
|
+
nameMap
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Convert keyframes steps to CSS string.
|
|
131
|
+
*/
|
|
132
|
+
function keyframesToCSS(name, steps) {
|
|
133
|
+
const stepRules = [];
|
|
134
|
+
for (const [key, value] of Object.entries(steps)) if (typeof value === "string") stepRules.push(`${key} { ${value.trim()} }`);
|
|
135
|
+
else if (value && typeof value === "object") {
|
|
136
|
+
const declarations = Object.entries(value).map(([prop, val]) => {
|
|
137
|
+
return `${camelToKebab(prop)}: ${val}`;
|
|
138
|
+
}).join("; ");
|
|
139
|
+
stepRules.push(`${key} { ${declarations} }`);
|
|
140
|
+
}
|
|
141
|
+
return `@keyframes ${name} { ${stepRules.join(" ")} }`;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Convert camelCase to kebab-case.
|
|
145
|
+
*/
|
|
146
|
+
function camelToKebab(str) {
|
|
147
|
+
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Extract auto-inferred @property declarations from styles.
|
|
151
|
+
* Scans rendered style declarations and keyframe declarations for custom properties
|
|
152
|
+
* whose types can be inferred from their values.
|
|
153
|
+
*
|
|
154
|
+
* @param styles - The styles object
|
|
155
|
+
* @param options - Options including autoPropertyTypes flag
|
|
156
|
+
* @returns Array of @property CSS rules to inject
|
|
157
|
+
*/
|
|
158
|
+
function extractPropertiesFromStyles(styles, options) {
|
|
159
|
+
if (options?.autoPropertyTypes === false) return [];
|
|
160
|
+
const registered = /* @__PURE__ */ new Set();
|
|
161
|
+
const results = [];
|
|
162
|
+
if (hasLocalProperties(styles)) {
|
|
163
|
+
const localProps = extractLocalProperties(styles);
|
|
164
|
+
if (localProps) for (const token of Object.keys(localProps)) {
|
|
165
|
+
let cssName;
|
|
166
|
+
if (token.startsWith("#")) cssName = `--${token.slice(1)}-color`;
|
|
167
|
+
else if (token.startsWith("$")) cssName = `--${token.slice(1)}`;
|
|
168
|
+
else if (token.startsWith("--")) cssName = token;
|
|
169
|
+
else cssName = `--${token}`;
|
|
170
|
+
registered.add(cssName);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const resolver = new PropertyTypeResolver();
|
|
174
|
+
const registerProperty = (name, syntax, initialValue) => {
|
|
175
|
+
if (registered.has(name)) return;
|
|
176
|
+
registered.add(name);
|
|
177
|
+
const parts = [];
|
|
178
|
+
parts.push(`syntax: "${syntax}";`);
|
|
179
|
+
parts.push(`inherits: true;`);
|
|
180
|
+
parts.push(`initial-value: ${initialValue};`);
|
|
181
|
+
const css = `@property ${name} { ${parts.join(" ")} }`;
|
|
182
|
+
results.push({
|
|
183
|
+
name,
|
|
184
|
+
css
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
const isPropertyDefined = (name) => registered.has(name);
|
|
188
|
+
const chunkMap = categorizeStyleKeys(styles);
|
|
189
|
+
for (const [chunkName, chunkStyleKeys] of chunkMap) {
|
|
190
|
+
if (chunkStyleKeys.length === 0) continue;
|
|
191
|
+
const renderResult = renderStylesForChunk(styles, chunkName, chunkStyleKeys);
|
|
192
|
+
for (const rule of renderResult.rules) {
|
|
193
|
+
if (!rule.declarations) continue;
|
|
194
|
+
resolver.scanDeclarations(rule.declarations, isPropertyDefined, registerProperty);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (hasLocalKeyframes(styles)) {
|
|
198
|
+
const localKf = extractLocalKeyframes(styles);
|
|
199
|
+
if (localKf) for (const steps of Object.values(localKf)) scanKeyframeSteps(steps, resolver, isPropertyDefined, registerProperty);
|
|
200
|
+
}
|
|
201
|
+
return results;
|
|
202
|
+
}
|
|
203
|
+
function scanKeyframeSteps(steps, resolver, isPropertyDefined, registerProperty) {
|
|
204
|
+
for (const value of Object.values(steps)) if (typeof value === "string") resolver.scanDeclarations(value, isPropertyDefined, registerProperty);
|
|
205
|
+
else if (value && typeof value === "object") {
|
|
206
|
+
const declarations = Object.entries(value).map(([prop, val]) => {
|
|
207
|
+
return `${camelToKebab(prop)}: ${val}`;
|
|
208
|
+
}).join("; ");
|
|
209
|
+
resolver.scanDeclarations(declarations, isPropertyDefined, registerProperty);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
//#endregion
|
|
214
|
+
export { extractKeyframesFromStyles, extractPropertiesFromStyles, extractStylesForSelector, extractStylesWithChunks };
|
|
215
|
+
//# sourceMappingURL=extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.js","names":[],"sources":["../../src/zero/extractor.ts"],"sourcesContent":["import { createHash } from 'crypto';\n\nimport {\n categorizeStyleKeys,\n generateChunkCacheKey,\n renderStylesForChunk,\n} from '../chunks';\nimport type { KeyframesSteps } from '../injector/types';\nimport {\n extractAnimationNamesFromStyles,\n extractLocalKeyframes,\n filterUsedKeyframes,\n hasLocalKeyframes,\n mergeKeyframes,\n} from '../keyframes';\nimport type { StyleResult } from '../pipeline';\nimport { renderStyles } from '../pipeline';\nimport { extractLocalProperties, hasLocalProperties } from '../properties';\nimport { PropertyTypeResolver } from '../properties/property-type-resolver';\nimport type { Styles } from '../styles/types';\n\nexport interface ExtractedChunk {\n className: string;\n css: string;\n}\n\nexport interface ExtractedSelector {\n selector: string;\n css: string;\n}\n\nexport interface ExtractedKeyframes {\n name: string;\n css: string;\n}\n\nexport interface KeyframesExtractionResult {\n /** Keyframes to inject (deduplicated by content) */\n keyframes: ExtractedKeyframes[];\n /** Map from original animation name to canonical name (for replacement) */\n nameMap: Map<string, string>;\n}\n\n/**\n * Generate a deterministic className from a cache key using content hash.\n * This ensures the same styles always produce the same className,\n * regardless of build order or incremental compilation.\n */\nfunction generateClassName(cacheKey: string): string {\n const hash = createHash('md5').update(cacheKey).digest('hex').slice(0, 6);\n return `ts${hash}`; // 'ts' prefix for \"tasty-static\" to distinguish from runtime 't' classes\n}\n\n/**\n * Extract styles using chunking (for className mode).\n * Returns multiple classes, one per chunk.\n */\nexport function extractStylesWithChunks(styles: Styles): ExtractedChunk[] {\n const chunks: ExtractedChunk[] = [];\n\n // Categorize style keys into chunks\n const chunkMap = categorizeStyleKeys(styles as Record<string, unknown>);\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n if (chunkStyleKeys.length === 0) continue;\n\n // Generate cache key for this chunk (used for className hash)\n const cacheKey = generateChunkCacheKey(styles, chunkName, chunkStyleKeys);\n\n // Render styles for this chunk\n const renderResult = renderStylesForChunk(\n styles,\n chunkName,\n chunkStyleKeys,\n );\n\n if (renderResult.rules.length === 0) continue;\n\n // Generate deterministic className from content hash\n const className = generateClassName(cacheKey);\n const selector = `.${className}.${className}`;\n\n // Format CSS\n const css = formatRulesToCSS(renderResult.rules, selector);\n\n chunks.push({ className, css });\n }\n\n return chunks;\n}\n\n/**\n * Extract styles for a specific selector (for global/selector mode).\n * Returns a single CSS block.\n */\nexport function extractStylesForSelector(\n selector: string,\n styles: Styles,\n): ExtractedSelector {\n // renderStyles with selector returns StyleResult[] with selectors already applied\n const rules = renderStyles(styles, selector);\n // Format without re-prefixing - rules already have the full selector\n const css = formatRulesDirectly(rules);\n\n return { selector, css };\n}\n\n/**\n * Format StyleResult[] to CSS string.\n * Prefixes each rule's selector with the base selector.\n * Used for chunked styles where rules have relative selectors.\n */\nfunction formatRulesToCSS(rules: StyleResult[], baseSelector: string): string {\n return rules\n .map((rule) => {\n // Handle selector as array (OR conditions) or string\n // Note: renderStyles without className joins array selectors with '|||' placeholder\n const selectorParts = Array.isArray(rule.selector)\n ? rule.selector\n : rule.selector\n ? rule.selector.split('|||')\n : [''];\n\n // Prefix each selector part with the base selector\n const fullSelector = selectorParts\n .map((part) => {\n // Build selector: [rootPrefix] baseSelector[part]\n let selector: string;\n\n // If part is empty, just use base selector\n if (!part) {\n selector = baseSelector;\n } else if (part.startsWith(':') || part.startsWith('[')) {\n // If part starts with a pseudo-class or pseudo-element, append to base\n selector = `${baseSelector}${part}`;\n } else if (\n part.startsWith('>') ||\n part.startsWith('+') ||\n part.startsWith('~')\n ) {\n // If part starts with >, +, ~ combinator, append with space\n selector = `${baseSelector}${part}`;\n } else {\n // Otherwise, combine base with part\n selector = `${baseSelector}${part}`;\n }\n\n // Prepend rootPrefix if present (for @root() states)\n if (rule.rootPrefix) {\n selector = `${rule.rootPrefix} ${selector}`;\n }\n\n return selector;\n })\n .join(', ');\n\n let css = `${fullSelector} { ${rule.declarations} }`;\n\n // Wrap in at-rules (in reverse order for proper nesting)\n if (rule.atRules && rule.atRules.length > 0) {\n for (const atRule of [...rule.atRules].reverse()) {\n css = `${atRule} {\\n ${css}\\n}`;\n }\n }\n\n return css;\n })\n .join('\\n\\n');\n}\n\n/**\n * Format StyleResult[] to CSS string directly without prefixing.\n * Used for global styles where rules already have the full selector.\n */\nfunction formatRulesDirectly(rules: StyleResult[]): string {\n return rules\n .map((rule) => {\n // Prepend rootPrefix if present (for @root() states)\n const selector = rule.rootPrefix\n ? `${rule.rootPrefix} ${rule.selector}`\n : rule.selector;\n\n let css = `${selector} { ${rule.declarations} }`;\n\n // Wrap in at-rules (in reverse order for proper nesting)\n if (rule.atRules && rule.atRules.length > 0) {\n for (const atRule of [...rule.atRules].reverse()) {\n css = `${atRule} {\\n ${css}\\n}`;\n }\n }\n\n return css;\n })\n .join('\\n\\n');\n}\n\n// Note: With hash-based className generation, counter management functions\n// are no longer needed. ClassNames are deterministic based on content.\n\n/**\n * Generate a deterministic keyframes name from content hash.\n * This ensures the same keyframes content always produces the same name,\n * enabling automatic deduplication across elements and files.\n */\nfunction generateKeyframesName(steps: KeyframesSteps): string {\n const content = JSON.stringify(steps);\n const hash = createHash('md5').update(content).digest('hex').slice(0, 6);\n return `kf${hash}`; // 'kf' prefix for \"keyframes\"\n}\n\n/**\n * Extract keyframes that are used in styles.\n * Merges local @keyframes with global keyframes, filters to only used ones.\n * Generates hash-based names from content for automatic deduplication.\n *\n * @param styles - The styles object (may contain @keyframes and animation properties)\n * @param globalKeyframes - Optional global keyframes from config\n * @returns Keyframes to inject and name mapping for replacement\n */\nexport function extractKeyframesFromStyles(\n styles: Styles,\n globalKeyframes?: Record<string, KeyframesSteps> | null,\n): KeyframesExtractionResult {\n const emptyResult: KeyframesExtractionResult = {\n keyframes: [],\n nameMap: new Map(),\n };\n\n // Extract animation names from styles\n const usedNames = extractAnimationNamesFromStyles(styles);\n if (usedNames.size === 0) return emptyResult;\n\n // Merge local and global keyframes\n const local = hasLocalKeyframes(styles)\n ? extractLocalKeyframes(styles)\n : null;\n const allKeyframes = mergeKeyframes(local, globalKeyframes ?? null);\n\n // Filter to only used keyframes\n const usedKeyframes = filterUsedKeyframes(allKeyframes, usedNames);\n if (!usedKeyframes) return emptyResult;\n\n // Generate hash-based names and collect unique keyframes\n const seenHashes = new Set<string>();\n const nameMap = new Map<string, string>();\n const keyframesToEmit: ExtractedKeyframes[] = [];\n\n for (const [originalName, steps] of Object.entries(usedKeyframes)) {\n const hashedName = generateKeyframesName(steps);\n\n // Always map original name to hashed name (for CSS replacement)\n nameMap.set(originalName, hashedName);\n\n // Only emit each unique keyframe once\n if (!seenHashes.has(hashedName)) {\n seenHashes.add(hashedName);\n const css = keyframesToCSS(hashedName, steps);\n keyframesToEmit.push({ name: hashedName, css });\n }\n }\n\n return { keyframes: keyframesToEmit, nameMap };\n}\n\n/**\n * Convert keyframes steps to CSS string.\n */\nfunction keyframesToCSS(name: string, steps: KeyframesSteps): string {\n const stepRules: string[] = [];\n\n for (const [key, value] of Object.entries(steps)) {\n if (typeof value === 'string') {\n // Raw CSS string\n stepRules.push(`${key} { ${value.trim()} }`);\n } else if (value && typeof value === 'object') {\n // Style map - convert to CSS declarations\n const declarations = Object.entries(value)\n .map(([prop, val]) => {\n const cssProperty = camelToKebab(prop);\n return `${cssProperty}: ${val}`;\n })\n .join('; ');\n stepRules.push(`${key} { ${declarations} }`);\n }\n }\n\n return `@keyframes ${name} { ${stepRules.join(' ')} }`;\n}\n\n/**\n * Convert camelCase to kebab-case.\n */\nfunction camelToKebab(str: string): string {\n return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\n// ============================================================================\n// Property Extraction (auto-infer @property types for zero-runtime)\n// ============================================================================\n\nexport interface ExtractedProperty {\n name: string;\n css: string;\n}\n\n/**\n * Extract auto-inferred @property declarations from styles.\n * Scans rendered style declarations and keyframe declarations for custom properties\n * whose types can be inferred from their values.\n *\n * @param styles - The styles object\n * @param options - Options including autoPropertyTypes flag\n * @returns Array of @property CSS rules to inject\n */\nexport function extractPropertiesFromStyles(\n styles: Styles,\n options?: { autoPropertyTypes?: boolean },\n): ExtractedProperty[] {\n if (options?.autoPropertyTypes === false) return [];\n\n const registered = new Set<string>();\n const results: ExtractedProperty[] = [];\n\n // Collect explicitly declared properties (they take precedence)\n if (hasLocalProperties(styles)) {\n const localProps = extractLocalProperties(styles);\n if (localProps) {\n for (const token of Object.keys(localProps)) {\n // Normalize token to CSS name\n let cssName: string;\n if (token.startsWith('#')) {\n cssName = `--${token.slice(1)}-color`;\n } else if (token.startsWith('$')) {\n cssName = `--${token.slice(1)}`;\n } else if (token.startsWith('--')) {\n cssName = token;\n } else {\n cssName = `--${token}`;\n }\n registered.add(cssName);\n }\n }\n }\n\n const resolver = new PropertyTypeResolver();\n\n const registerProperty = (\n name: string,\n syntax: string,\n initialValue: string,\n ) => {\n if (registered.has(name)) return;\n registered.add(name);\n\n const parts: string[] = [];\n parts.push(`syntax: \"${syntax}\";`);\n parts.push(`inherits: true;`);\n parts.push(`initial-value: ${initialValue};`);\n\n const css = `@property ${name} { ${parts.join(' ')} }`;\n results.push({ name, css });\n };\n\n const isPropertyDefined = (name: string) => registered.has(name);\n\n // Scan rendered style declarations\n const chunkMap = categorizeStyleKeys(styles as Record<string, unknown>);\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n if (chunkStyleKeys.length === 0) continue;\n const renderResult = renderStylesForChunk(\n styles,\n chunkName,\n chunkStyleKeys,\n );\n for (const rule of renderResult.rules) {\n if (!rule.declarations) continue;\n resolver.scanDeclarations(\n rule.declarations,\n isPropertyDefined,\n registerProperty,\n );\n }\n }\n\n // Scan keyframe declarations\n if (hasLocalKeyframes(styles)) {\n const localKf = extractLocalKeyframes(styles);\n if (localKf) {\n for (const steps of Object.values(localKf)) {\n scanKeyframeSteps(steps, resolver, isPropertyDefined, registerProperty);\n }\n }\n }\n\n return results;\n}\n\nfunction scanKeyframeSteps(\n steps: KeyframesSteps,\n resolver: PropertyTypeResolver,\n isPropertyDefined: (name: string) => boolean,\n registerProperty: (\n name: string,\n syntax: string,\n initialValue: string,\n ) => void,\n): void {\n for (const value of Object.values(steps)) {\n if (typeof value === 'string') {\n resolver.scanDeclarations(value, isPropertyDefined, registerProperty);\n } else if (value && typeof value === 'object') {\n const declarations = Object.entries(value)\n .map(([prop, val]) => {\n const cssProperty = camelToKebab(prop);\n return `${cssProperty}: ${val}`;\n })\n .join('; ');\n resolver.scanDeclarations(\n declarations,\n isPropertyDefined,\n registerProperty,\n );\n }\n }\n}\n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IAAI;IAC1B,CACD,KAAK,KAAK;AACb,WAAS,iBACP,cACA,mBACA,iBACD"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ExtractedChunk, ExtractedSelector, extractStylesForSelector, extractStylesWithChunks } from "./extractor.js";
|
|
2
|
+
import { CSSWriter } from "./css-writer.js";
|
|
3
|
+
export { CSSWriter, type ExtractedChunk, type ExtractedSelector, extractStylesForSelector, extractStylesWithChunks };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { TastyZeroConfig } from "./babel.js";
|
|
2
|
+
|
|
3
|
+
//#region src/zero/next.d.ts
|
|
4
|
+
interface WebpackConfigContext {
|
|
5
|
+
isServer: boolean;
|
|
6
|
+
dev: boolean;
|
|
7
|
+
buildId: string;
|
|
8
|
+
dir: string;
|
|
9
|
+
}
|
|
10
|
+
interface TurbopackLoaderItem {
|
|
11
|
+
loader: string;
|
|
12
|
+
options?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
interface TurbopackRuleConfig {
|
|
15
|
+
loaders: (string | TurbopackLoaderItem)[];
|
|
16
|
+
as?: string;
|
|
17
|
+
condition?: unknown;
|
|
18
|
+
}
|
|
19
|
+
interface TurbopackConfig {
|
|
20
|
+
rules?: Record<string, TurbopackRuleConfig | TurbopackRuleConfig[]>;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
interface NextConfig {
|
|
24
|
+
webpack?: (config: any, context: WebpackConfigContext) => any;
|
|
25
|
+
turbopack?: TurbopackConfig;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
interface TastyZeroNextOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Output path for CSS relative to project root.
|
|
31
|
+
* @default 'public/tasty.css'
|
|
32
|
+
*/
|
|
33
|
+
output?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to enable the plugin.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Tasty configuration for build-time processing.
|
|
41
|
+
* For static configs that don't change during dev.
|
|
42
|
+
*
|
|
43
|
+
* For configs that depend on theme files, use `configFile` instead.
|
|
44
|
+
*/
|
|
45
|
+
config?: TastyZeroConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Path to a TypeScript/JavaScript module that exports the tasty zero config
|
|
48
|
+
* as its default export. The module is re-evaluated on each
|
|
49
|
+
* compilation, enabling hot reload when the file (or its imports) change.
|
|
50
|
+
*
|
|
51
|
+
* @example './app/tasty-zero.config.ts'
|
|
52
|
+
*/
|
|
53
|
+
configFile?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Extra file paths (relative to project root) that the config depends on.
|
|
56
|
+
* When any of these files change, the Babel cache is invalidated and
|
|
57
|
+
* the config is re-evaluated.
|
|
58
|
+
*
|
|
59
|
+
* The `configFile` itself is always tracked automatically.
|
|
60
|
+
* Use this for transitive dependencies that aren't directly imported
|
|
61
|
+
* by the config file, or when using `config` instead of `configFile`.
|
|
62
|
+
*
|
|
63
|
+
* @example ['./app/theme.ts']
|
|
64
|
+
*/
|
|
65
|
+
configDeps?: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Next.js configuration wrapper for tasty-zero.
|
|
69
|
+
* Configures both webpack and Turbopack bundlers automatically.
|
|
70
|
+
*/
|
|
71
|
+
declare function withTastyZero(options?: TastyZeroNextOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { TastyZeroNextOptions, withTastyZero };
|
|
74
|
+
//# sourceMappingURL=next.d.ts.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import { createJiti } from "jiti";
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
//#region src/zero/next.ts
|
|
7
|
+
/**
|
|
8
|
+
* Next.js configuration wrapper for tasty-zero.
|
|
9
|
+
*
|
|
10
|
+
* Supports both webpack and Turbopack bundlers:
|
|
11
|
+
* - **webpack**: Injects a babel-loader rule with the tasty-zero Babel plugin
|
|
12
|
+
* via `webpack()` config hook. Config is passed as a jiti factory function.
|
|
13
|
+
* - **Turbopack**: Adds a `turbopack.rules` entry with babel-loader and
|
|
14
|
+
* JSON-serializable options (`configFile` path instead of a function).
|
|
15
|
+
* The Babel plugin loads the config internally via jiti.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```javascript
|
|
19
|
+
* // next.config.js
|
|
20
|
+
* const { withTastyZero } = require('@tenphi/tasty/next');
|
|
21
|
+
*
|
|
22
|
+
* module.exports = withTastyZero({
|
|
23
|
+
* output: 'public/tasty.css',
|
|
24
|
+
* configFile: './app/tasty-zero.config.ts',
|
|
25
|
+
* })({
|
|
26
|
+
* // your Next.js config
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
31
|
+
const __dirname = path.dirname(__filename);
|
|
32
|
+
/**
|
|
33
|
+
* Next.js configuration wrapper for tasty-zero.
|
|
34
|
+
* Configures both webpack and Turbopack bundlers automatically.
|
|
35
|
+
*/
|
|
36
|
+
function withTastyZero(options = {}) {
|
|
37
|
+
const { output = "public/tasty.css", enabled = true, config: tastyConfig, configFile, configDeps = [] } = options;
|
|
38
|
+
return (nextConfig = {}) => {
|
|
39
|
+
if (!enabled) return nextConfig;
|
|
40
|
+
const projectDir = process.cwd();
|
|
41
|
+
const absoluteOutput = path.resolve(projectDir, output);
|
|
42
|
+
const babelPluginPath = path.resolve(__dirname, "babel.js");
|
|
43
|
+
const absoluteConfigFile = configFile ? path.resolve(projectDir, configFile) : void 0;
|
|
44
|
+
const allDeps = [...absoluteConfigFile ? [absoluteConfigFile] : [], ...configDeps.map((dep) => path.resolve(projectDir, dep))];
|
|
45
|
+
const turbopackBabelOptions = {
|
|
46
|
+
babelrc: false,
|
|
47
|
+
configFile: false,
|
|
48
|
+
parserOpts: { plugins: [
|
|
49
|
+
"typescript",
|
|
50
|
+
"jsx",
|
|
51
|
+
"decorators-legacy"
|
|
52
|
+
] },
|
|
53
|
+
plugins: [[babelPluginPath, {
|
|
54
|
+
output: absoluteOutput,
|
|
55
|
+
...absoluteConfigFile ? { configFile: absoluteConfigFile } : tastyConfig ? { config: tastyConfig } : {},
|
|
56
|
+
...allDeps.length > 0 ? { configDeps: allDeps } : {}
|
|
57
|
+
}]]
|
|
58
|
+
};
|
|
59
|
+
const existingTurbopack = nextConfig.turbopack || {};
|
|
60
|
+
const existingRules = existingTurbopack.rules || {};
|
|
61
|
+
return {
|
|
62
|
+
...nextConfig,
|
|
63
|
+
turbopack: {
|
|
64
|
+
...existingTurbopack,
|
|
65
|
+
rules: {
|
|
66
|
+
...existingRules,
|
|
67
|
+
"*.{ts,tsx,js,jsx}": {
|
|
68
|
+
condition: { not: "foreign" },
|
|
69
|
+
loaders: [{
|
|
70
|
+
loader: "babel-loader",
|
|
71
|
+
options: turbopackBabelOptions
|
|
72
|
+
}]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
webpack(config, context) {
|
|
77
|
+
const { dir } = context;
|
|
78
|
+
const wpProjectDir = dir || projectDir;
|
|
79
|
+
const wpAbsoluteOutput = path.resolve(wpProjectDir, output);
|
|
80
|
+
const projectRequire = createRequire(path.resolve(wpProjectDir, "package.json"));
|
|
81
|
+
const wpAbsoluteConfigFile = configFile ? path.resolve(wpProjectDir, configFile) : void 0;
|
|
82
|
+
const wpAllDeps = [...wpAbsoluteConfigFile ? [wpAbsoluteConfigFile] : [], ...configDeps.map((dep) => path.resolve(wpProjectDir, dep))];
|
|
83
|
+
const babelPluginOptions = { output: wpAbsoluteOutput };
|
|
84
|
+
if (wpAbsoluteConfigFile) {
|
|
85
|
+
const jiti = createJiti(wpProjectDir, { moduleCache: false });
|
|
86
|
+
babelPluginOptions.config = () => {
|
|
87
|
+
return jiti(wpAbsoluteConfigFile);
|
|
88
|
+
};
|
|
89
|
+
} else if (tastyConfig) babelPluginOptions.config = tastyConfig;
|
|
90
|
+
if (wpAllDeps.length > 0) babelPluginOptions.configDeps = wpAllDeps;
|
|
91
|
+
const babelPluginConfig = [babelPluginPath, babelPluginOptions];
|
|
92
|
+
const existingRule = config.module?.rules?.find((rule) => rule.use?.loader === "babel-loader" || rule.use?.some?.((u) => u.loader === "babel-loader"));
|
|
93
|
+
if (existingRule) {
|
|
94
|
+
const babelUse = Array.isArray(existingRule.use) ? existingRule.use.find((u) => u.loader === "babel-loader") : existingRule.use;
|
|
95
|
+
if (babelUse?.options) {
|
|
96
|
+
babelUse.options.plugins = babelUse.options.plugins || [];
|
|
97
|
+
babelUse.options.plugins.push(babelPluginConfig);
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
config.module = config.module || {};
|
|
101
|
+
config.module.rules = config.module.rules || [];
|
|
102
|
+
config.module.rules.push({
|
|
103
|
+
test: /\.(tsx?|jsx?)$/,
|
|
104
|
+
exclude: /node_modules/,
|
|
105
|
+
use: [{
|
|
106
|
+
loader: projectRequire.resolve("babel-loader"),
|
|
107
|
+
options: {
|
|
108
|
+
babelrc: false,
|
|
109
|
+
configFile: false,
|
|
110
|
+
parserOpts: { plugins: [
|
|
111
|
+
"typescript",
|
|
112
|
+
"jsx",
|
|
113
|
+
"decorators-legacy"
|
|
114
|
+
] },
|
|
115
|
+
plugins: [babelPluginConfig]
|
|
116
|
+
}
|
|
117
|
+
}]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (typeof nextConfig.webpack === "function") return nextConfig.webpack(config, context);
|
|
121
|
+
return config;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
export { withTastyZero };
|
|
129
|
+
//# sourceMappingURL=next.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.js","names":[],"sources":["../../src/zero/next.ts"],"sourcesContent":["/**\n * Next.js configuration wrapper for tasty-zero.\n *\n * Supports both webpack and Turbopack bundlers:\n * - **webpack**: Injects a babel-loader rule with the tasty-zero Babel plugin\n * via `webpack()` config hook. Config is passed as a jiti factory function.\n * - **Turbopack**: Adds a `turbopack.rules` entry with babel-loader and\n * JSON-serializable options (`configFile` path instead of a function).\n * The Babel plugin loads the config internally via jiti.\n *\n * @example\n * ```javascript\n * // next.config.js\n * const { withTastyZero } = require('@tenphi/tasty/next');\n *\n * module.exports = withTastyZero({\n * output: 'public/tasty.css',\n * configFile: './app/tasty-zero.config.ts',\n * })({\n * // your Next.js config\n * });\n * ```\n */\n\nimport { createRequire } from 'module';\nimport * as path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport { createJiti } from 'jiti';\n\nimport type { TastyZeroBabelOptions, TastyZeroConfig } from './babel';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n// Next.js types (inline to avoid requiring next as a dependency)\ninterface WebpackConfigContext {\n isServer: boolean;\n dev: boolean;\n buildId: string;\n dir: string;\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- webpack/Next.js config types are complex */\ninterface TurbopackLoaderItem {\n loader: string;\n options?: Record<string, unknown>;\n}\n\ninterface TurbopackRuleConfig {\n loaders: (string | TurbopackLoaderItem)[];\n as?: string;\n condition?: unknown;\n}\n\ninterface TurbopackConfig {\n rules?: Record<string, TurbopackRuleConfig | TurbopackRuleConfig[]>;\n [key: string]: unknown;\n}\n\ninterface NextConfig {\n webpack?: (config: any, context: WebpackConfigContext) => any;\n turbopack?: TurbopackConfig;\n [key: string]: unknown;\n}\n\nexport interface TastyZeroNextOptions {\n /**\n * Output path for CSS relative to project root.\n * @default 'public/tasty.css'\n */\n output?: string;\n\n /**\n * Whether to enable the plugin.\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Tasty configuration for build-time processing.\n * For static configs that don't change during dev.\n *\n * For configs that depend on theme files, use `configFile` instead.\n */\n config?: TastyZeroConfig;\n\n /**\n * Path to a TypeScript/JavaScript module that exports the tasty zero config\n * as its default export. The module is re-evaluated on each\n * compilation, enabling hot reload when the file (or its imports) change.\n *\n * @example './app/tasty-zero.config.ts'\n */\n configFile?: string;\n\n /**\n * Extra file paths (relative to project root) that the config depends on.\n * When any of these files change, the Babel cache is invalidated and\n * the config is re-evaluated.\n *\n * The `configFile` itself is always tracked automatically.\n * Use this for transitive dependencies that aren't directly imported\n * by the config file, or when using `config` instead of `configFile`.\n *\n * @example ['./app/theme.ts']\n */\n configDeps?: string[];\n}\n\n/**\n * Next.js configuration wrapper for tasty-zero.\n * Configures both webpack and Turbopack bundlers automatically.\n */\nexport function withTastyZero(options: TastyZeroNextOptions = {}) {\n const {\n output = 'public/tasty.css',\n enabled = true,\n config: tastyConfig,\n configFile,\n configDeps = [],\n } = options;\n\n return (nextConfig: NextConfig = {}): NextConfig => {\n if (!enabled) {\n return nextConfig;\n }\n\n const projectDir = process.cwd();\n const absoluteOutput = path.resolve(projectDir, output);\n const babelPluginPath = path.resolve(__dirname, 'babel.js');\n\n const absoluteConfigFile = configFile\n ? path.resolve(projectDir, configFile)\n : undefined;\n\n const allDeps = [\n ...(absoluteConfigFile ? [absoluteConfigFile] : []),\n ...configDeps.map((dep) => path.resolve(projectDir, dep)),\n ];\n\n // --- Turbopack configuration ---\n // Turbopack loader options must be JSON-serializable (no functions).\n // The Babel plugin loads config internally via `configFile` path + jiti.\n const turbopackBabelOptions: Record<string, unknown> = {\n babelrc: false,\n configFile: false,\n parserOpts: {\n plugins: ['typescript', 'jsx', 'decorators-legacy'],\n },\n plugins: [\n [\n babelPluginPath,\n {\n output: absoluteOutput,\n ...(absoluteConfigFile\n ? { configFile: absoluteConfigFile }\n : tastyConfig\n ? { config: tastyConfig }\n : {}),\n ...(allDeps.length > 0 ? { configDeps: allDeps } : {}),\n },\n ],\n ],\n };\n\n const existingTurbopack = nextConfig.turbopack || {};\n const existingRules = existingTurbopack.rules || {};\n\n return {\n ...nextConfig,\n\n turbopack: {\n ...existingTurbopack,\n rules: {\n ...existingRules,\n '*.{ts,tsx,js,jsx}': {\n condition: { not: 'foreign' },\n loaders: [\n {\n loader: 'babel-loader',\n options: turbopackBabelOptions,\n },\n ],\n },\n },\n },\n\n webpack(config: any, context: WebpackConfigContext) {\n const { dir } = context;\n\n const wpProjectDir = dir || projectDir;\n const wpAbsoluteOutput = path.resolve(wpProjectDir, output);\n const projectRequire = createRequire(\n path.resolve(wpProjectDir, 'package.json'),\n );\n\n const wpAbsoluteConfigFile = configFile\n ? path.resolve(wpProjectDir, configFile)\n : undefined;\n\n const wpAllDeps = [\n ...(wpAbsoluteConfigFile ? [wpAbsoluteConfigFile] : []),\n ...configDeps.map((dep) => path.resolve(wpProjectDir, dep)),\n ];\n\n const babelPluginOptions: TastyZeroBabelOptions = {\n output: wpAbsoluteOutput,\n };\n\n if (wpAbsoluteConfigFile) {\n const jiti = createJiti(wpProjectDir, {\n moduleCache: false,\n });\n\n babelPluginOptions.config = () => {\n return jiti(wpAbsoluteConfigFile) as TastyZeroConfig;\n };\n } else if (tastyConfig) {\n babelPluginOptions.config = tastyConfig;\n }\n\n if (wpAllDeps.length > 0) {\n babelPluginOptions.configDeps = wpAllDeps;\n }\n\n const babelPluginConfig = [babelPluginPath, babelPluginOptions];\n\n const existingRule = config.module?.rules?.find(\n (rule: any) =>\n rule.use?.loader === 'babel-loader' ||\n rule.use?.some?.((u: any) => u.loader === 'babel-loader'),\n );\n\n if (existingRule) {\n const babelUse = Array.isArray(existingRule.use)\n ? existingRule.use.find((u: any) => u.loader === 'babel-loader')\n : existingRule.use;\n\n if (babelUse?.options) {\n babelUse.options.plugins = babelUse.options.plugins || [];\n babelUse.options.plugins.push(babelPluginConfig);\n }\n } else {\n config.module = config.module || {};\n config.module.rules = config.module.rules || [];\n config.module.rules.push({\n test: /\\.(tsx?|jsx?)$/,\n exclude: /node_modules/,\n use: [\n {\n loader: projectRequire.resolve('babel-loader'),\n options: {\n babelrc: false,\n configFile: false,\n parserOpts: {\n plugins: ['typescript', 'jsx', 'decorators-legacy'],\n },\n plugins: [babelPluginConfig],\n },\n },\n ],\n });\n }\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(config, context);\n }\n\n return config;\n },\n };\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,aAAa,cAAc,OAAO,KAAK,IAAI;AACjD,MAAM,YAAY,KAAK,QAAQ,WAAW;;;;;AAiF1C,SAAgB,cAAc,UAAgC,EAAE,EAAE;CAChE,MAAM,EACJ,SAAS,oBACT,UAAU,MACV,QAAQ,aACR,YACA,aAAa,EAAE,KACb;AAEJ,SAAQ,aAAyB,EAAE,KAAiB;AAClD,MAAI,CAAC,QACH,QAAO;EAGT,MAAM,aAAa,QAAQ,KAAK;EAChC,MAAM,iBAAiB,KAAK,QAAQ,YAAY,OAAO;EACvD,MAAM,kBAAkB,KAAK,QAAQ,WAAW,WAAW;EAE3D,MAAM,qBAAqB,aACvB,KAAK,QAAQ,YAAY,WAAW,GACpC;EAEJ,MAAM,UAAU,CACd,GAAI,qBAAqB,CAAC,mBAAmB,GAAG,EAAE,EAClD,GAAG,WAAW,KAAK,QAAQ,KAAK,QAAQ,YAAY,IAAI,CAAC,CAC1D;EAKD,MAAM,wBAAiD;GACrD,SAAS;GACT,YAAY;GACZ,YAAY,EACV,SAAS;IAAC;IAAc;IAAO;IAAoB,EACpD;GACD,SAAS,CACP,CACE,iBACA;IACE,QAAQ;IACR,GAAI,qBACA,EAAE,YAAY,oBAAoB,GAClC,cACE,EAAE,QAAQ,aAAa,GACvB,EAAE;IACR,GAAI,QAAQ,SAAS,IAAI,EAAE,YAAY,SAAS,GAAG,EAAE;IACtD,CACF,CACF;GACF;EAED,MAAM,oBAAoB,WAAW,aAAa,EAAE;EACpD,MAAM,gBAAgB,kBAAkB,SAAS,EAAE;AAEnD,SAAO;GACL,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