Skip to content

Commit 2d9faec

Browse files
authored
graphiql 5: remove UMD builds (#4002)
* upd * upd * upd
1 parent 866a8f3 commit 2d9faec

File tree

13 files changed

+37
-110
lines changed

13 files changed

+37
-110
lines changed

.changeset/good-turtles-speak.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@graphiql/plugin-code-exporter': major
3+
'@graphiql/plugin-explorer': major
4+
'graphiql': major
5+
---
6+
7+
remove UMD builds

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ packages/codemirror-graphql/*.d.ts
4646
packages/codemirror-graphql/*.map
4747
!packages/codemirror-graphql/*.config.js
4848

49-
packages/graphiql/graphiql*.js
50-
packages/graphiql/*.css
51-
packages/graphiql/*.map
5249
packages/graphiql/cypress/screenshots/
50+
packages/graphiql/cypress/downloads/
5351
packages/graphiql/typedoc/
5452
packages/graphiql/webpack/
55-
56-
packages/graphiql/cypress/downloads/

packages/graphiql-plugin-code-exporter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"scripts": {
3030
"types:check": "tsc --noEmit",
3131
"dev": "vite build --watch --emptyOutDir=false",
32-
"build": "vite build && UMD=true vite build",
32+
"build": "vite build",
3333
"postbuild": "cp src/graphiql-code-exporter.d.ts dist/graphiql-code-exporter.d.ts"
3434
},
3535
"dependencies": {

packages/graphiql-plugin-code-exporter/src/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { useOperationsEditorState, type GraphiQLPlugin } from '@graphiql/react';
2-
import React, { FC } from 'react';
2+
import { FC } from 'react';
33
import GraphiQLCodeExporter, {
44
GraphiQLCodeExporterProps,
55
} from 'graphiql-code-exporter';
6-
7-
import './graphiql-code-exporter.d.ts';
86
import './index.css';
97

108
type GraphiQLCodeExporterPluginProps = Omit<GraphiQLCodeExporterProps, 'query'>;

packages/graphiql-plugin-code-exporter/src/vite-env.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
11
{
2-
"compilerOptions": {
3-
"target": "ESNext",
4-
"useDefineForClassFields": true,
5-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
6-
"allowJs": false,
7-
"skipLibCheck": true,
8-
"esModuleInterop": false,
9-
"allowSyntheticDefaultImports": true,
10-
"strict": true,
11-
"forceConsistentCasingInFileNames": true,
12-
"module": "ESNext",
13-
"moduleResolution": "Node",
14-
"resolveJsonModule": true,
15-
"isolatedModules": true,
16-
"declaration": true,
17-
"jsx": "react"
18-
}
2+
"extends": "../graphiql-react/tsconfig.json"
193
}

packages/graphiql-plugin-code-exporter/vite.config.mts

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,28 @@ import react from '@vitejs/plugin-react';
33
import packageJSON from './package.json';
44
import dts from 'vite-plugin-dts';
55

6-
const IS_UMD = process.env.UMD === 'true';
7-
86
export default defineConfig({
9-
plugins: [
10-
react({ jsxRuntime: 'classic' }),
11-
!IS_UMD && dts({ include: ['src/**'] }),
12-
],
7+
plugins: [react(), dts({ include: ['src/**'] })],
138
css: {
149
transformer: 'lightningcss',
1510
},
1611
build: {
17-
minify: IS_UMD
18-
? 'terser' // produce better bundle size than esbuild
19-
: false,
20-
// avoid clean cjs/es builds
21-
emptyOutDir: !IS_UMD,
12+
minify: false,
2213
lib: {
2314
entry: 'src/index.tsx',
24-
fileName: (format, filePath) =>
25-
`${filePath}.${format === 'umd' ? 'umd.' : ''}js`,
26-
name: 'GraphiQLPluginCodeExporter',
27-
formats: IS_UMD ? ['umd'] : ['es'],
15+
fileName: (_format, filePath) => `${filePath}.js`,
16+
formats: ['es'],
2817
cssFileName: 'style',
2918
},
3019
rollupOptions: {
3120
external: [
21+
'react/jsx-runtime',
3222
// Exclude peer dependencies and dependencies from bundle
33-
...Object.keys(packageJSON.peerDependencies),
34-
...(IS_UMD ? [] : Object.keys(packageJSON.dependencies)),
23+
...Object.keys({
24+
...packageJSON.peerDependencies,
25+
...packageJSON.dependencies,
26+
}),
3527
],
36-
output: {
37-
globals: {
38-
'@graphiql/react': 'GraphiQL.React',
39-
graphql: 'GraphiQL.GraphQL',
40-
react: 'React',
41-
'react-dom': 'ReactDOM',
42-
},
43-
},
4428
},
4529
},
4630
});

packages/graphiql-plugin-explorer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"scripts": {
2929
"types:check": "tsc --noEmit",
3030
"dev": "vite build --watch --emptyOutDir=false",
31-
"build": "vite build && UMD=true vite build",
31+
"build": "vite build",
3232
"postbuild": "cp src/graphiql-explorer.d.ts dist/graphiql-explorer.d.ts"
3333
},
3434
"dependencies": {

packages/graphiql-plugin-explorer/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { CSSProperties, FC, useCallback } from 'react';
1+
import { CSSProperties, FC, useCallback } from 'react';
22
import {
33
GraphiQLPlugin,
44
useGraphiQL,
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
11
{
2-
"compilerOptions": {
3-
"target": "ESNext",
4-
"useDefineForClassFields": true,
5-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
6-
"allowJs": false,
7-
"skipLibCheck": true,
8-
"esModuleInterop": false,
9-
"allowSyntheticDefaultImports": true,
10-
"strict": true,
11-
"forceConsistentCasingInFileNames": true,
12-
"module": "ESNext",
13-
"moduleResolution": "Node",
14-
"resolveJsonModule": true,
15-
"isolatedModules": true,
16-
"declaration": true,
17-
"jsx": "react"
18-
}
2+
"extends": "../graphiql-react/tsconfig.json"
193
}

0 commit comments

Comments
 (0)