@guardian/stand 0.0.2 → 0.0.4

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.
Files changed (47) hide show
  1. package/README.md +41 -0
  2. package/dist/byline/Byline.cjs +8 -1
  3. package/package.json +42 -35
  4. package/.changeset/README.md +0 -8
  5. package/.changeset/config.json +0 -11
  6. package/.prettierrc +0 -1
  7. package/.storybook/main.ts +0 -12
  8. package/.storybook/preview.tsx +0 -83
  9. package/CHANGELOG.md +0 -7
  10. package/dist/types/.storybook/main.d.ts +0 -3
  11. package/dist/types/.storybook/preview.d.ts +0 -3
  12. package/dist/types/jest-setup-after-env.d.ts +0 -1
  13. package/dist/types/src/byline/Byline.stories.d.ts +0 -206
  14. package/dist/types/src/byline/Byline.test.d.ts +0 -1
  15. package/dist/types/src/mocks/prosemirror-view.d.ts +0 -10
  16. package/eslint.config.js +0 -14
  17. package/jest-setup-after-env.ts +0 -1
  18. package/jest.config.js +0 -12
  19. package/rollup.config.js +0 -49
  20. package/src/byline/Byline.stories.tsx +0 -186
  21. package/src/byline/Byline.test.tsx +0 -450
  22. package/src/byline/Byline.tsx +0 -524
  23. package/src/byline/Preview.tsx +0 -59
  24. package/src/byline/contributors-fixture.ts +0 -1006
  25. package/src/byline/lib.test.ts +0 -179
  26. package/src/byline/lib.ts +0 -426
  27. package/src/byline/placeholder.ts +0 -30
  28. package/src/byline/plugins.ts +0 -186
  29. package/src/byline/schema.ts +0 -62
  30. package/src/byline/styles.ts +0 -246
  31. package/src/byline/theme.ts +0 -45
  32. package/src/byline/util.ts +0 -5
  33. package/src/index.ts +0 -2
  34. package/src/mocks/prosemirror-view.ts +0 -19
  35. package/tsconfig.json +0 -19
  36. /package/dist/types/{src/byline → byline}/Byline.d.ts +0 -0
  37. /package/dist/types/{src/byline → byline}/Preview.d.ts +0 -0
  38. /package/dist/types/{src/byline → byline}/contributors-fixture.d.ts +0 -0
  39. /package/dist/types/{src/byline → byline}/lib.d.ts +0 -0
  40. /package/dist/types/{src/byline → byline}/lib.test.d.ts +0 -0
  41. /package/dist/types/{src/byline → byline}/placeholder.d.ts +0 -0
  42. /package/dist/types/{src/byline → byline}/plugins.d.ts +0 -0
  43. /package/dist/types/{src/byline → byline}/schema.d.ts +0 -0
  44. /package/dist/types/{src/byline → byline}/styles.d.ts +0 -0
  45. /package/dist/types/{src/byline → byline}/theme.d.ts +0 -0
  46. /package/dist/types/{src/byline → byline}/util.d.ts +0 -0
  47. /package/dist/types/{src/index.d.ts → index.d.ts} +0 -0
package/README.md CHANGED
@@ -13,3 +13,44 @@ Stand is component library for Guardian editorial tools. It is co-located within
13
13
  - Run `pnpm install` to install dependencies.
14
14
  - Run `pnpm build` to build, this makes any changes available to flexible-frontend
15
15
  - Run `pnpm storybook` to run Storybook
