@typestyles/next 0.5.0 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typestyles/next",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Next.js integration for typestyles SSR",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -68,7 +68,7 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "@typestyles/build-runner": "0.5.0"
71
+ "@typestyles/build-runner": "0.5.2"
72
72
  },
73
73
  "devDependencies": {
74
74
  "eslint": "^9.39.2",
@@ -82,7 +82,7 @@
82
82
  "tsup": "^8.0.0",
83
83
  "typescript": "^5.4.0",
84
84
  "webpack": "^5.97.1",
85
- "typestyles": "0.7.0"
85
+ "typestyles": "0.8.2"
86
86
  },
87
87
  "scripts": {
88
88
  "build": "tsup",
@@ -0,0 +1,40 @@
1
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { tmpdir } from 'node:os';
4
+ import { describe, expect, it } from 'vitest';
5
+ import { buildTypestylesForNext, verifyTypestylesBuild } from './build';
6
+
7
+ describe('buildTypestylesForNext theme extraction', () => {
8
+ it('extracts tokens.create and createTheme CSS into the global stylesheet', async () => {
9
+ const root = mkdtempSync(join(tmpdir(), 'typestyles-next-theme-'));
10
+ mkdirSync(join(root, 'styles'), { recursive: true });
11
+
12
+ writeFileSync(
13
+ join(root, 'styles/typestyles-entry.ts'),
14
+ `import { tokens, createTheme } from 'typestyles';
15
+ const color = tokens.create('next-color', { primary: '#0066ff' });
16
+ createTheme('next-dark', { base: { 'next-color': { primary: '#66aaff' } } });
17
+ `,
18
+ );
19
+
20
+ try {
21
+ await buildTypestylesForNext({ root });
22
+
23
+ // Theme/token CSS is a byproduct of normal extraction — verify with the P1.7 build verifier.
24
+ const result = verifyTypestylesBuild({
25
+ root,
26
+ cssFile: 'app/typestyles.css',
27
+ manifestFile: 'app/typestyles.manifest.json',
28
+ requiredCssSubstrings: [
29
+ '--next-color-primary: #0066ff',
30
+ '.theme-next-dark',
31
+ '--next-color-primary: #66aaff',
32
+ ],
33
+ });
34
+ expect(result.cssBytes).toBeGreaterThan(0);
35
+ expect(result.manifestVersion).toBe(1);
36
+ } finally {
37
+ rmSync(root, { recursive: true, force: true });
38
+ }
39
+ });
40
+ });