chore(react): cleanup build and package.json

This commit is contained in:
moklick
2023-12-26 17:45:39 +01:00
parent 3960c3bf67
commit 12eb2ff0b8
6 changed files with 1238 additions and 819 deletions
+6 -9
View File
@@ -1,6 +1,6 @@
{ {
"name": "@xyflow/react", "name": "@xyflow/react",
"version": "12.0.0", "version": "12.0.0-alpha.0",
"description": "React Flow - A highly customizable React library for building node-based editors and interactive flow charts.", "description": "React Flow - A highly customizable React library for building node-based editors and interactive flow charts.",
"keywords": [ "keywords": [
"react", "react",
@@ -16,7 +16,7 @@
], ],
"source": "src/index.ts", "source": "src/index.ts",
"main": "dist/umd/index.js", "main": "dist/umd/index.js",
"module": "dist/esm/index.mjs", "module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts", "types": "dist/esm/index.d.ts",
"exports": { "exports": {
".": { ".": {
@@ -36,8 +36,8 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/wbkd/react-flow.git", "url": "https://github.com/xyflow/xyflow.git",
"directory": "packages/core" "directory": "packages/react"
}, },
"scripts": { "scripts": {
"dev": "concurrently \"rollup --config node:@xyflow/rollup-config --watch\" pnpm:css-watch", "dev": "concurrently \"rollup --config node:@xyflow/rollup-config --watch\" pnpm:css-watch",
@@ -51,12 +51,10 @@
"@types/d3": "^7.4.0", "@types/d3": "^7.4.0",
"@types/d3-drag": "^3.0.1", "@types/d3-drag": "^3.0.1",
"@types/d3-selection": "^3.0.3", "@types/d3-selection": "^3.0.3",
"@types/d3-zoom": "^3.0.1",
"@xyflow/system": "workspace:*", "@xyflow/system": "workspace:*",
"classcat": "^5.0.3", "classcat": "^5.0.3",
"d3-drag": "^3.0.0", "d3-drag": "^3.0.0",
"d3-selection": "^3.0.0", "d3-selection": "^3.0.0",
"d3-zoom": "^3.0.0",
"zustand": "^4.4.0" "zustand": "^4.4.0"
}, },
"peerDependencies": { "peerDependencies": {
@@ -73,7 +71,7 @@
"autoprefixer": "^10.4.15", "autoprefixer": "^10.4.15",
"cssnano": "^6.0.1", "cssnano": "^6.0.1",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"postcss-cli": "^10.1.0", "postcss-cli": "^11.0.0",
"postcss-combine-duplicated-selectors": "^10.0.3", "postcss-combine-duplicated-selectors": "^10.0.3",
"postcss-import": "^15.1.0", "postcss-import": "^15.1.0",
"postcss-nested": "^6.0.0", "postcss-nested": "^6.0.0",
@@ -85,11 +83,10 @@
"globals": { "globals": {
"classcat": "cc", "classcat": "cc",
"d3-selection": "d3Selection", "d3-selection": "d3Selection",
"d3-zoom": "d3Zoom",
"d3-drag": "d3Drag", "d3-drag": "d3Drag",
"zustand": "zustand", "zustand": "zustand",
"zustand/shallow": "zustandShallow" "zustand/shallow": "zustandShallow"
}, },
"name": "ReactFlowCore" "name": "ReactFlow"
} }
} }
+1
View File
@@ -95,4 +95,5 @@ export {
getStraightPath, getStraightPath,
getViewportForBounds, getViewportForBounds,
getNodesBounds, getNodesBounds,
internalsSymbol,
} from '@xyflow/system'; } from '@xyflow/system';
+2 -1
View File
@@ -103,5 +103,6 @@ export {
type GetStraightPathParams, type GetStraightPathParams,
getStraightPath, getStraightPath,
getViewportForBounds, getViewportForBounds,
getNodesBounds getNodesBounds,
internalsSymbol
} from '@xyflow/system'; } from '@xyflow/system';
+2 -2
View File
@@ -16,7 +16,7 @@
], ],
"source": "src/index.ts", "source": "src/index.ts",
"main": "dist/umd/index.js", "main": "dist/umd/index.js",
"module": "dist/esm/index.mjs", "module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts", "types": "dist/esm/index.d.ts",
"exports": { "exports": {
".": { ".": {
@@ -32,7 +32,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/wbkd/react-flow.git", "url": "https://github.com/xyflow/xyflow.git",
"directory": "packages/system" "directory": "packages/system"
}, },
"scripts": { "scripts": {
+1205 -789
View File
File diff suppressed because it is too large Load Diff
+22 -18
View File
@@ -25,22 +25,23 @@ const onwarn = (warning, rollupWarn) => {
} }
}; };
export const esmConfig = defineConfig({ const defineEsmConfig = (format) =>
input: pkg.source, defineConfig({
output: { input: pkg.source,
file: pkg.module, output: {
format: 'esm', file: format === 'js' ? pkg.module : pkg.module.replace('.js', '.mjs'),
banner: '"use client"', format: 'esm',
}, banner: pkg.rollup?.vanilla ? undefined : '"use client"',
onwarn, },
plugins: [ onwarn,
peerDepsExternal({ plugins: [
includeDependencies: true, peerDepsExternal({
}), includeDependencies: true,
...defaultPlugins, }),
typescript(), ...defaultPlugins,
], typescript(),
}); ],
});
const reactGlobals = { const reactGlobals = {
react: 'React', react: 'React',
@@ -53,7 +54,10 @@ const globals = {
...(pkg.rollup?.globals || {}), ...(pkg.rollup?.globals || {}),
}; };
export const umdConfig = defineConfig({ const esmMjsConfig = defineEsmConfig('mjs');
const esmJsConfig = defineEsmConfig('js');
const umdConfig = defineConfig({
input: pkg.source, input: pkg.source,
output: { output: {
file: pkg.main, file: pkg.main,
@@ -75,4 +79,4 @@ export const umdConfig = defineConfig({
], ],
}); });
export default isProd ? [esmConfig, umdConfig] : esmConfig; export default isProd ? [esmMjsConfig, esmJsConfig, umdConfig] : esmMjsConfig;