@typestyles/next 0.0.0-unstable.aecc3ce3af10 → 0.0.0-unstable.b95e47244924
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 +6 -4
- package/package.json +4 -2
- package/src/build.test.ts +14 -14
- package/src/build.ts +3 -1
- package/src/client.d.ts +2 -6
package/README.md
CHANGED
|
@@ -266,9 +266,11 @@ import { tokens } from 'typestyles';
|
|
|
266
266
|
import { getRegisteredCss } from '@typestyles/next';
|
|
267
267
|
|
|
268
268
|
const darkTheme = tokens.createTheme('dark', {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
base: {
|
|
270
|
+
color: {
|
|
271
|
+
background: '#1a1a1a',
|
|
272
|
+
text: '#ffffff',
|
|
273
|
+
},
|
|
272
274
|
},
|
|
273
275
|
});
|
|
274
276
|
|
|
@@ -276,7 +278,7 @@ export default function RootLayout({ children }) {
|
|
|
276
278
|
const css = getRegisteredCss();
|
|
277
279
|
|
|
278
280
|
return (
|
|
279
|
-
<html className={darkTheme}>
|
|
281
|
+
<html className={darkTheme.className}>
|
|
280
282
|
<head>{css && <style dangerouslySetInnerHTML={{ __html: css }} />}</head>
|
|
281
283
|
<body>{children}</body>
|
|
282
284
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typestyles/next",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.b95e47244924",
|
|
4
4
|
"description": "Next.js integration for typestyles SSR",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
+
"eslint": "^9.39.2",
|
|
71
72
|
"vitest": "^3.0.0",
|
|
72
73
|
"@types/node": "^25.2.1",
|
|
73
74
|
"@types/react": "^18.3.12",
|
|
@@ -76,13 +77,14 @@
|
|
|
76
77
|
"react": "^18.0.0",
|
|
77
78
|
"react-dom": "^18.0.0",
|
|
78
79
|
"tsup": "^8.0.0",
|
|
79
|
-
"typestyles": "0.0.0-unstable.
|
|
80
|
+
"typestyles": "0.0.0-unstable.b95e47244924",
|
|
80
81
|
"typescript": "^5.4.0",
|
|
81
82
|
"webpack": "^5.97.1"
|
|
82
83
|
},
|
|
83
84
|
"scripts": {
|
|
84
85
|
"build": "tsup",
|
|
85
86
|
"test": "vitest run",
|
|
87
|
+
"lint": "eslint .",
|
|
86
88
|
"typecheck": "tsc --noEmit"
|
|
87
89
|
}
|
|
88
90
|
}
|
package/src/build.test.ts
CHANGED
|
@@ -7,10 +7,7 @@ type WebpackContext = Parameters<NonNullable<NextConfig['webpack']>>[1];
|
|
|
7
7
|
|
|
8
8
|
describe('withTypestylesExtract', () => {
|
|
9
9
|
it('merges NEXT_PUBLIC_TYPESTYLES_RUNTIME_DISABLED into env for Turbopack + webpack', () => {
|
|
10
|
-
const merged = withTypestylesExtract(
|
|
11
|
-
{ env: { CUSTOM: 'x' } },
|
|
12
|
-
{ disableClientRuntime: true },
|
|
13
|
-
);
|
|
10
|
+
const merged = withTypestylesExtract({ env: { CUSTOM: 'x' } }, { disableClientRuntime: true });
|
|
14
11
|
expect(merged.env).toEqual({
|
|
15
12
|
CUSTOM: 'x',
|
|
16
13
|
NEXT_PUBLIC_TYPESTYLES_RUNTIME_DISABLED: 'true',
|
|
@@ -18,10 +15,7 @@ describe('withTypestylesExtract', () => {
|
|
|
18
15
|
});
|
|
19
16
|
|
|
20
17
|
it('does not override env when disableClientRuntime is false', () => {
|
|
21
|
-
const merged = withTypestylesExtract(
|
|
22
|
-
{ env: { CUSTOM: 'x' } },
|
|
23
|
-
{ disableClientRuntime: false },
|
|
24
|
-
);
|
|
18
|
+
const merged = withTypestylesExtract({ env: { CUSTOM: 'x' } }, { disableClientRuntime: false });
|
|
25
19
|
expect(merged.env).toEqual({ CUSTOM: 'x' });
|
|
26
20
|
});
|
|
27
21
|
|
|
@@ -33,9 +27,12 @@ describe('withTypestylesExtract', () => {
|
|
|
33
27
|
});
|
|
34
28
|
const merged = withTypestylesExtract({ webpack: userWebpack });
|
|
35
29
|
const config = { plugins: [] as unknown[] };
|
|
36
|
-
const result = merged.webpack!(
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
const result = merged.webpack!(
|
|
31
|
+
config as Configuration,
|
|
32
|
+
{
|
|
33
|
+
isServer: false,
|
|
34
|
+
} as WebpackContext,
|
|
35
|
+
);
|
|
39
36
|
expect(userWebpack).toHaveBeenCalled();
|
|
40
37
|
const hasDefine = result.plugins?.some(
|
|
41
38
|
(p: unknown) => p instanceof webpackMod.default.DefinePlugin,
|
|
@@ -47,9 +44,12 @@ describe('withTypestylesExtract', () => {
|
|
|
47
44
|
const webpackMod = await import('webpack');
|
|
48
45
|
const merged = withTypestylesExtract({});
|
|
49
46
|
const config = { plugins: [] as unknown[] };
|
|
50
|
-
const result = merged.webpack!(
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
const result = merged.webpack!(
|
|
48
|
+
config as Configuration,
|
|
49
|
+
{
|
|
50
|
+
isServer: true,
|
|
51
|
+
} as WebpackContext,
|
|
52
|
+
);
|
|
53
53
|
const hasDefine = result.plugins?.some(
|
|
54
54
|
(p: unknown) => p instanceof webpackMod.default.DefinePlugin,
|
|
55
55
|
);
|
package/src/build.ts
CHANGED
|
@@ -28,7 +28,9 @@ export interface BuildTypestylesForNextOptions {
|
|
|
28
28
|
* Extract TypeStyles CSS for a Next.js app (run from a script before `next build`, or in CI).
|
|
29
29
|
* Loads each module path (relative to `root`) so side-effect registrations run, then writes CSS.
|
|
30
30
|
*/
|
|
31
|
-
export async function buildTypestylesForNext(
|
|
31
|
+
export async function buildTypestylesForNext(
|
|
32
|
+
options: BuildTypestylesForNextOptions,
|
|
33
|
+
): Promise<void> {
|
|
32
34
|
const { root, modules, cssOutFile, manifestOutFile, manifestCssPath } = options;
|
|
33
35
|
const loaders = modules.map((mod) => {
|
|
34
36
|
const abs = resolve(root, mod);
|
package/src/client.d.ts
CHANGED
|
@@ -11,9 +11,7 @@ export function useTypestyles(): ReturnType<typeof useSyncExternalStore<string>>
|
|
|
11
11
|
* Re-export of React’s `useServerInsertedHTML` (App Router / streaming SSR).
|
|
12
12
|
* Declared here so consumers get a stable signature even when their `@types/react` predates the hook.
|
|
13
13
|
*/
|
|
14
|
-
export function useServerInsertedHTML(
|
|
15
|
-
callback: () => React.ReactNode | null,
|
|
16
|
-
): void;
|
|
14
|
+
export function useServerInsertedHTML(callback: () => React.ReactNode | null): void;
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* Props for the TypestylesStylesheet component.
|
|
@@ -25,9 +23,7 @@ export interface TypestylesStylesheetProps {
|
|
|
25
23
|
/**
|
|
26
24
|
* A React component that renders typestyles CSS.
|
|
27
25
|
*/
|
|
28
|
-
export function TypestylesStylesheet(
|
|
29
|
-
props: TypestylesStylesheetProps,
|
|
30
|
-
): React.JSX.Element | null;
|
|
26
|
+
export function TypestylesStylesheet(props: TypestylesStylesheetProps): React.JSX.Element | null;
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* Create a Next.js layout export that includes typestyles.
|