@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.
@@ -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
+ ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json]
7
+
8
+ package.json:13:6:
9
+  13 │ "types": "./dist/index.d.ts"
10
+ ╵ ~~~~~~~
11
+
12
+ The "import" condition comes earlier and will be used for all "import" statements:
13
+
14
+ package.json:11:6:
15
+  11 │ "import": "./dist/index.mjs",
16
+ ╵ ~~~~~~~~
17
+
18
+ The "require" condition comes earlier and will be used for all "require" calls:
19
+
20
+ package.json:12:6:
21
+  12 │ "require": "./dist/index.js",
22
+ ╵ ~~~~~~~~~
23
+
24
+ CLI Building entry: src/index.ts
25
+ CLI Using tsconfig: tsconfig.json
26
+ CLI tsup v8.5.1
27
+ CLI Using tsup config: /home/benmclean/projects/stack-dev/packages/react-css/tsup.config.ts
28
+ CLI Target: esnext
29
+ CLI Cleaning output folder
30
+ CJS Build start
31
+ ESM Build start
32
+
33
+  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 10:12:34 p.m.
34
+
35
+ package.json:13:6:
36
+  13 │ "types": "./dist/index.d.ts"
37
+ ╵ ~~~~~~~
38
+
39
+ The "import" condition comes earlier and will be used for all "import" statements:
40
+
41
+ package.json:11:6:
42
+  11 │ "import": "./dist/index.mjs",
43
+ ╵ ~~~~~~~~
44
+
45
+ The "require" condition comes earlier and will be used for all "require" calls:
46
+
47
+ package.json:12:6:
48
+  12 │ "require": "./dist/index.js",
49
+ ╵ ~~~~~~~~~
50
+
51
+
52
+
53
+
54
+  WARN  ▲ [WARNING] Import "styledButton" will always be undefined because the file "src/button.module.css" has no exports [import-is-undefined] 10:12:34 p.m.
55
+
56
+ src/button.tsx:7:30:
57
+  7 │ <button className={styles.styledButton} {...props}>
58
+ ╵ ~~~~~~~~~~~~
59
+
60
+
61
+
62
+
63
+  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 10:12:34 p.m.
64
+
65
+ package.json:13:6:
66
+  13 │ "types": "./dist/index.d.ts"
67
+ ╵ ~~~~~~~
68
+
69
+ The "import" condition comes earlier and will be used for all "import" statements:
70
+
71
+ package.json:11:6:
72
+  11 │ "import": "./dist/index.mjs",
73
+ ╵ ~~~~~~~~
74
+
75
+ The "require" condition comes earlier and will be used for all "require" calls:
76
+
77
+ package.json:12:6:
78
+  12 │ "require": "./dist/index.js",
79
+ ╵ ~~~~~~~~~
80
+
81
+
82
+
83
+
84
+  WARN  ▲ [WARNING] Import "styledButton" will always be undefined because the file "src/button.module.css" has no exports [import-is-undefined] 10:12:34 p.m.
85
+
86
+ src/button.tsx:7:30:
87
+  7 │ <button className={styles.styledButton} {...props}>
88
+ ╵ ~~~~~~~~~~~~
89
+
90
+
91
+
92
+ CJS dist/index.js 1.03 KB
93
+ CJS âšĦ️ Build success in 76ms
94
+ ESM dist/index.mjs 572.00 B
95
+ ESM âšĦ️ 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
@@ -0,0 +1,6 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { HTMLAttributes } from 'react';
3
+
4
+ declare function Button(props: HTMLAttributes<HTMLButtonElement>): react_jsx_runtime.JSX.Element;
5
+
6
+ export { Button };
@@ -0,0 +1,6 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { HTMLAttributes } from 'react';
3
+
4
+ declare function Button(props: HTMLAttributes<HTMLButtonElement>): react_jsx_runtime.JSX.Element;
5
+
6
+ export { Button };
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};
@@ -0,0 +1,10 @@
1
+ import base from '@stack-dev/eslint-config/base.mjs';
2
+ import react from '@stack-dev/eslint-config/react.mjs';
3
+
4
+ export default [
5
+ ...base,
6
+ ...react,
7
+ {
8
+ ignores: ['**/dist/**', '**/coverage/**']
9
+ }
10
+ ];
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,3 @@
1
+ import base from '@stack-dev/prettier-config/base.mjs';
2
+
3
+ export default base;
@@ -0,0 +1,8 @@
1
+ .styledButton {
2
+ background: blue;
3
+ color: white;
4
+ padding: 10px;
5
+ border: none;
6
+ border-radius: 4px;
7
+ cursor: pointer;
8
+ }
@@ -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
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "@stack-dev/typescript-config/tsconfig.react.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist"
5
+ },
6
+ "include": ["src"]
7
+ }
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
+ });
@@ -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
+ });