16
+
17
+ ## Contributing
18
+
19
+ See the [Contributing to Stand](./CONTRIBUTING.md) documentation
20
+
21
+ ## Compatibility
22
+
23
+ See the package.json `peerDependencies` section for compatible versions of React and other dependencies that Stand works with.
24
+
25
+ Version sets for matrix testing live in `./scripts/deps-matrix-versions.json`:
26
+
27
+ The test script `./scripts/test-deps-matrix.sh` reads this JSON file first, then applies any environment overrides you supply. Precedence is:
28
+
29
+ 1. Explicit env var (e.g. `REACT_VERSIONS="18.0.0 19.0.0"`)
30
+ 2. Value from `deps-matrix-versions.json`
31
+
32
+ All three variables (`REACT_VERSIONS`, `EMOTION_VERSIONS`, `TS_VERSIONS`) must be defined after loading; otherwise the script exits with an error.
33
+
34
+ Matrix generation in CI uses the same JSON file in the workflow: `../.github/workflows/stand-component-library-deps-matrix.yml` to ensure consistency.
35
+
36
+ ### Updating Supported Versions
37
+
38
+ 1. Edit `./scripts/deps-matrix-versions.json` with new versions
39
+ 2. Run the matrix test locally:
40
+ ```bash
41
+ ./scripts/test-deps-matrix.sh
42
+ ```
43
+ 3. (Optional) Narrow the matrix with overrides:
44
+ ```bash
45
+ REACT_VERSIONS="18.0.0" EMOTION_VERSIONS="11.14.0" TS_VERSIONS="5.1" ./scripts/test-deps-matrix.sh
46
+ ```
47
+ 4. Review results (table output and any failures). Fix issues or adjust code
48
+ 5. Update `peerDependencies` in `package.json` to reflect the new minimum / tested range
49
+ 6. Open a PR, the CI pipeline will comment with the compatibility matrix
50
+
51
+ ### Tips
52
+
53
+ - Keep versions in ascending order for readability
54
+ - Remove deprecated versions only after confirming no downstream tool depends on them
55
+ - Add a new version first, then run the matrix, then adjust `peerDependencies` once green
56
+ - Changes to `peerDependencies` are always a breaking change to the library, as per our [recommendations](https://github.com/guardian/recommendations/blob/main/npm-packages.md#changes-to-peerdependencies-ranges-are-breaking)
@@ -291,7 +291,14 @@ const Byline = ({
291
291
  allowUntaggedContributors
292
292
  ]);
293
293
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.bylineContainerStyles, children: [
294
- /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.bylineEditorStyles(theme?.editor), ref: editorRef, onBlur }),
294
+ /* @__PURE__ */ jsxRuntime.jsx(
295
+ "div",
296
+ {
297
+ css: styles.bylineEditorStyles(theme?.editor),
298
+ ref: editorRef,
299
+ onBlur
300
+ }
301
+ ),
295
302
  /* @__PURE__ */ jsxRuntime.jsx(
296
303
  "div",
297
304
  {
package/package.json CHANGED
@@ -1,59 +1,63 @@
1
1
  {
2
2
  "name": "@guardian/stand",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "exports": {
6
- "types": "./dist/types/src/index.d.ts",
6
+ "types": "./dist/types/index.d.ts",
7
7
  "import": "./dist/index.js",
8
8
  "require": "./dist/index.cjs"
9
9
  },
10
- "main": "./dist/index.cjs",
11
- "types": "./dist/types/src/index.d.ts",
12
- "dependencies": {
13
- "@emotion/react": "11.11.4",
14
- "@guardian/prosemirror-invisibles": "3.1.1",
15
- "prosemirror-dropcursor": "1.8.2",
16
- "prosemirror-history": "1.4.1",
17
- "prosemirror-keymap": "1.2.2",
18
- "prosemirror-model": "1.25.0",
19
- "prosemirror-state": "1.4.3",
20
- "prosemirror-view": "1.37.2",
21
- "react": "17.0.2",
22
- "react-dom": "17.0.2"
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "repository": {
14
+ "url": "https://github.com/guardian/flexible-content",
15
+ "directory": "stand-component-library"
23
16
  },
17
+ "main": "./dist/index.cjs",
18
+ "types": "./dist/types/index.d.ts",
24
19
  "devDependencies": {
25
20
  "@changesets/cli": "^2.29.7",
21
+ "@emotion/react": "11.11.4",
26
22
  "@guardian/eslint-config": "12.0.0",
27
23
  "@guardian/prettier": "8.0.1",
24
+ "@guardian/prosemirror-invisibles": "3.1.1",
28
25
  "@guardian/tsconfig": "1.0.0",
29
- "@rollup/plugin-commonjs": "28.0.6",
30
- "@rollup/plugin-node-resolve": "16.0.1",
31
- "@rollup/plugin-typescript": "12.1.4",
32
- "@storybook/addon-docs": "^9.1.7",
33
- "@storybook/addon-themes": "^9.1.7",
34
- "@storybook/react-vite": "^9.1.7",
35
- "@testing-library/jest-dom": "6.8.0",
36
- "@testing-library/react": "12.1.5",
37
- "@testing-library/user-event": "14.6.1",
26
+ "@playwright/experimental-ct-react17": "^1.56.1",
27
+ "@rollup/plugin-commonjs": "28.0.9",
28
+ "@rollup/plugin-node-resolve": "16.0.3",
29
+ "@rollup/plugin-typescript": "12.3.0",
30
+ "@storybook/addon-docs": "^9.1.15",
31
+ "@storybook/addon-themes": "^9.1.15",
32
+ "@storybook/react-vite": "^9.1.15",
38
33
  "@types/jest": "30.0.0",
34
+ "@types/node": "^24.9.1",
39
35
  "@types/react": "17.0.76",
40
36
  "@types/react-dom": "17.0.25",
41
- "eslint": "9.36.0",
42
- "eslint-plugin-storybook": "^9.1.7",
43
- "jest": "30.1.3",
37
+ "eslint": "9.38.0",
38
+ "eslint-plugin-storybook": "^9.1.15",
39
+ "jest": "30.2.0",
44
40
  "jest-environment-jsdom": "^30.1.2",
45
41
  "prettier": "3.6.2",
42
+ "prosemirror-dropcursor": "1.8.2",
43
+ "prosemirror-history": "1.4.1",
44
+ "prosemirror-keymap": "1.2.2",
45
+ "prosemirror-model": "1.25.0",
46
+ "prosemirror-state": "1.4.3",
47
+ "prosemirror-view": "1.37.2",
48
+ "react": "17.0.2",
49
+ "react-dom": "17.0.2",
46
50
  "rimraf": "6.0.1",
47
- "rollup": "4.52.1",
51
+ "rollup": "4.52.5",
48
52
  "rollup-plugin-esbuild": "6.2.1",
49
53
  "rollup-plugin-node-externals": "8.1.1",
50
- "storybook": "^9.1.7",
51
- "ts-jest": "29.4.4",
54
+ "storybook": "^9.1.15",
55
+ "ts-jest": "29.4.5",
52
56
  "tslib": "2.8.1",
53
57
  "typescript": "5.1.3"
54
58
  },
55
59
  "peerDependencies": {
56
- "@emotion/react": "11.11.4",
60
+ "@emotion/react": ">=11.11.4 <=11.14.0",
57
61
  "@guardian/prosemirror-invisibles": "3.1.1",
58
62
  "prosemirror-dropcursor": "1.8.2",
59
63
  "prosemirror-history": "1.4.1",
@@ -61,14 +65,17 @@
61
65
  "prosemirror-model": "1.25.0",
62
66
  "prosemirror-state": "1.4.3",
63
67
  "prosemirror-view": "1.37.2",
64
- "react": "^17.0.2",
65
- "react-dom": "^17.0.2",
66
- "typescript": "5.5.2"
68
+ "react": "^17.0.2 || ^18.0.0 || ^19.0.0",
69
+ "react-dom": "^17.0.2 || ^18.0.0 || ^19.0.0",
70
+ "typescript": ">=5.0.0 <=5.9.3"
67
71
  },
68
72
  "scripts": {
69
73
  "build": "rimraf dist && rollup -c",
70
74
  "storybook": "storybook dev -p 6007",
71
75
  "build-storybook": "storybook build",
72
- "test": "jest"
76
+ "tsc": "tsc",
77
+ "test": "jest",
78
+ "test:e2e": "playwright test -c playwright-ct.config.ts",
79
+ "test:react-matrix": "./scripts/test-react-matrix.sh"
73
80
  }
74
81
  }
@@ -1,8 +0,0 @@
1
- # Changesets
2
-
3
- Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
- with multi-package repos, or single-package repos to help you version and publish your code. You can
5
- find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
-
7
- We have a quick list of common questions to get you started engaging with this project in
8
- [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3
- "changelog": "@changesets/cli/changelog",
4
- "commit": false,
5
- "fixed": [],
6
- "linked": [],
7
- "access": "public",
8
- "baseBranch": "main",
9
- "updateInternalDependencies": "patch",
10
- "ignore": []
11
- }
package/.prettierrc DELETED
@@ -1 +0,0 @@
1
- "@guardian/prettier"
@@ -1,12 +0,0 @@
1
- import type { StorybookConfig } from '@storybook/react-vite';
2
-
3
- const config: StorybookConfig = {
4
- stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
5
- addons: ['@storybook/addon-docs'],
6
- framework: {
7
- name: '@storybook/react-vite',
8
- options: {},
9
- },
10
- };
11
-
12
- export default config;
@@ -1,83 +0,0 @@
1
- import { Global } from '@emotion/react';
2
- import { css } from '@emotion/react';
3
- import { withThemeFromJSXProvider } from '@storybook/addon-themes';
4
- import type { Preview } from '@storybook/react-vite';
5
-
6
- const ASSETS_URL = 'https://interactive.guim.co.uk/fonts/guss-webfonts/';
7
-
8
- const Fonts = css`
9
- @font-face {
10
- font-family: 'Guardian Agate Sans';
11
- src: url('${ASSETS_URL}GuardianAgateSans1Web/GuardianAgateSans1Web-Regular.woff2')
12
- format('woff2');
13
- font-weight: 400;
14
- font-style: 'normal';
15
- font-display: 'fallback';
16
- }
17
- @font-face {
18
- font-family: 'Guardian Agate Sans';
19
- src: url('${ASSETS_URL}GuardianAgateSans1Web/GuardianAgateSans1Web-Bold.woff2')
20
- format('woff2');
21
- font-weight: 700;
22
- font-style: normal;
23
- font-display: swap;
24
- }
25
- @font-face {
26
- font-family: 'Guardian Agate Sans';
27
- src: url('${ASSETS_URL}GuardianAgateSans1Web/GuardianAgateSans1Web-RegularItalic.woff2')
28
- format('woff2');
29
- font-weight: 400;
30
- font-style: italic;
31
- font-display: swap;
32
- }
33
- @font-face {
34
- font-family: 'Guardian Agate Sans';
35
- src: url('${ASSETS_URL}GuardianAgateSans1Web/GuardianAgateSans1Web-BoldItalic.woff2')
36
- format('woff2');
37
- font-weight: 700;
38
- font-style: italic;
39
- font-display: swap;
40
- }
41
- `;
42
-
43
- const globalFont = {
44
- fontFamily: '"Guardian Agate Sans", "Arial", sans-serif',
45
- fontSize: '13px',
46
- lineHeight: '1.2',
47
- color: '#292929',
48
- };
49
-
50
- const globalStyles = css({
51
- html: {
52
- height: '100vh',
53
- width: '100vw',
54
- },
55
- body: {
56
- ...globalFont,
57
- minHeight: '100vh',
58
- width: '100vw',
59
- margin: '0 auto',
60
- },
61
- });
62
-
63
- const GlobalStyles = () => <Global styles={[Fonts, globalStyles]} />;
64
-
65
- const preview: Preview = {
66
- parameters: {
67
- controls: {
68
- matchers: {
69
- color: /(background|color)$/i,
70
- date: /Date$/i,
71
- },
72
- },
73
- },
74
- decorators: [
75
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call -- withThemeFromJSXProvider is a valid function
76
- withThemeFromJSXProvider({
77
- GlobalStyles, // Adds GlobalStyles to all stories
78
- }),
79
- ],
80
- };
81
-
82
- // eslint-disable-next-line import/no-default-export -- storybook expects default
83
- export default preview;
package/CHANGELOG.md DELETED
@@ -1,7 +0,0 @@
1
- # @guardian/stand
2
-
3
- ## 0.0.2
4
-
5
- ### Patch Changes
6
-
7
- - cf56688: Add changesets
@@ -1,3 +0,0 @@
1
- import type { StorybookConfig } from '@storybook/react-vite';
2
- declare const config: StorybookConfig;
3
- export default config;
@@ -1,3 +0,0 @@
1
- import type { Preview } from '@storybook/react-vite';
2
- declare const preview: Preview;
3
- export default preview;
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,206 +0,0 @@
1
- /// <reference types="react" />
2
- import type { TaggedContributor } from './lib';
3
- declare const meta: {
4
- title: string;
5
- component: ({ theme, allowUntaggedContributors, contributorLimit, enablePreview, placeholder, initialValue, readOnly, handleSave, searchContributors, onBlur, }: {
6
- theme?: {
7
- editor?: {
8
- invisibles?: {
9
- color?: string | undefined;
10
- } | undefined;
11
- color?: string | undefined;
12
- border?: string | undefined;
13
- background?: string | undefined;
14
- chip?: {
15
- color?: string | undefined;
16
- border?: string | undefined;
17
- padding?: string | undefined;
18
- borderRadius?: string | undefined;
19
- taggedBackground?: string | undefined;
20
- untagged?: {
21
- color?: string | undefined;
22
- } | undefined;
23
- selected?: {
24
- border?: string | undefined;
25
- } | undefined;
26
- } | undefined;
27
- lineHeight?: string | undefined;
28
- placeholder?: {
29
- color?: string | undefined;
30
- } | undefined;
31
- readOnlyBackground?: string | undefined;
32
- } | undefined;
33
- dropdown?: {
34
- background?: string | undefined;
35
- border?: string | undefined;
36
- maxHeight?: string | undefined;
37
- li?: {
38
- color?: string | undefined;
39
- borderBottom?: string | undefined;
40
- selected?: {
41
- background?: string | undefined;
42
- color?: string | undefined;
43
- } | undefined;
44
- } | undefined;
45
- } | undefined;
46
- } | undefined;
47
- allowUntaggedContributors?: boolean | undefined;
48
- contributorLimit?: number | undefined;
49
- enablePreview?: boolean | undefined;
50
- placeholder?: string | undefined;
51
- initialValue?: import("./lib").BylineModel | undefined;
52
- readOnly?: boolean | undefined;
53
- handleSave: (newValue: import("./lib").BylineModel) => void;
54
- searchContributors?: ((selectedText: string) => Promise<TaggedContributor[]>) | undefined;
55
- onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
56
- }) => import("@emotion/react/jsx-runtime").JSX.Element;
57
- parameters: {};
58
- args: {
59
- handleSave: () => void;
60
- initialValue: never[];
61
- searchContributors: (selectedText: string) => Promise<TaggedContributor[]>;
62
- enablePreview: true;
63
- };
64
- };
65
- export declare const Default: {};
66
- export declare const WithTheme: {
67
- args: {
68
- allowUntaggedContributors: true;
69
- searchContributors: (selectedText: string) => Promise<TaggedContributor[]>;
70
- theme: {
71
- editor: {
72
- invisibles: {
73
- color: string;
74
- };
75
- color: string;
76
- background: string;
77
- border: string;
78
- chip: {
79
- color: string;
80
- taggedBackground: string;
81
- border: string;
82
- borderRadius: string;
83
- padding: string;
84
- untagged: {
85
- color: string;
86
- };
87
- };
88
- };
89
- dropdown: {
90
- background: string;
91
- li: {
92
- color: string;
93
- borderBottom: string;
94
- selected: {
95
- color: string;
96
- background: string;
97
- };
98
- };
99
- };
100
- };
101
- };
102
- };
103
- export declare const WithUntaggedContributors: {
104
- parameters: {
105
- chromatic: {
106
- disableSnapshot: boolean;
107
- };
108
- };
109
- args: {
110
- allowUntaggedContributors: true;
111
- };
112
- };
113
- export declare const WithInitialValue: {
114
- args: {
115
- allowUntaggedContributors: true;
116
- initialValue: ({
117
- type: "contributor";
118
- value: string;
119
- tagId: string;
120
- path: string;
121
- } | {
122
- type: "text";
123
- value: string;
124
- tagId?: undefined;
125
- path?: undefined;
126
- } | {
127
- type: "contributor";
128
- value: string;
129
- tagId?: undefined;
130
- path?: undefined;
131
- })[];
132
- };
133
- };
134
- export declare const WithNoSearch: {
135
- parameters: {
136
- chromatic: {
137
- disableSnapshot: boolean;
138
- };
139
- };
140
- args: {
141
- allowUntaggedContributors: true;
142
- searchContributors: undefined;
143
- };
144
- };
145
- export declare const WithNoSearchAndNoUntagged: {
146
- parameters: {
147
- chromatic: {
148
- disableSnapshot: boolean;
149
- };
150
- };
151
- args: {
152
- allowUntaggedContributors: false;
153
- searchContributors: undefined;
154
- };
155
- };
156
- export declare const WithCustomPlaceholder: {
157
- args: {
158
- allowUntaggedContributors: true;
159
- placeholder: string;
160
- };
161
- };
162
- export declare const WithContributorLimit: {
163
- parameters: {
164
- chromatic: {
165
- disableSnapshot: boolean;
166
- };
167
- };
168
- args: {
169
- contributorLimit: number;
170
- };
171
- };
172
- export declare const WithoutPreview: {
173
- parameters: {
174
- chromatic: {
175
- disableSnapshot: boolean;
176
- };
177
- };
178
- args: {
179
- allowUntaggedContributors: true;
180
- enablePreview: false;
181
- };
182
- };
183
- export declare const ReadOnly: {
184
- args: {
185
- readOnly: true;
186
- allowUntaggedContributors: true;
187
- enablePreview: true;
188
- initialValue: ({
189
- type: "contributor";
190
- value: string;
191
- tagId: string;
192
- path: string;
193
- } | {
194
- type: "text";
195
- value: string;
196
- tagId?: undefined;
197
- path?: undefined;
198
- } | {
199
- type: "contributor";
200
- value: string;
201
- tagId?: undefined;
202
- path?: undefined;
203
- })[];
204
- };
205
- };
206
- export default meta;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- declare const mockEditorViewMethods: {
2
- posAtCoords: () => null;
3
- coordsAtPos: () => {
4
- left: number;
5
- right: number;
6
- top: number;
7
- bottom: number;
8
- };
9
- };
10
- export { mockEditorViewMethods };
package/eslint.config.js DELETED
@@ -1,14 +0,0 @@
1
- // For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
2
- import storybook from 'eslint-plugin-storybook';
3
-
4
- import guardian from '@guardian/eslint-config';
5
-
6
- export default [
7
- {
8
- ignores: ['dist'],
9
- },
10
- ...guardian.configs.recommended,
11
- ...guardian.configs.jest,
12
- ...guardian.configs.react,
13
- ...storybook.configs['flat/recommended'],
14
- ];
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
package/jest.config.js DELETED
@@ -1,12 +0,0 @@
1
- import { createDefaultPreset } from 'ts-jest';
2
-
3
- const tsJestTransformCfg = createDefaultPreset().transform;
4
-
5
- /** @type {import("jest").Config} **/
6
- export default {
7
- testEnvironment: 'jsdom',
8
- setupFilesAfterEnv: ['<rootDir>/jest-setup-after-env.ts'],
9
- transform: {
10
- ...tsJestTransformCfg,
11
- },
12
- };
package/rollup.config.js DELETED
@@ -1,49 +0,0 @@
1
- import commonjs from '@rollup/plugin-commonjs';
2
- import resolve from '@rollup/plugin-node-resolve';
3
- import typescript from '@rollup/plugin-typescript';
4
- import esbuild from 'rollup-plugin-esbuild';
5
- import { nodeExternals } from 'rollup-plugin-node-externals';
6
-
7
- /**
8
- * @returns {import("rollup").RollupOptions[]}
9
- */
10
- export default [
11
- {
12
- input: 'src/index.ts',
13
- output: {
14
- dir: 'dist',
15
- format: 'esm',
16
- preserveModules: true,
17
- preserveModulesRoot: 'src',
18
- },
19
- plugins: [
20
- resolve(),
21
- nodeExternals(),
22
- esbuild({
23
- jsx: 'automatic',
24
- }),
25
- typescript({
26
- tsconfig: './tsconfig.json',
27
- outDir: 'dist/types',
28
- }),
29
- ],
30
- },
31
- {
32
- input: 'src/index.ts',
33
- output: {
34
- dir: 'dist',
35
- format: 'cjs',
36
- preserveModules: true,
37
- preserveModulesRoot: 'src',
38
- entryFileNames: '[name].cjs',
39
- },
40
- plugins: [
41
- resolve(),
42
- nodeExternals(),
43
- commonjs(),
44
- esbuild({
45
- jsx: 'automatic',
46
- }),
47
- ],
48
- },
49
- ];