@stack-dev/react-styled-components 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,81 @@
1
+
2
+
3
+ > @stack-dev/react-styled-components@0.1.0 build /home/benmclean/projects/stack-dev/packages/react-styled-components
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-styled-components/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] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 10:12:34 p.m.
55
+
56
+ package.json:13:6:
57
+  13 │ "types": "./dist/index.d.ts"
58
+ ╵ ~~~~~~~
59
+
60
+ The "import" condition comes earlier and will be used for all "import" statements:
61
+
62
+ package.json:11:6:
63
+  11 │ "import": "./dist/index.mjs",
64
+ ╵ ~~~~~~~~
65
+
66
+ The "require" condition comes earlier and will be used for all "require" calls:
67
+
68
+ package.json:12:6:
69
+  12 │ "require": "./dist/index.js",
70
+ ╵ ~~~~~~~~~
71
+
72
+
73
+
74
+ CJS dist/index.js 973.00 B
75
+ CJS âšĦ️ Build success in 43ms
76
+ ESM dist/index.mjs 336.00 B
77
+ ESM âšĦ️ Build success in 44ms
78
+ DTS Build start
79
+ DTS âšĦ️ Build success in 2014ms
80
+ DTS dist/index.d.cts 215.00 B
81
+ DTS dist/index.d.ts 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,13 @@
1
+ "use strict";var i=Object.create;var e=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;var m=(o,t)=>{for(var r in t)e(o,r,{get:t[r],enumerable:!0})},p=(o,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!s.call(o,n)&&n!==r&&e(o,n,{get:()=>t[n],enumerable:!(u=c(t,n))||u.enumerable});return o};var x=(o,t,r)=>(r=o!=null?i(l(o)):{},p(t||!o||!o.__esModule?e(r,"default",{value:o,enumerable:!0}):r,o)),a=o=>p(e({},"__esModule",{value:!0}),o);var H={};m(H,{Button:()=>B});module.exports=a(H);var b=x(require("styled-components"),1),d=require("react/jsx-runtime"),g=b.default.button`
2
+ background-color: #007bff;
3
+ color: white;
4
+ padding: 10px 20px;
5
+ border: none;
6
+ border-radius: 4px;
7
+ cursor: pointer;
8
+ font-size: 16px;
9
+
10
+ &:hover {
11
+ background-color: #0056b3;
12
+ }
13
+ `;function B(o){return(0,d.jsx)(g,{...o})}0&&(module.exports={Button});
package/dist/index.mjs ADDED
@@ -0,0 +1,13 @@
1
+ import t from"styled-components";import{jsx as n}from"react/jsx-runtime";var r=t.button`
2
+ background-color: #007bff;
3
+ color: white;
4
+ padding: 10px 20px;
5
+ border: none;
6
+ border-radius: 4px;
7
+ cursor: pointer;
8
+ font-size: 16px;
9
+
10
+ &:hover {
11
+ background-color: #0056b3;
12
+ }
13
+ `;function u(o){return n(r,{...o})}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,51 @@
1
+ {
2
+ "name": "@stack-dev/react-styled-components",
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
+ },
16
+ "peerDependencies": {
17
+ "react": ">=18",
18
+ "react-dom": ">=18",
19
+ "styled-components": ">=6"
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
+ "@types/styled-components": "^5.1.34",
27
+ "@vitest/coverage-v8": "^3.2.4",
28
+ "eslint": "^9.32.0",
29
+ "jsdom": "^25.0.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
+ "styled-components": "^6.1.13",
35
+ "tsup": "^8.0.0",
36
+ "vitest": "^3.2.4",
37
+ "@stack-dev/eslint-config": "0.1.0",
38
+ "@stack-dev/prettier-config": "0.1.0",
39
+ "@stack-dev/typescript-config": "0.1.0"
40
+ },
41
+ "type": "module",
42
+ "sideEffects": false,
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "dev": "tsup --watch",
46
+ "lint": "eslint .",
47
+ "format": "prettier . --write",
48
+ "test": "vitest run",
49
+ "test:watch": "vitest"
50
+ }
51
+ }
@@ -0,0 +1,3 @@
1
+ import base from '@stack-dev/prettier-config/base.mjs';
2
+
3
+ export default base;
@@ -0,0 +1,27 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import { Button } from './button';
3
+
4
+ import { describe, expect, it } from 'vitest';
5
+
6
+ describe('Button', () => {
7
+ it('renders the label correctly', () => {
8
+ render(<Button>Click Me</Button>);
9
+ expect(screen.getByText('Click Me')).toBeDefined();
10
+ });
11
+
12
+ it('is a button element', () => {
13
+ render(<Button>Submit</Button>);
14
+ const buttonElement = screen.getByRole('button');
15
+ expect(buttonElement.tagName).toBe('BUTTON');
16
+ });
17
+
18
+ /* Note: Testing for specific CSS classes with CSS Modules is tricky
19
+ because class names are mangled (e.g., _styledButton_123).
20
+ Usually, we just test that the class attribute exists.
21
+ */
22
+ it('applies a class name', () => {
23
+ render(<Button>Styled</Button>);
24
+ const buttonElement = screen.getByRole('button');
25
+ expect(buttonElement.className).toBeTruthy();
26
+ });
27
+ });
package/src/button.tsx ADDED
@@ -0,0 +1,21 @@
1
+ import { HTMLAttributes } from 'react';
2
+
3
+ import styled from 'styled-components';
4
+
5
+ const StyledButton = styled.button`
6
+ background-color: #007bff;
7
+ color: white;
8
+ padding: 10px 20px;
9
+ border: none;
10
+ border-radius: 4px;
11
+ cursor: pointer;
12
+ font-size: 16px;
13
+
14
+ &:hover {
15
+ background-color: #0056b3;
16
+ }
17
+ `;
18
+
19
+ export function Button(props: HTMLAttributes<HTMLButtonElement>) {
20
+ return <StyledButton {...props} />;
21
+ }
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,16 @@
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', 'styled-components'],
11
+ outExtension({ format }) {
12
+ return {
13
+ js: format === 'esm' ? '.mjs' : '.js',
14
+ };
15
+ },
16
+ });
@@ -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
+ });