Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use new bundle convention #2865

Merged
merged 15 commits into from
Jan 14, 2024
24 changes: 4 additions & 20 deletions _internal/package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
{
"main": "./dist/index.js",
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
"exports": {
"react-server": "./dist/react-server.mjs",
"import": "./dist/index.mjs",
"module": "./dist/index.esm.js",
"require": "./dist/index.js"
},
"private": true,
"scripts": {
"watch": "bunchee -w",
"build": "bunchee",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"swr": "*",
"react": "*"
}
"main": "../dist/_internal/index.js",
"module": "../dist/_internal/index.esm.js",
"types": "../dist/_internal/index.d.ts",
"private": true
}
7 changes: 0 additions & 7 deletions _internal/tsconfig.json

This file was deleted.

1 change: 0 additions & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
"exports": {
"react-server": "./dist/react-server.mjs",
huozhi marked this conversation as resolved.
Show resolved Hide resolved
"import": "./dist/index.mjs",
"module": "./dist/index.esm.js",
"require": "./dist/index.js"
Expand Down
4 changes: 0 additions & 4 deletions core/src/serialize.ts

This file was deleted.

8 changes: 0 additions & 8 deletions core/tsconfig.json

This file was deleted.

6 changes: 6 additions & 0 deletions e2e/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.json",
"include": [
".",
],
}
File renamed without changes.
23 changes: 4 additions & 19 deletions immutable/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
{
"main": "./dist/index.js",
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
"exports": {
"import": "./dist/index.mjs",
"module": "./dist/index.esm.js",
"require": "./dist/index.js"
},
"private": true,
"scripts": {
"watch": "bunchee -w",
"build": "bunchee",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"swr": "*",
"react": "*"
}
"main": "../dist/immutable/index.js",
"module": "../dist/immutable/index.esm.js",
"types": "../dist/immutable/index.d.ts",
"private": true
}
7 changes: 0 additions & 7 deletions immutable/tsconfig.json

This file was deleted.

25 changes: 4 additions & 21 deletions infinite/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
{
"main": "./dist/index.js",
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
"exports": {
"react-server": "./dist/react-server.mjs",
"import": "./dist/index.mjs",
"module": "./dist/index.esm.js",
"require": "./dist/index.js"
},
"private": true,
"scripts": {
"watch": "bunchee -w",
"build": "bunchee",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"swr": "*",
"react": "*",
"use-sync-external-store": "*"
}
"main": "../dist/infinite/index.js",
"module": "../dist/infinite/index.esm.js",
"types": "../dist/infinite/index.d.ts",
"private": true
}
1 change: 0 additions & 1 deletion infinite/src/index.react-server.ts

This file was deleted.

7 changes: 0 additions & 7 deletions infinite/tsconfig.json

This file was deleted.

