Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

build: use webstudio export condition for tools (#2347)

Bogdan Chadkinfb5414f93dcb
diff --git a/apps/builder/.storybook/main.ts b/apps/builder/.storybook/main.ts
index 8741ccc9d2..0d54eb4295 100644
--- a/apps/builder/.storybook/main.ts
+++ b/apps/builder/.storybook/main.ts
@@ -16,7 +16,7 @@ export default {
},
resolve: {
...config.resolve,
- conditions: ["source", "import", "module", "browser", "default"],
+ conditions: ["webstudio", "import", "module", "browser", "default"],
alias: [
{
find: "~",
diff --git a/fixtures/webstudio-custom-template/tsconfig.json b/fixtures/webstudio-custom-template/tsconfig.json
index b93e0d4486..c760c76b13 100644
--- a/fixtures/webstudio-custom-template/tsconfig.json
+++ b/fixtures/webstudio-custom-template/tsconfig.json
@@ -17,7 +17,7 @@
"paths": {
"~/*": ["./app/*"]
},
- "customConditions": ["source"],
+ "customConditions": ["webstudio"],
// Remix takes care of building everything in `remix build`.
"noEmit": true,
diff --git a/fixtures/webstudio-remix-vercel/tsconfig.json b/fixtures/webstudio-remix-vercel/tsconfig.json
index b93e0d4486..c760c76b13 100644
--- a/fixtures/webstudio-remix-vercel/tsconfig.json
+++ b/fixtures/webstudio-remix-vercel/tsconfig.json
@@ -17,7 +17,7 @@
"paths": {
"~/*": ["./app/*"]
},
- "customConditions": ["source"],
+ "customConditions": ["webstudio"],
// Remix takes care of building everything in `remix build`.
"noEmit": true,
diff --git a/packages/asset-uploader/package.json b/packages/asset-uploader/package.json
index d71ba6f722..5dcc24146f 100644
--- a/packages/asset-uploader/package.json
+++ b/packages/asset-uploader/package.json
@@ -38,12 +38,12 @@
},
"exports": {
".": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
"./index.server": {
- "source": "./src/index.server.ts",
+ "webstudio": "./src/index.server.ts",
"types": "./lib/types/index.server.d.ts",
"import": "./lib/index.server.js"
}
diff --git a/packages/authorization-token/package.json b/packages/authorization-token/package.json
index c766070200..8d9a098b83 100644
--- a/packages/authorization-token/package.json
+++ b/packages/authorization-token/package.json
@@ -23,12 +23,12 @@
},
"exports": {
".": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
"./index.server": {
- "source": "./src/index.server.ts",
+ "webstudio": "./src/index.server.ts",
"types": "./lib/types/index.server.d.ts",
"import": "./lib/index.server.js"
}
diff --git a/packages/cli/templates/defaults/tsconfig.json b/packages/cli/templates/defaults/tsconfig.json
index b93e0d4486..c760c76b13 100644
--- a/packages/cli/templates/defaults/tsconfig.json
+++ b/packages/cli/templates/defaults/tsconfig.json
@@ -17,7 +17,7 @@
"paths": {
"~/*": ["./app/*"]
},
- "customConditions": ["source"],
+ "customConditions": ["webstudio"],
// Remix takes care of building everything in `remix build`.
"noEmit": true,
diff --git a/packages/css-data/package.json b/packages/css-data/package.json
index c60882fb8e..3cda3eed17 100644
--- a/packages/css-data/package.json
+++ b/packages/css-data/package.json
@@ -32,7 +32,7 @@
"zod": "^3.19.1"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
diff --git a/packages/css-engine/package.json b/packages/css-engine/package.json
index 4aa34b158b..d3a494a676 100644
--- a/packages/css-engine/package.json
+++ b/packages/css-engine/package.json
@@ -34,7 +34,7 @@
"typescript": "5.2.2"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
diff --git a/packages/css-vars/package.json b/packages/css-vars/package.json
index ee75150f33..d565294f2b 100644
--- a/packages/css-vars/package.json
+++ b/packages/css-vars/package.json
@@ -16,7 +16,7 @@
"@webstudio-is/tsconfig": "workspace:*"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json
index 2dede47ba2..df60661af9 100644
--- a/packages/dashboard/package.json
+++ b/packages/dashboard/package.json
@@ -24,12 +24,12 @@
},
"exports": {
".": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
"./index.server": {
- "source": "./src/index.server.ts",
+ "webstudio": "./src/index.server.ts",
"types": "./lib/types/index.server.d.ts",
"import": "./lib/index.server.js"
}
diff --git a/packages/design-system/package.json b/packages/design-system/package.json
index aa98c77ceb..014d85f439 100644
--- a/packages/design-system/package.json
+++ b/packages/design-system/package.json
@@ -77,7 +77,7 @@
"warn-once": "^0.1.1"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"import": "./lib/index.js",
"types": "./lib/types/index.d.ts"
},
diff --git a/packages/domain/package.json b/packages/domain/package.json
index 18482011a3..3e35435402 100644
--- a/packages/domain/package.json
+++ b/packages/domain/package.json
@@ -25,12 +25,12 @@
},
"exports": {
".": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"import": "./lib/index.js",
"types": "./lib/types/index.d.ts"
},
"./index.server": {
- "source": "./src/index.server.ts",
+ "webstudio": "./src/index.server.ts",
"import": "./lib/index.server.js",
"types": "./lib/types/index.server.d.ts"
}
diff --git a/packages/error-utils/package.json b/packages/error-utils/package.json
index 7841cc8fe4..6ad5052117 100644
--- a/packages/error-utils/package.json
+++ b/packages/error-utils/package.json
@@ -16,7 +16,7 @@
"@webstudio-is/tsconfig": "workspace:*"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
diff --git a/packages/feature-flags/package.json b/packages/feature-flags/package.json
index 7a20472387..50dceb6da6 100644
--- a/packages/feature-flags/package.json
+++ b/packages/feature-flags/package.json
@@ -17,7 +17,7 @@
"@webstudio-is/tsconfig": "workspace:*"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
diff --git a/packages/fonts/package.json b/packages/fonts/package.json
index 8f808df443..689f957c4d 100644
--- a/packages/fonts/package.json
+++ b/packages/fonts/package.json
@@ -25,7 +25,7 @@
"zod": "^3.19.1"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
diff --git a/packages/form-handlers/package.json b/packages/form-handlers/package.json
index 286b42e48a..9ec6033357 100644
--- a/packages/form-handlers/package.json
+++ b/packages/form-handlers/package.json
@@ -16,7 +16,7 @@
"@webstudio-is/tsconfig": "workspace:*"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
diff --git a/packages/html-data/jest.config.js b/packages/html-data/jest.config.js
deleted file mode 100644
index e7fc137533..0000000000
--- a/packages/html-data/jest.config.js
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from "@webstudio-is/jest-config";
diff --git a/packages/html-data/package.json b/packages/html-data/package.json
index 25c35b1858..4bee3bc136 100644
--- a/packages/html-data/package.json
+++ b/packages/html-data/package.json
@@ -10,15 +10,14 @@
"checks": "pnpm typecheck",
"dev": "pnpm build --watch",
"build": "rm -rf lib && esbuild 'src/**/*.ts' 'src/**/*.tsx' --outdir=lib",
- "dts": "tsc --project tsconfig.dts.json",
- "test": "NODE_OPTIONS=--experimental-vm-modules jest"
+ "dts": "tsc --project tsconfig.dts.json"
},
"devDependencies": {
"@webstudio-is/tsconfig": "workspace:*"
},
"peerDependencies": {},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
diff --git a/packages/http-client/package.json b/packages/http-client/package.json
index 276cf9e7f4..825b8b7bdb 100644
--- a/packages/http-client/package.json
+++ b/packages/http-client/package.json
@@ -24,7 +24,7 @@
"typescript": "5.2.2"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
diff --git a/packages/icons/package.json b/packages/icons/package.json
index e035fc0e40..cb44e19565 100644
--- a/packages/icons/package.json
+++ b/packages/icons/package.json
@@ -35,13 +35,13 @@
},
"exports": {
".": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
},
"./svg": {
- "source": "./src/__generated__/svg/index.ts",
+ "webstudio": "./src/__generated__/svg/index.ts",
"types": "./lib/types/__generated__/svg/index.d.ts",
"import": "./lib/__generated__/svg/index.js",
"require": "./lib/__generated__/svg/index.js"
diff --git a/packages/image/package.json b/packages/image/package.json
index eff0962cee..2ac45af36b 100644
--- a/packages/image/package.json
+++ b/packages/image/package.json
@@ -36,7 +36,7 @@
"react-dom": "^18.2.0"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
diff --git a/packages/jest-config/index.js b/packages/jest-config/index.js
index a81058a635..d0a3320ffd 100644
--- a/packages/jest-config/index.js
+++ b/packages/jest-config/index.js
@@ -4,7 +4,7 @@
module.exports = {
testEnvironment: "node",
testEnvironmentOptions: {
- customExportConditions: ["source"],
+ customExportConditions: ["webstudio"],
},
testMatch: ["<rootDir>/src/**/*.test.ts"],
transform: {
diff --git a/packages/prisma-client/package.json b/packages/prisma-client/package.json
index 052d49a170..6323c0bacd 100644
--- a/packages/prisma-client/package.json
+++ b/packages/prisma-client/package.json
@@ -27,7 +27,7 @@
"zod": "^3.21.4"
},
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/cjs/index.js"
diff --git a/packages/project-build/package.json b/packages/project-build/package.json
index 4a57138359..846d406b36 100644
--- a/packages/project-build/package.json
+++ b/packages/project-build/package.json
@@ -9,12 +9,12 @@
"type": "module",
"exports": {
".": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
"./index.server": {
- "source": "./src/index.server.ts",
+ "webstudio": "./src/index.server.ts",
"types": "./lib/types/index.server.d.ts",
"import": "./lib/index.server.js"
}
diff --git a/packages/project/package.json b/packages/project/package.json
index 0d5736e752..ea90248a40 100644
--- a/packages/project/package.json
+++ b/packages/project/package.json
@@ -30,12 +30,12 @@
},
"exports": {
".": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
"./index.server": {
- "source": "./src/index.server.ts",
+ "webstudio": "./src/index.server.ts",
"types": "./lib/types/index.server.d.ts",
"import": "./lib/index.server.js"
}
diff --git a/packages/react-sdk/package.json b/packages/react-sdk/package.json
index 8ea591affa..845d833edb 100644
--- a/packages/react-sdk/package.json
+++ b/packages/react-sdk/package.json
@@ -50,13 +50,13 @@
},
"exports": {
".": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
},
"./css-normalize": {
- "source": "./src/css/normalize.ts",
+ "webstudio": "./src/css/normalize.ts",
"types": "./lib/types/css/normalize.d.ts",
"import": "./lib/css/normalize.js",
"require": "./lib/css/normalize.js"
diff --git a/packages/sdk-cli/src/bin.ts b/packages/sdk-cli/src/bin.ts
index 92282aa9f0..2238a101b9 100755
--- a/packages/sdk-cli/src/bin.ts
+++ b/packages/sdk-cli/src/bin.ts
@@ -1,2 +1,2 @@
-#!/usr/bin/env tsx --conditions=source --experimental-specifier-resolution=node --no-warnings
+#!/usr/bin/env tsx --conditions=webstudio --experimental-specifier-resolution=node --no-warnings
import "./cli";
diff --git a/packages/sdk-components-react-radix/package.json b/packages/sdk-components-react-radix/package.json
index 8a7870b0f5..5f181729a2 100644
--- a/packages/sdk-components-react-radix/package.json
+++ b/packages/sdk-components-react-radix/package.json
@@ -14,25 +14,25 @@
],
"exports": {
".": {
- "source": "./src/components.ts",
+ "webstudio": "./src/components.ts",
"types": "./lib/types/components.d.ts",
"import": "./lib/components.js",
"require": "./lib/components.js"
},
"./metas": {
- "source": "./src/metas.ts",
+ "webstudio": "./src/metas.ts",
"types": "./lib/types/metas.d.ts",
"import": "./lib/metas.js",
"require": "./lib/metas.js"
},
"./props": {
- "source": "./src/props.ts",
+ "webstudio": "./src/props.ts",
"types": "./lib/types/props.d.ts",
"import": "./lib/props.js",
"require": "./lib/props.js"
},
"./hooks": {
- "source": "./src/hooks.ts",
+ "webstudio": "./src/hooks.ts",
"types": "./lib/types/hooks.d.ts",
"import": "./lib/hooks.js",
"require": "./lib/hooks.js"
@@ -41,7 +41,7 @@
"scripts": {
"dev": "rm -rf lib && esbuild 'src/**/*.ts' 'src/**/*.tsx' --outdir=lib --watch",
"build": "rm -rf lib && esbuild src/components.ts src/metas.ts src/props.ts src/hooks.ts --outdir=lib --bundle --format=esm --packages=external",
- "build:args": "NODE_OPTIONS=--conditions=source generate-arg-types './src/accordion.tsx !./src/*.stories.tsx !./src/*.ws.tsx' -e asChild -e modal -e defaultValue -e defaultOpen -e defaultChecked && prettier --write \"**/*.props.ts\"",
+ "build:args": "NODE_OPTIONS=--conditions=webstudio generate-arg-types './src/accordion.tsx !./src/*.stories.tsx !./src/*.ws.tsx' -e asChild -e modal -e defaultValue -e defaultOpen -e defaultChecked && prettier --write \"**/*.props.ts\"",
"build:tailwind": "tsx scripts/generate-tailwind-theme.ts && prettier --write src/theme/__generated__",
"build:stories": "webstudio-sdk generate-stories && prettier --write \"src/__generated__/*.stories.tsx\"",
"dts": "tsc --project tsconfig.dts.json",
diff --git a/packages/sdk-components-react-remix/package.json b/packages/sdk-components-react-remix/package.json
index 97ee0c0a42..a7f037b675 100644
--- a/packages/sdk-components-react-remix/package.json
+++ b/packages/sdk-components-react-remix/package.json
@@ -14,19 +14,19 @@
"sideEffects": false,
"exports": {
".": {
- "source": "./src/components.ts",
+ "webstudio": "./src/components.ts",
"types": "./lib/types/components.d.ts",
"import": "./lib/components.js",
"require": "./lib/components.js"
},
"./metas": {
- "source": "./src/metas.ts",
+ "webstudio": "./src/metas.ts",
"types": "./lib/types/metas.d.ts",
"import": "./lib/metas.js",
"require": "./lib/metas.js"
},
"./props": {
- "source": "./src/props.ts",
+ "webstudio": "./src/props.ts",
"types": "./lib/types/props.d.ts",
"import": "./lib/props.js",
"require": "./lib/props.js"
@@ -35,7 +35,7 @@
"scripts": {
"dev": "rm -rf lib && esbuild 'src/**/*.ts' 'src/**/*.tsx' --outdir=lib --watch",
"build": "rm -rf lib && esbuild src/components.ts src/metas.ts src/props.ts --outdir=lib --bundle --format=esm --packages=external",
- "build:args": "NODE_OPTIONS=--conditions=source generate-arg-types './src/*.tsx !./src/**/*.stories.tsx !./src/**/*.ws.tsx' && prettier --write \"**/*.props.ts\"",
+ "build:args": "NODE_OPTIONS=--conditions=webstudio generate-arg-types './src/*.tsx !./src/**/*.stories.tsx !./src/**/*.ws.tsx' && prettier --write \"**/*.props.ts\"",
"dts": "tsc --project tsconfig.dts.json",
"typecheck": "tsc",
"checks": "pnpm typecheck"
diff --git a/packages/sdk-components-react/package.json b/packages/sdk-components-react/package.json
index 5b0f029137..0fe3cdf9e9 100644
--- a/packages/sdk-components-react/package.json
+++ b/packages/sdk-components-react/package.json
@@ -14,19 +14,19 @@
],
"exports": {
".": {
- "source": "./src/components.ts",
+ "webstudio": "./src/components.ts",
"types": "./lib/types/components.d.ts",
"import": "./lib/components.js",
"require": "./lib/components.js"
},
"./metas": {
- "source": "./src/metas.ts",
+ "webstudio": "./src/metas.ts",
"types": "./lib/types/metas.d.ts",
"import": "./lib/metas.js",
"require": "./lib/metas.js"
},
"./props": {
- "source": "./src/props.ts",
+ "webstudio": "./src/props.ts",
"types": "./lib/types/props.d.ts",
"import": "./lib/props.js",
"require": "./lib/props.js"
@@ -35,7 +35,7 @@
"scripts": {
"dev": "rm -rf lib && esbuild 'src/**/*.ts' 'src/**/*.tsx' --outdir=lib --watch",
"build": "rm -rf lib && esbuild src/components.ts src/metas.ts src/props.ts --outdir=lib --bundle --format=esm --packages=external",
- "build:args": "NODE_OPTIONS=--conditions=source generate-arg-types './src/*.tsx !./src/*.stories.tsx !./src/*.ws.tsx' && prettier --write \"**/*.props.ts\"",
+ "build:args": "NODE_OPTIONS=--conditions=webstudio generate-arg-types './src/*.tsx !./src/*.stories.tsx !./src/*.ws.tsx' && prettier --write \"**/*.props.ts\"",
"dts": "tsc --project tsconfig.dts.json",
"typecheck": "tsc",
"checks": "pnpm typecheck",
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
index 5bd7d7b985..cb0d237b0b 100644
--- a/packages/sdk/package.json
+++ b/packages/sdk/package.json
@@ -7,7 +7,7 @@
"license": "AGPL-3.0-or-later",
"type": "module",
"exports": {
- "source": "./src/index.ts",
+ "webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.js"
diff --git a/packages/storybook-config/index.ts b/packages/storybook-config/index.ts
index 801a0b9eaf..0c82071ab8 100644
--- a/packages/storybook-config/index.ts
+++ b/packages/storybook-config/index.ts
@@ -18,7 +18,7 @@ export default {
},
resolve: {
...config.resolve,
- conditions: ["source", "import", "module", "browser", "default"],
+ conditions: ["webstudio", "import", "module", "browser", "default"],
},
};
},
diff --git a/packages/trpc-interface/package.json b/packages/trpc-interface/package.json
index 113678b297..e5ade8fb92 100644
--- a/packages/trpc-interface/package.json
+++ b/packages/trpc-interface/package.json
@@ -29,7 +29,7 @@
},
"exports": {
"./index.server": {
- "source": "./src/index.server.ts",
+ "webstudio": "./src/index.server.ts",
"import": "./lib/index.server.js",
"types": "./lib/types/index.server.d.ts"
}
diff --git a/packages/tsconfig/base.json b/packages/tsconfig/base.json
index 9801723c70..d0a020f0af 100644
--- a/packages/tsconfig/base.json
+++ b/packages/tsconfig/base.json
@@ -9,7 +9,7 @@
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "bundler",
- "customConditions": ["source"],
+ "customConditions": ["webstudio"],
"noUnusedLocals": true,
"noUnusedParameters": false,
"preserveWatchOutput": true,