@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.
@@ -0,0 +1,24 @@
1
+ import { T as TransformOptions } from './astTransform-CDvNOLX5.cjs';
2
+
3
+ /**
4
+ * tailwind-styled-v4 — Webpack Loader
5
+ *
6
+ * UPGRADE #2: Route class registration for routeCss bundling
7
+ * UPGRADE #3: Incremental CSS engine — skip unchanged files
8
+ * - Idempotency check (FIX #08)
9
+ * - Proper async error handling
10
+ */
11
+
12
+ interface WebpackLoaderOptions extends TransformOptions {
13
+ routeCss?: boolean;
14
+ incremental?: boolean;
15
+ verbose?: boolean;
16
+ }
17
+ interface WebpackContext {
18
+ resourcePath: string;
19
+ getOptions(): WebpackLoaderOptions;
20
+ async(): (err: Error | null, result?: string) => void;
21
+ }
22
+ declare function webpackLoader(this: WebpackContext, source: string): void;
23
+
24
+ export { webpackLoader as default };
@@ -0,0 +1,24 @@
1
+ import { T as TransformOptions } from './astTransform-CDvNOLX5.js';
2
+
3
+ /**
4
+ * tailwind-styled-v4 — Webpack Loader
5
+ *
6
+ * UPGRADE #2: Route class registration for routeCss bundling
7
+ * UPGRADE #3: Incremental CSS engine — skip unchanged files
8
+ * - Idempotency check (FIX #08)
9
+ * - Proper async error handling
10
+ */
11
+
12
+ interface WebpackLoaderOptions extends TransformOptions {
13
+ routeCss?: boolean;
14
+ incremental?: boolean;
15
+ verbose?: boolean;
16
+ }
17
+ interface WebpackContext {
18
+ resourcePath: string;
19
+ getOptions(): WebpackLoaderOptions;
20
+ async(): (err: Error | null, result?: string) => void;
21
+ }
22
+ declare function webpackLoader(this: WebpackContext, source: string): void;
23
+
24
+ export { webpackLoader as default };
@@ -0,0 +1,63 @@
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/webpackLoader.ts
17
+ function webpackLoader(source) {
18
+ const callback = this.async();
19
+ const filepath = this.resourcePath;
20
+ if (filepath.includes("node_modules") || filepath.includes(".next")) {
21
+ callback(null, source);
22
+ return;
23
+ }
24
+ if (isAlreadyTransformed(source)) {
25
+ callback(null, source);
26
+ return;
27
+ }
28
+ try {
29
+ const options = this.getOptions();
30
+ if (options.incremental !== false) {
31
+ const { getIncrementalEngine, parseClassesToNodes } = (init_incrementalEngine(), __toCommonJS(incrementalEngine_exports));
32
+ const engine = getIncrementalEngine({ verbose: options.verbose });
33
+ const quickResult = engine.processFile(filepath, source, []);
34
+ if (!quickResult.changed) {
35
+ callback(null, source);
36
+ return;
37
+ }
38
+ const result2 = transformSource(source, __spreadProps(__spreadValues({}, options), { filename: filepath }));
39
+ if (options.routeCss && result2.changed && result2.classes.length > 0) {
40
+ registerFileClasses(filepath, result2.classes);
41
+ }
42
+ const nodes = parseClassesToNodes(result2.classes);
43
+ const diff = engine.processFile(filepath, source, nodes);
44
+ const { getBucketEngine } = (init_styleBucketSystem(), __toCommonJS(styleBucketSystem_exports));
45
+ getBucketEngine().applyDiff(diff.diff);
46
+ callback(null, result2.code);
47
+ return;
48
+ }
49
+ const result = transformSource(source, __spreadProps(__spreadValues({}, options), { filename: filepath }));
50
+ if (options.routeCss && result.changed && result.classes.length > 0) {
51
+ registerFileClasses(filepath, result.classes);
52
+ }
53
+ callback(null, result.code);
54
+ } catch (err) {
55
+ if (process.env.NODE_ENV !== "production") {
56
+ console.warn(`[tailwind-styled-v4] Webpack transform failed for ${filepath}:`, err);
57
+ }
58
+ callback(null, source);
59
+ }
60
+ }
61
+ export {
62
+ webpackLoader as default
63
+ };
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@tailwind-styled/next",
3
+ "version": "2.0.0",
4
+ "description": "Next.js integration for tailwind-styled-v4 — withTailwindStyled, webpack/turbopack loaders",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ }
16
+ },
17
+ "files": ["dist"],
18
+ "scripts": {
19
+ "build": "tsup",
20
+ "dev": "tsup --watch"
21
+ },
22
+ "dependencies": {
23
+ "@tailwind-styled/compiler": "2.0.0",
24
+ "@tailwind-styled/plugin": "2.0.0"
25
+ },
26
+ "peerDependencies": {
27
+ "next": ">=14"
28
+ },
29
+ "devDependencies": {
30
+ "next": ">=14",
31
+ "tsup": "^8",
32
+ "typescript": "^5",
33
+ "@types/node": "^20"
34
+ }
35
+ }