12 changes: 6 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module.exports = {
modulePathIgnorePatterns: ['<rootDir>/examples/'],
setupFilesAfterEnv: ['<rootDir>/test/jest-setup.ts'],
moduleNameMapper: {
'^swr$': '<rootDir>/core/src/index.ts',
'^swr/infinite$': '<rootDir>/infinite/src/index.ts',
'^swr/immutable$': '<rootDir>/immutable/src/index.ts',
'^swr/subscription$': '<rootDir>/subscription/src/index.ts',
'^swr/mutation$': '<rootDir>/mutation/src/index.ts',
'^swr/_internal$': '<rootDir>/_internal/src/index.ts'
'^swr$': '<rootDir>/src/index.ts',
huozhi marked this conversation as resolved.
Show resolved Hide resolved
'^swr/infinite$': '<rootDir>/src/infinite/index.ts',
'^swr/immutable$': '<rootDir>/src/immutable/index.ts',
'^swr/subscription$': '<rootDir>/src/subscription/index.ts',
'^swr/mutation$': '<rootDir>/src/mutation/index.ts',
'^swr/_internal$': '<rootDir>/src/_internal/index.ts'
},
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest']
Expand Down
23 changes: 4 additions & 19 deletions mutation/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
{
"main": "./dist/index.js",
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
"exports": {
"import": "./dist/index.mjs",
"module": "./dist/index.esm.js",
"require": "./dist/index.js"
},
"private": true,
"scripts": {
"watch": "bunchee -w",
"build": "bunchee",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"swr": "*",
"react": "*"
}
"main": "../dist/mutation/index.js",
"module": "../dist/mutation/index.esm.js",
"types": "../dist/mutation/index.d.ts",
"private": true
}
7 changes: 0 additions & 7 deletions mutation/tsconfig.json

This file was deleted.

125 changes: 69 additions & 56 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,74 +11,88 @@
"fetch"
],
"packageManager": "pnpm@8.4.0",
"main": "./core/dist/index.js",
"module": "./core/dist/index.esm.js",
"types": "./core/dist/index.d.ts",
"typesVersions": {
"*": {
"infinite": [
"./infinite/dist/index.d.ts"
],
"immutable": [
"./immutable/dist/index.d.ts"
],
"mutation": [
"./mutation/dist/index.d.ts"
],
"subscription": [
"./subscription/dist/index.d.ts"
]
}
},
"main": "./dist/core/index.js",
"module": "./dist/core/index.esm.js",
"types": "./dist/core/index.d.ts",
"exports": {
koba04 marked this conversation as resolved.
Show resolved Hide resolved
"./package.json": "./package.json",
".": {
"react-server": "./core/dist/react-server.mjs",
"import": "./core/dist/index.mjs",
"module": "./core/dist/index.esm.js",
"require": "./core/dist/index.js"
"react-server": "./dist/core/react-server.mjs",
"import": {
"types": "./dist/core/index.d.mts",
"default": "./dist/core/index.mjs"
},
"module": "./dist/core/index.esm.js",
"require": {
"types": "./dist/core/index.d.ts",
"default": "./dist/core/index.js"
}
},
"./infinite": {
"react-server": "./infinite/dist/react-server.mjs",
"import": "./infinite/dist/index.mjs",
"module": "./infinite/dist/index.esm.js",
"require": "./infinite/dist/index.js"
"react-server": "./dist/infinite/react-server.mjs",
"import": {
"types": "./dist/infinite/index.d.mts",
"default": "./dist/infinite/index.mjs"
},
"module": "./dist/infinite/index.esm.js",
"require": {
"types": "./dist/infinite/index.d.ts",
"default": "./dist/infinite/index.js"
}
},
"./immutable": {
"import": "./immutable/dist/index.mjs",
"module": "./immutable/dist/index.esm.js",
"require": "./immutable/dist/index.js"
"import": {
"types": "./dist/immutable/index.d.mts",
"default": "./dist/immutable/index.mjs"
},
"module": "./dist/immutable/index.esm.js",
"require": {
"types": "./dist/immutable/index.d.ts",
"default": "./dist/immutable/index.js"
}
},
"./subscription": {
"import": "./subscription/dist/index.mjs",
"module": "./subscription/dist/index.esm.js",
"require": "./subscription/dist/index.js"
"import": {
"types": "./dist/subscription/index.d.mts",
"default": "./dist/subscription/index.mjs"
},
"module": "./dist/subscription/index.esm.js",
"require": {
"types": "./dist/subscription/index.d.ts",
"default": "./dist/subscription/index.js"
}
},
"./mutation": {
"import": "./mutation/dist/index.mjs",
"module": "./mutation/dist/index.esm.js",
"require": "./mutation/dist/index.js"
"import": {
"types": "./dist/mutation/index.d.mts",
"default": "./dist/mutation/index.mjs"
},
"module": "./dist/mutation/index.esm.js",
"require": {
"types": "./dist/mutation/index.d.ts",
"default": "./dist/mutation/index.js"
}
},
"./_internal": {
"react-server": "./_internal/dist/react-server.mjs",
"import": "./_internal/dist/index.mjs",
"module": "./_internal/dist/index.esm.js",
"require": "./_internal/dist/index.js"
"react-server": "./dist/_internal/react-server.mjs",
"import": {
"types": "./dist/_internal/index.d.mts",
"default": "./dist/_internal/index.mjs"
},
"module": "./dist/_internal/index.esm.js",
"require": {
"types": "./dist/_internal/index.d.ts",
"default": "./dist/_internal/index.js"
}
}
},
"files": [
"core/dist/**/*.{js,d.ts,mjs,d.mts}",
"infinite/dist/**/*.{js,d.ts,mjs,d.mts}",
"immutable/dist/**/*.{js,d.ts,mjs,d.mts}",
"mutation/dist/**/*.{js,d.ts,mjs,d.mts}",
"_internal/dist/**/*.{js,d.ts,mjs,d.mts}",
"subscription/dist/*.{js,d.ts,mjs,d.mts}",
"core/package.json",
"infinite/package.json",
"immutable/package.json",
"mutation/package.json",
"_internal/package.json",
"subscription/package.json"
"dist",
"infinite",
"immutable",
"subscription",
"mutation",
"_internal"
],
"repository": "github:vercel/swr",
"homepage": "https://swr.vercel.app",
Expand All @@ -87,11 +101,10 @@
"prepare": "husky install",
"csb:install": "corepack enable && corepack pnpm i",
"csb:build": "pnpm build",
"clean": "pnpm -r run clean && rimraf playwright-report test-result",
"clean": "rimraf ./dist && rimraf playwright-report test-result",
"watch": "pnpm -r run watch",
"build": "pnpm build-package _internal && pnpm build-package core && pnpm build-package infinite && pnpm build-package immutable && pnpm build-package mutation && pnpm build-package subscription",
"build": "bunchee",
"build:e2e": "pnpm next build e2e/site",
"build-package": "bunchee --cwd",
"attw": "attw --pack",
"types:check": "pnpm -r run types:check",
"prepublishOnly": "pnpm clean && pnpm build",
Expand Down Expand Up @@ -126,7 +139,7 @@
"@types/use-sync-external-store": "^0.0.3",
"@typescript-eslint/eslint-plugin": "5.59.8",
"@typescript-eslint/parser": "5.59.8",
"bunchee": "3.9.2",
"bunchee": "^4.2.11",
"eslint": "8.42.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-jest-dom": "5.0.1",
Expand Down
Loading
Loading