@tailwind-styled/next 2.0.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/dist/astTransform-CDvNOLX5.d.cts +30 -0
- package/dist/astTransform-CDvNOLX5.d.ts +30 -0
- package/dist/chunk-LQ6DVF5A.js +2604 -0
- package/dist/chunk-QYSYW6TK.js +62 -0
- package/dist/index.cjs +288 -0
- package/dist/index.d.cts +45 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +240 -0
- package/dist/turbopackLoader.cjs +2711 -0
- package/dist/turbopackLoader.d.cts +22 -0
- package/dist/turbopackLoader.d.ts +22 -0
- package/dist/turbopackLoader.js +82 -0
- package/dist/webpackLoader.cjs +2692 -0
- package/dist/webpackLoader.d.cts +24 -0
- package/dist/webpackLoader.d.ts +24 -0
- package/dist/webpackLoader.js +63 -0
- package/package.json +35 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { T as TransformOptions } from './astTransform-CDvNOLX5.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* tailwind-styled-v4 — Turbopack Loader
|
|
5
|
+
*
|
|
6
|
+
* UPGRADE #2: Route class registration for routeCss bundling
|
|
7
|
+
* UPGRADE #3: Incremental CSS engine — skip unchanged files
|
|
8
|
+
* - Skip files that already carry the transform marker (FIX #08)
|
|
9
|
+
* - Log transform summary in verbose dev mode
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface TurbopackLoaderOptions extends TransformOptions {
|
|
13
|
+
routeCss?: boolean;
|
|
14
|
+
incremental?: boolean;
|
|
15
|
+
verbose?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface TurbopackContext {
|
|
18
|
+
resourcePath: string;
|
|
19
|
+
}
|
|
20
|
+
declare function turbopackLoader(this: TurbopackContext, source: string, options?: TurbopackLoaderOptions): string;
|
|
21
|
+
|
|
22
|
+
export { turbopackLoader as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { T as TransformOptions } from './astTransform-CDvNOLX5.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* tailwind-styled-v4 — Turbopack Loader
|
|
5
|
+
*
|
|
6
|
+
* UPGRADE #2: Route class registration for routeCss bundling
|
|
7
|
+
* UPGRADE #3: Incremental CSS engine — skip unchanged files
|
|
8
|
+
* - Skip files that already carry the transform marker (FIX #08)
|
|
9
|
+
* - Log transform summary in verbose dev mode
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface TurbopackLoaderOptions extends TransformOptions {
|
|
13
|
+
routeCss?: boolean;
|
|
14
|
+
incremental?: boolean;
|
|
15
|
+
verbose?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface TurbopackContext {
|
|
18
|
+
resourcePath: string;
|
|
19
|
+
}
|
|
20
|
+
declare function turbopackLoader(this: TurbopackContext, source: string, options?: TurbopackLoaderOptions): string;
|
|
21
|
+
|
|
22
|
+
export { turbopackLoader as default };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
incrementalEngine_exports,
|
|
3
|
+
init_incrementalEngine,
|
|
4
|
+
init_styleBucketSystem,
|
|
5
|
+
isAlreadyTransformed,
|
|
6
|
+
registerFileClasses,
|
|
7
|
+
styleBucketSystem_exports,
|
|
8
|
+
transformSource
|
|
9
|
+
} from "./chunk-LQ6DVF5A.js";
|
|
10
|
+
import {
|
|
11
|
+
__spreadProps,
|
|
12
|
+
__spreadValues,
|
|
13
|
+
__toCommonJS
|
|
14
|
+
} from "./chunk-QYSYW6TK.js";
|
|
15
|
+
|
|
16
|
+
// src/turbopackLoader.ts
|
|
17
|
+
function turbopackLoader(source, options = {}) {
|
|
18
|
+
const filepath = this.resourcePath;
|
|
19
|
+
if (filepath.includes("node_modules") || filepath.includes(".next")) {
|
|
20
|
+
return source;
|
|
21
|
+
}
|
|
22
|
+
if (!/\.(tsx|ts|jsx|js)$/.test(filepath)) {
|
|
23
|
+
return source;
|
|
24
|
+
}
|
|
25
|
+
if (isAlreadyTransformed(source)) {
|
|
26
|
+
return source;
|
|
27
|
+
}
|
|
28
|
+
if (options.incremental !== false) {
|
|
29
|
+
const { getIncrementalEngine, parseClassesToNodes } = (init_incrementalEngine(), __toCommonJS(incrementalEngine_exports));
|
|
30
|
+
const engine = getIncrementalEngine({ verbose: options.verbose });
|
|
31
|
+
const quickResult = engine.processFile(filepath, source, []);
|
|
32
|
+
if (!quickResult.changed) {
|
|
33
|
+
return source;
|
|
34
|
+
}
|
|
35
|
+
let result;
|
|
36
|
+
try {
|
|
37
|
+
result = transformSource(source, __spreadProps(__spreadValues({}, options), { filename: filepath }));
|
|
38
|
+
} catch (err) {
|
|
39
|
+
if (process.env.NODE_ENV !== "production") {
|
|
40
|
+
console.warn(`[tailwind-styled-v4] Transform failed for ${filepath}:`, err);
|
|
41
|
+
}
|
|
42
|
+
return source;
|
|
43
|
+
}
|
|
44
|
+
if (options.routeCss && result.changed && result.classes.length > 0) {
|
|
45
|
+
registerFileClasses(filepath, result.classes);
|
|
46
|
+
}
|
|
47
|
+
const nodes = parseClassesToNodes(result.classes);
|
|
48
|
+
const diff = engine.processFile(filepath, source, nodes);
|
|
49
|
+
const { getBucketEngine } = (init_styleBucketSystem(), __toCommonJS(styleBucketSystem_exports));
|
|
50
|
+
getBucketEngine().applyDiff(diff.diff);
|
|
51
|
+
if (options.verbose && result.changed && process.env.NODE_ENV !== "production") {
|
|
52
|
+
const rsc = result.rsc;
|
|
53
|
+
const env = (rsc == null ? void 0 : rsc.isServer) ? "server" : "client";
|
|
54
|
+
console.log(
|
|
55
|
+
`[tailwind-styled-v4] ${filepath.split("/").pop()} \u2192 ${result.classes.length} classes, ${env} component` + ((rsc == null ? void 0 : rsc.needsClientDirective) ? " (auto use-client)" : "")
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return result.code;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const result = transformSource(source, __spreadProps(__spreadValues({}, options), { filename: filepath }));
|
|
62
|
+
if (options.routeCss && result.changed && result.classes.length > 0) {
|
|
63
|
+
registerFileClasses(filepath, result.classes);
|
|
64
|
+
}
|
|
65
|
+
if (options.verbose && result.changed && process.env.NODE_ENV !== "production") {
|
|
66
|
+
const rsc = result.rsc;
|
|
67
|
+
const env = (rsc == null ? void 0 : rsc.isServer) ? "server" : "client";
|
|
68
|
+
console.log(
|
|
69
|
+
`[tailwind-styled-v4] ${filepath.split("/").pop()} \u2192 ${result.classes.length} classes, ${env} component` + ((rsc == null ? void 0 : rsc.needsClientDirective) ? " (auto use-client)" : "")
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return result.code;
|
|
73
|
+
} catch (err) {
|
|
74
|
+
if (process.env.NODE_ENV !== "production") {
|
|
75
|
+
console.warn(`[tailwind-styled-v4] Transform failed for ${filepath}:`, err);
|
|
76
|
+
}
|
|
77
|
+
return source;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
turbopackLoader as default
|
|
82
|
+
};
|