@stack-dev/react-css 0.1.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/.turbo/turbo-build.log +99 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/eslint.config.mjs +10 -0
- package/package.json +50 -0
- package/prettier.config.mjs +3 -0
- package/src/button.module.css +8 -0
- package/src/button.spec.tsx +25 -0
- package/src/button.tsx +11 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +7 -0
- package/tsup.config.ts +17 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @stack-dev/react-css@0.1.0 build /home/benmclean/projects/stack-dev/packages/react-css
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[33mâ² [43;33m[[43;30mWARNING[43;33m][0m [1mThe condition "types" here will never be used as it comes after both "import" and "require"[0m [package.json]
|
|
7
|
+
|
|
8
|
+
package.json:13:6:
|
|
9
|
+
[37m 13 â [32m"types"[37m: "./dist/index.d.ts"
|
|
10
|
+
âµ [32m~~~~~~~[0m
|
|
11
|
+
|
|
12
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
13
|
+
|
|
14
|
+
package.json:11:6:
|
|
15
|
+
[37m 11 â [32m"import"[37m: "./dist/index.mjs",
|
|
16
|
+
âµ [32m~~~~~~~~[0m
|
|
17
|
+
|
|
18
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
19
|
+
|
|
20
|
+
package.json:12:6:
|
|
21
|
+
[37m 12 â [32m"require"[37m: "./dist/index.js",
|
|
22
|
+
âµ [32m~~~~~~~~~[0m
|
|
23
|
+
|
|
24
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
25
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
26
|
+
[34mCLI[39m tsup v8.5.1
|
|
27
|
+
[34mCLI[39m Using tsup config: /home/benmclean/projects/stack-dev/packages/react-css/tsup.config.ts
|
|
28
|
+
[34mCLI[39m Target: esnext
|
|
29
|
+
[34mCLI[39m Cleaning output folder
|
|
30
|
+
[34mCJS[39m Build start
|
|
31
|
+
[34mESM[39m Build start
|
|
32
|
+
|
|
33
|
+
[43m[30m WARN [39m[49m [33mâ² [43;33m[[43;30mWARNING[43;33m][0m [1mThe condition "types" here will never be used as it comes after both "import" and "require"[0m [package.json] [90m10:12:34 p.m.[39m
|
|
34
|
+
|
|
35
|
+
package.json:13:6:
|
|
36
|
+
[37m 13 â [32m"types"[37m: "./dist/index.d.ts"
|
|
37
|
+
âµ [32m~~~~~~~[0m
|
|
38
|
+
|
|
39
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
40
|
+
|
|
41
|
+
package.json:11:6:
|
|
42
|
+
[37m 11 â [32m"import"[37m: "./dist/index.mjs",
|
|
43
|
+
âµ [32m~~~~~~~~[0m
|
|
44
|
+
|
|
45
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
46
|
+
|
|
47
|
+
package.json:12:6:
|
|
48
|
+
[37m 12 â [32m"require"[37m: "./dist/index.js",
|
|
49
|
+
âµ [32m~~~~~~~~~[0m
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
[43m[30m WARN [39m[49m [33mâ² [43;33m[[43;30mWARNING[43;33m][0m [1mImport "styledButton" will always be undefined because the file "src/button.module.css" has no exports[0m [import-is-undefined] [90m10:12:34 p.m.[39m
|
|
55
|
+
|
|
56
|
+
src/button.tsx:7:30:
|
|
57
|
+
[37m 7 â <button className={styles.[32mstyledButton[37m} {...props}>
|
|
58
|
+
âµ [32m~~~~~~~~~~~~[0m
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
[43m[30m WARN [39m[49m [33mâ² [43;33m[[43;30mWARNING[43;33m][0m [1mThe condition "types" here will never be used as it comes after both "import" and "require"[0m [package.json] [90m10:12:34 p.m.[39m
|
|
64
|
+
|
|
65
|
+
package.json:13:6:
|
|
66
|
+
[37m 13 â [32m"types"[37m: "./dist/index.d.ts"
|
|
67
|
+
âµ [32m~~~~~~~[0m
|
|
68
|
+
|
|
69
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
70
|
+
|
|
71
|
+
package.json:11:6:
|
|
72
|
+
[37m 11 â [32m"import"[37m: "./dist/index.mjs",
|
|
73
|
+
âµ [32m~~~~~~~~[0m
|
|
74
|
+
|
|
75
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
76
|
+
|
|
77
|
+
package.json:12:6:
|
|
78
|
+
[37m 12 â [32m"require"[37m: "./dist/index.js",
|
|
79
|
+
âµ [32m~~~~~~~~~[0m
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
[43m[30m WARN [39m[49m [33mâ² [43;33m[[43;30mWARNING[43;33m][0m [1mImport "styledButton" will always be undefined because the file "src/button.module.css" has no exports[0m [import-is-undefined] [90m10:12:34 p.m.[39m
|
|
85
|
+
|
|
86
|
+
src/button.tsx:7:30:
|
|
87
|
+
[37m 7 â <button className={styles.[32mstyledButton[37m} {...props}>
|
|
88
|
+
âµ [32m~~~~~~~~~~~~[0m
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
[32mCJS[39m [1mdist/index.js [22m[32m1.03 KB[39m
|
|
93
|
+
[32mCJS[39m âĦï¸ Build success in 76ms
|
|
94
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m572.00 B[39m
|
|
95
|
+
[32mESM[39m âĦï¸ Build success in 75ms
|
|
96
|
+
DTS Build start
|
|
97
|
+
DTS âĦï¸ Build success in 1108ms
|
|
98
|
+
DTS dist/index.d.ts 215.00 B
|
|
99
|
+
DTS dist/index.d.mts 215.00 B
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},a=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of f(t))!c.call(e,r)&&r!==n&&d(e,r,{get:()=>t[r],enumerable:!(o=u(t,r))||o.enumerable});return e};var m=e=>a(d({},"__esModule",{value:!0}),e);var h={};p(h,{Button:()=>y});module.exports=m(h);function s(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",t==="top"&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}s(`.styledButton{background:#00f;color:#fff;padding:10px;border:none;border-radius:4px;cursor:pointer}
|
|
2
|
+
`);var i=require("react/jsx-runtime");function y(e){return(0,i.jsx)("button",{className:void 0,...e,children:e.children})}0&&(module.exports={Button});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function o(t,{insertAt:d}={}){if(!t||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",d==="top"&&n.firstChild?n.insertBefore(e,n.firstChild):n.appendChild(e),e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}o(`.styledButton{background:#00f;color:#fff;padding:10px;border:none;border-radius:4px;cursor:pointer}
|
|
2
|
+
`);import{jsx as s}from"react/jsx-runtime";function u(t){return s("button",{className:void 0,...t,children:t.children})}export{u as Button};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stack-dev/react-css",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"development": "./src/index.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./index.css": "./dist/index.css"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": ">=18",
|
|
19
|
+
"react-dom": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
23
|
+
"@testing-library/react": "^16.0.0",
|
|
24
|
+
"@types/react": "^18.3.1",
|
|
25
|
+
"@types/react-dom": "^18.3.1",
|
|
26
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
27
|
+
"eslint": "^9.32.0",
|
|
28
|
+
"jsdom": "^25.0.0",
|
|
29
|
+
"postcss": "^8.4.0",
|
|
30
|
+
"prettier": "^3.6.2",
|
|
31
|
+
"prettier-plugin-organize-imports": "^4.2.0",
|
|
32
|
+
"react": "^18.3.1",
|
|
33
|
+
"react-dom": "^18.3.1",
|
|
34
|
+
"tsup": "^8.0.0",
|
|
35
|
+
"vitest": "^3.2.4",
|
|
36
|
+
"@stack-dev/prettier-config": "0.1.0",
|
|
37
|
+
"@stack-dev/typescript-config": "0.1.0",
|
|
38
|
+
"@stack-dev/eslint-config": "0.1.0"
|
|
39
|
+
},
|
|
40
|
+
"sideEffects": [
|
|
41
|
+
"**/*.css"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup",
|
|
45
|
+
"lint": "eslint .",
|
|
46
|
+
"format": "prettier . --write",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:watch": "vitest"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
|
+
import { Button } from './button';
|
|
3
|
+
|
|
4
|
+
describe('Button', () => {
|
|
5
|
+
it('renders the label correctly', () => {
|
|
6
|
+
render(<Button label="Click Me" />);
|
|
7
|
+
expect(screen.getByText('Click Me')).toBeDefined();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('is a button element', () => {
|
|
11
|
+
render(<Button label="Submit" />);
|
|
12
|
+
const buttonElement = screen.getByRole('button');
|
|
13
|
+
expect(buttonElement.tagName).toBe('BUTTON');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/* Note: Testing for specific CSS classes with CSS Modules is tricky
|
|
17
|
+
because class names are mangled (e.g., _styledButton_123).
|
|
18
|
+
Usually, we just test that the class attribute exists.
|
|
19
|
+
*/
|
|
20
|
+
it('applies a class name', () => {
|
|
21
|
+
render(<Button label="Styled" />);
|
|
22
|
+
const buttonElement = screen.getByRole('button');
|
|
23
|
+
expect(buttonElement.className).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
package/src/button.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
import * as styles from './button.module.css';
|
|
4
|
+
|
|
5
|
+
export function Button(props: HTMLAttributes<HTMLButtonElement>) {
|
|
6
|
+
return (
|
|
7
|
+
<button className={styles.styledButton} {...props}>
|
|
8
|
+
{props.children}
|
|
9
|
+
</button>
|
|
10
|
+
);
|
|
11
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button';
|
package/tsconfig.json
ADDED
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['cjs', 'esm'],
|
|
6
|
+
dts: true,
|
|
7
|
+
minify: true,
|
|
8
|
+
clean: true,
|
|
9
|
+
splitting: false,
|
|
10
|
+
external: ['react', 'react-dom'],
|
|
11
|
+
injectStyle: true,
|
|
12
|
+
outExtension({ format }) {
|
|
13
|
+
return {
|
|
14
|
+
js: format === 'esm' ? '.mjs' : '.js',
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
});
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [react()],
|
|
6
|
+
test: {
|
|
7
|
+
globals: true,
|
|
8
|
+
environment: 'jsdom',
|
|
9
|
+
coverage: {
|
|
10
|
+
provider: 'v8',
|
|
11
|
+
reporter: ['text', 'json', 'html'],
|
|
12
|
+
},
|
|
13
|
+
css: true,
|
|
14
|
+
},
|
|
15
|
+
});
|