Skip to content

Commit

Permalink
Fix published package exports (#9163)
Browse files Browse the repository at this point in the history
* rename

* save patch

* fix everything

* format

* rm file

* fix stuff

* tweaks

* tweaks

* tweaks

* tweaks

* tweaks

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* fix

* Fix scripts/run_lite.sh and scripts/build_lite.sh (#9170)

* fixes

* fixes

* asd

* asd

* asd

* review comments

* fiux types

* fiux types

* make fileexpolorer public

* format

* lint

* lint

---------

Co-authored-by: Yuichiro Tachibana (Tsuchiya) <t.yic.yt@gmail.com>
  • Loading branch information
pngwn and whitphx authored Aug 22, 2024
1 parent c725c04 commit 2b6cbf2
Show file tree
Hide file tree
Showing 183 changed files with 1,373 additions and 387 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@gradio/spaces-test", "@gradio/cdn-test"]
"ignore": ["@self/spaces-test", "@self/cdn-test"]
}
71 changes: 71 additions & 0 deletions .changeset/plenty-cycles-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
"@gradio/multimodaltextbox": patch
"@gradio/highlightedtext": patch
"@gradio/annotatedimage": patch
"@self/component-test": patch
"@gradio/downloadbutton": patch
"@gradio/simpledropdown": patch
"@gradio/checkboxgroup": patch
"@gradio/simpletextbox": patch
"@gradio/statustracker": patch
"@gradio/fileexplorer": patch
"@gradio/uploadbutton": patch
"@gradio/colorpicker": patch
"@gradio/imageeditor": patch
"@gradio/paramviewer": patch
"@gradio/simpleimage": patch
"@gradio/nativeplot": patch
"@gradio/accordion": patch
"@gradio/dataframe": patch
"@self/storybook": patch
"website": patch
"@gradio/checkbox": patch
"@gradio/datetime": patch
"@gradio/dropdown": patch
"@gradio/fallback": patch
"@gradio/markdown": patch
"@gradio/chatbot": patch
"@gradio/dataset": patch
"@gradio/gallery": patch
"@gradio/model3d": patch
"@gradio/preview": patch
"@gradio/tabitem": patch
"@gradio/textbox": patch
"@gradio/tooltip": patch
"@self/tootils": patch
"@gradio/client": patch
"@gradio/button": patch
"@gradio/column": patch
"@gradio/number": patch
"@gradio/slider": patch
"@gradio/upload": patch
"@gradio/atoms": patch
"@gradio/audio": patch
"@self/build": patch
"@gradio/group": patch
"@gradio/icons": patch
"@gradio/image": patch
"@gradio/label": patch
"@gradio/radio": patch
"@gradio/state": patch
"@gradio/theme": patch
"@gradio/timer": patch
"@gradio/utils": patch
"@gradio/video": patch
"@gradio/code": patch
"@gradio/core": patch
"@gradio/file": patch
"@gradio/form": patch
"@gradio/html": patch
"@gradio/json": patch
"@gradio/lite": patch
"@gradio/plot": patch
"@gradio/tabs": patch
"@gradio/wasm": patch
"@self/app": patch
"@gradio/box": patch
"@gradio/row": patch
"@self/spa": patch
---

fix:fix exports and generate types
2 changes: 1 addition & 1 deletion .config/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**/js/wasm/dist/**
**/js/preview/dist/**
**/client/js/dist/**
**/js/lite/dist/**
**/js/*/dist/**
**/pnpm-lock.yaml
**/js/plot/src/Plot.svelte
**/.svelte-kit/**
Expand Down
5 changes: 3 additions & 2 deletions .config/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const { browser, es2021, node } = globals;
export default [
{
ignores: [
".svelte-kit/**/*",
"**/.svelte-kit/**/*",
"**/node_modules/**",
"**/dist/**",
"**/.config/*",
Expand All @@ -75,7 +75,8 @@ export default [
"**/_website/**/*",
"**/_spaces-test/**/*",
"**/preview/test/**/*",
"**/component-test/**/*"
"**/component-test/**/*",
"**/js/wasm/src/webworker/**/*"
]
},
{
Expand Down
5 changes: 5 additions & 0 deletions .config/svelte.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";

export default {
preprocess: vitePreprocess()
};
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
. venv/bin/activate
pip install -U build hatch packaging>=23.2 # packaging>=23.2 is needed to build Lite due to https://github.com/pypa/hatch/issues/1381
pnpm --filter @gradio/client --filter @gradio/lite --filter @gradio/preview build
- name: create and publish versions
id: changesets
uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # @v1
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Verify that you've used the correct filename of your gradio app, and that you're

---

```ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @gradio/spa@1.0.0 build:local: vite build --mode production:local --emptyOutDir "--emptyOutDir"```
```ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @self/spa@1.0.0 build:local: vite build --mode production:local --emptyOutDir "--emptyOutDir"```

Delete `/node_modules` and `pnpm-lock.yaml`:

Expand Down
1 change: 1 addition & 0 deletions client/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"license": "ISC",
"exports": {
".": {
"gradio": "./src/index.ts",
"import": "./dist/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 1 addition & 1 deletion guides/cn/07_other-tutorials/creating-a-new-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class TestColorPicker(unittest.TestCase):
```typescript
import { test, describe, assert, afterEach } from "vitest";
import { cleanup, render } from "@gradio/tootils";
import { cleanup, render } from "@self/tootils";
import ColorPicker from "./ColorPicker.svelte";
import type { LoadingStatus } from "../StatusTracker/types";
Expand Down
2 changes: 1 addition & 1 deletion js/_cdn-test/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@gradio/cdn-test",
"name": "@self/cdn-test",
"private": true,
"version": "0.0.1",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion js/_spaces-test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @gradio/spaces-test
# @self/spaces-test

## 0.0.1

Expand Down
2 changes: 1 addition & 1 deletion js/_spaces-test/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@gradio/spaces-test",
"name": "@self/spaces-test",
"version": "0.0.1",
"private": true,
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions js/_website/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import { inject_component_loader } from "../build/dist/index.js";
import { inject_component_loader } from "../build/out/index.js";

//@ts-ignore
export default defineConfig(({ mode }) => ({
plugins: [sveltekit(), inject_component_loader({ mode })]
plugins: [sveltekit(), inject_component_loader({ mode })],
resolve: {
conditions: ["gradio"]
}
}));
10 changes: 8 additions & 2 deletions js/accordion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,25 @@
"type": "module",
"author": "",
"license": "ISC",
"private": true,
"main_changeset": true,
"dependencies": {
"@gradio/atoms": "workspace:^",
"@gradio/column": "workspace:^",
"@gradio/statustracker": "workspace:^",
"@gradio/utils": "workspace:0.6.0"
},
"peerDependencies": {
"svelte": "^4.0.0"
},
"devDependencies": {
"@gradio/preview": "workspace:^"
},
"exports": {
".": "./Index.svelte",
".": {
"gradio": "./Index.svelte",
"svelte": "./dist/Index.svelte",
"types": "./dist/Index.svelte.d.ts"
},
"./package.json": "./package.json"
},
"repository": {
Expand Down
11 changes: 9 additions & 2 deletions js/annotatedimage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@
"type": "module",
"author": "",
"license": "ISC",
"private": true,
"private": false,
"main_changeset": true,
"exports": {
".": "./Index.svelte",
".": {
"gradio": "./Index.svelte",
"svelte": "./dist/Index.svelte",
"types": "./dist/Index.svelte.d.ts"
},
"./package.json": "./package.json"
},
"devDependencies": {
"@gradio/preview": "workspace:^"
},
"peerDependencies": {
"svelte": "^4.0.0"
},
"dependencies": {
"@gradio/atoms": "workspace:^",
"@gradio/icons": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion js/app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @gradio/app
# @self/app

## 1.40.0

Expand Down
2 changes: 1 addition & 1 deletion js/app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@gradio/app",
"name": "@self/app",
"version": "1.40.0",
"private": true,
"scripts": {
Expand Down
18 changes: 16 additions & 2 deletions js/atoms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@
"author": "",
"license": "ISC",
"dependencies": {
"@gradio/utils": "workspace:^",
"@gradio/icons": "workspace:^"
"@gradio/icons": "workspace:^",
"@gradio/utils": "workspace:^"
},
"peerDependencies": {
"svelte": "^4.0.0"
},
"exports": {
".": {
"gradio": "./src/index.ts",
"svelte": "./dist/src/index.js",
"types": "./dist/src/index.d.ts"
},
"./package.json": "./package.json"
},
"main_changeset": true,
"repository": {
"type": "git",
"url": "git+https://github.com/gradio-app/gradio.git",
"directory": "js/atoms"
},
"scripts": {
"sv-pkg": "svelte-package --input=. --cwd=../../.config/"
}
}
2 changes: 1 addition & 1 deletion js/audio/audio.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, describe, assert, afterEach } from "vitest";
import { cleanup, render } from "@gradio/tootils";
import { cleanup, render } from "@self/tootils";
import Audio from "./";
import type { LoadingStatus } from "@gradio/statustracker";
import { setupi18n } from "../core/src/i18n";
Expand Down
29 changes: 24 additions & 5 deletions js/audio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,30 @@
"main_changeset": true,
"main": "index.ts",
"exports": {
".": "./index.ts",
"./example": "./Example.svelte",
"./shared": "./shared/index.ts",
"./base": "./static/StaticAudio.svelte",
"./package.json": "./package.json"
"./package.json": "./package.json",
".": {
"gradio": "./index.ts",
"svelte": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./example": {
"gradio": "./Example.svelte",
"svelte": "./dist/Example.svelte",
"types": "./dist/Example.svelte.d.ts"
},
"./shared": {
"gradio": "./shared/index.ts",
"svelte": "./dist/shared/index.js",
"types": "./dist/shared/index.d.ts"
},
"./base": {
"gradio": "./static/StaticAudio.svelte",
"svelte": "./dist/static/StaticAudio.svelte",
"types": "./dist/static/StaticAudio.svelte.d.ts"
}
},
"peerDependencies": {
"svelte": "^4.0.0"
},
"repository": {
"type": "git",
Expand Down
9 changes: 8 additions & 1 deletion js/box/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@
"private": false,
"main_changeset": true,
"exports": {
".": "./Index.svelte",
".": {
"gradio": "./Index.svelte",
"svelte": "./dist/Index.svelte",
"types": "./dist/Index.svelte.d.ts"
},
"./package.json": "./package.json"
},
"dependencies": {
"@gradio/atoms": "workspace:^"
},
"peerDependencies": {
"svelte": "^4.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gradio-app/gradio.git",
Expand Down
2 changes: 1 addition & 1 deletion js/build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @gradio/build
# @self/build

## 0.0.2

Expand Down
2 changes: 1 addition & 1 deletion js/build/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@gradio/build`
# `@self/build`

Build utilities for the gradio frontend + lite.
File renamed without changes.
5 changes: 3 additions & 2 deletions js/build/dist/index.js → js/build/out/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ function handle_ce_css() {
var __filename = url.fileURLToPath(import.meta.url);
var __dirname = url.fileURLToPath(new URL(".", import.meta.url));
function get_export_path(path, root, pkg_json) {
if (!pkg_json.exports) return void 0;
if (!pkg_json.exports) return false;
if (typeof pkg_json.exports[`${path}`] === "object") return true;
const _path = join(root, "..", `${pkg_json.exports[`${path}`]}`);
return existsSync(_path) ? _path : void 0;
return existsSync(_path);
}
var ignore_list = [
"tootils",
Expand Down
9 changes: 6 additions & 3 deletions js/build/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{
"name": "@gradio/build",
"name": "@self/build",
"version": "0.0.2",
"description": "Gradio UI packages",
"type": "module",
"main": "dist/index.js",
"main": "out/index.js",
"private": "true",
"author": "",
"license": "ISC",
"scripts": {
"build": "esbuild src/index.ts --platform=node --format=esm --target=node18 --bundle --packages=external --outfile=dist/index.js"
"build": "esbuild src/index.ts --platform=node --format=esm --target=node18 --bundle --packages=external --outfile=out/index.js"
},
"dependencies": {
"@gradio/theme": "workspace:^",
"esbuild": "^0.21.0",
"svelte-i18n": "^3.6.0"
},
"peerDependencies": {
"svelte": "^4.0.0"
},
"main_changeset": true,
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 2b6cbf2

Please sign in to comment.