diff --git a/packages/core/package.json b/packages/core/package.json index 0eadc815..c283d719 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@oku-ui/primitives", "type": "module", - "version": "0.7.3", + "version": "0.7.4-alpha.5", "license": "MIT", "funding": "https://github.com/sponsors/productdevbook", "homepage": "https://oku-ui.com/primitives", @@ -96,7 +96,7 @@ "typecheck": "tsc --noEmit" }, "peerDependencies": { - "@vue/shared": "^3.4.31" + "vue": ">= 3.5.0" }, "dependencies": { "@floating-ui/dom": "^1.6.12", @@ -107,7 +107,7 @@ "devDependencies": { "@tsconfig/node20": "^20.1.4", "@types/jsdom": "^21.1.7", - "@types/node": "^22.0.0", + "@types/node": "^22.9.0", "@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue-jsx": "^4.0.1", "@vue/test-utils": "^2.4.6", @@ -123,6 +123,7 @@ "vite-plugin-dts": "^4.3.0", "vite-plugin-externalize-deps": "^0.8.0", "vite-plugin-pages": "^0.32.3", + "vite-tsconfig-paths": "^5.1.3", "vitest": "^2.1.4", "vue": "^3.5.12", "vue-router": "^4.4.5", diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index f2180cc9..9524fa5a 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -23,7 +23,5 @@ export * from './toggle/index.ts' export * from './toggle-group/index.ts' export * from './toolbar/index.ts' export * from './tooltip/index.ts' - - -export { Primitive, type PrimitiveProps } from './primitive/index.ts' -export { VisuallyHidden, type VisuallyHiddenProps } from './visually-hidden/index.ts' +export * from './primitive/index.ts' +export * from './visually-hidden/index.ts' \ No newline at end of file diff --git a/packages/core/tsconfig.build.json b/packages/core/tsconfig.build.json index ab5bd7f9..f19b3c1e 100644 --- a/packages/core/tsconfig.build.json +++ b/packages/core/tsconfig.build.json @@ -8,8 +8,7 @@ "module": "esnext", "moduleResolution": "node", "paths": { - "@/*": ["src/*"], - "@vue/shared": ["node_modules/@vue/shared"] + "@/*": ["src/*"] }, "resolveJsonModule": true, "types": [ @@ -17,6 +16,8 @@ ], "allowImportingTsExtensions": true, "strict": true, + "noUnusedLocals": false, + "noUnusedParameters": false, "declaration": false, "outDir": "dist", "sourceMap": true, diff --git a/packages/core/vite.config.ts b/packages/core/vite.config.ts index 3431afec..2e4e4351 100644 --- a/packages/core/vite.config.ts +++ b/packages/core/vite.config.ts @@ -1,84 +1,65 @@ -import process from 'node:process' -// import { externalizeDeps } from 'vite-plugin-externalize-deps' - -import { execSync } from 'node:child_process' import { resolve } from 'node:path' -import { fileURLToPath } from 'node:url' import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' -import { globbySync } from 'globby' import { defineConfig } from 'vite' import dts from 'vite-plugin-dts' +import pkg from './package.json' + +const projectRootDir = resolve(__dirname) -// https://vitejs.dev/config/ export default defineConfig({ - define: { - __DEV__: process.env.NODE_ENV !== 'production', - }, plugins: [ - // externalizeDeps(), - vue(), + vue({ + template: { + compilerOptions: { + hoistStatic: true, + cacheHandlers: true, + }, + }, + }), vueJsx(), dts({ - outDir: 'dist', - exclude: ['src/**/__tests__/*', 'src/**/stories/*'], - compilerOptions: { - composite: false, - declaration: true, - declarationMap: true, - }, tsconfigPath: 'tsconfig.build.json', - afterBuild: async () => { - console.log('dts afterBuild') - // pnpm build:plugins - execSync('pnpm build:plugins', { stdio: 'inherit', cwd: resolve(__dirname, '../plugins') }) - execSync('pnpm generate:plugins', { stdio: 'inherit', cwd: resolve(__dirname, '../plugins') }) - execSync('pnpm lint:fix', { stdio: 'inherit', cwd: resolve(__dirname, '../..') }) - }, + exclude: ['src/test/**', 'src/**/stories/**', 'src/**/*.stories.vue'], + rollupTypes: true, }), ], + resolve: { + alias: { + '@': resolve(projectRootDir, 'src'), + }, + dedupe: ['vue', '@vue/runtime-core'], + }, build: { - copyPublicDir: false, minify: false, + target: 'esnext', sourcemap: true, lib: { name: 'oku-ui-primitives', formats: ['es'], - entry: [ - ...globbySync('src/**/*.ts', { ignore: [ - '**/__tests__/**', - '**/stories/**', - '**/*.stories.ts', - ] }), - 'src/index.ts', - ], + fileName: (_, name) => `${name}.mjs`, + entry: { + index: resolve(__dirname, 'src/index.ts'), + }, }, - target: 'esnext', rollupOptions: { - output: { - esModule: true, - preserveModules: true, - preserveModulesRoot: 'src', - entryFileNames: '[name].mjs', - }, external: [ - 'vue', - '@vue/shared', - '@floating-ui/dom', - '@floating-ui/utils', - '@floating-ui/vue', - 'aria-hidden', + ...Object.keys(pkg.dependencies ?? {}), + ...Object.keys(pkg.peerDependencies ?? {}), ], + output: { + manualChunks: (id) => { + // Daha basit chunk stratejisi + const chunks = id.match(/[/\\]src[/\\](.*?)[/\\]/) + return chunks ? chunks[1] : null + }, + exports: 'named', + chunkFileNames: '[name].mjs', + assetFileNames: 'index.css', + hoistTransitiveImports: false, + minifyInternalExports: true, + }, }, + }, - resolve: { - alias: { - '@oku-ui': fileURLToPath(new URL('./src', import.meta.url)), - }, - }, - // resolve: { - // alias: { - // '~': fileURLToPath(new URL('./src', import.meta.url)), - // }, - // }, }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab671d86..40a3d793 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -252,9 +252,6 @@ importers: '@floating-ui/vue': specifier: ^1.1.5 version: 1.1.5(vue@3.5.13(typescript@5.6.3)) - '@vue/shared': - specifier: ^3.4.31 - version: 3.5.12 aria-hidden: specifier: ^1.2.4 version: 1.2.4 @@ -266,7 +263,7 @@ importers: specifier: ^21.1.7 version: 21.1.7 '@types/node': - specifier: ^22.0.0 + specifier: ^22.9.0 version: 22.9.0 '@vitejs/plugin-vue': specifier: ^5.1.4 @@ -313,6 +310,9 @@ importers: vite-plugin-pages: specifier: ^0.32.3 version: 0.32.3(@vue/compiler-sfc@3.5.13)(vite@5.4.11(@types/node@22.9.0)(terser@5.36.0))(vue-router@4.4.5(vue@3.5.13(typescript@5.6.3))) + vite-tsconfig-paths: + specifier: ^5.1.3 + version: 5.1.3(typescript@5.6.3)(vite@5.4.11(@types/node@22.9.0)(terser@5.36.0)) vitest: specifier: ^2.1.4 version: 2.1.5(@types/node@22.9.0)(happy-dom@15.11.6)(jsdom@25.0.1)(terser@5.36.0) @@ -351,8 +351,6 @@ importers: specifier: ^8.3.5 version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@22.9.0))(jiti@2.4.0)(postcss@8.4.49)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0) - packages/tsconfig: {} - playground/nuxt-app: dependencies: nuxt: @@ -2627,9 +2625,6 @@ packages: peerDependencies: vue: 3.5.13 - '@vue/shared@3.5.12': - resolution: {integrity: sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg==} - '@vue/shared@3.5.13': resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} @@ -4481,6 +4476,9 @@ packages: resolution: {integrity: sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==} engines: {node: '>=18'} + globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} @@ -7241,6 +7239,16 @@ packages: ts-toolbelt@9.6.0: resolution: {integrity: sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==} + tsconfck@3.1.4: + resolution: {integrity: sha512-kdqWFGVJqe+KGYvlSO9NIaWn9jT1Ny4oKVzAJsKii5eoE9snzTJzL4+MMVOMn+fikWGFmKEylcXL710V/kIPJQ==} + engines: {node: ^18 || >=20} + hasBin: true + peerDependencies: + typescript: ^5.0.0 + peerDependenciesMeta: + typescript: + optional: true + tsconfig-paths@4.2.0: resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==} engines: {node: '>=6'} @@ -7673,6 +7681,14 @@ packages: peerDependencies: vite: ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 + vite-tsconfig-paths@5.1.3: + resolution: {integrity: sha512-0bz+PDlLpGfP2CigeSKL9NFTF1KtXkeHGZSSaGQSuPZH77GhoiQaA8IjYgOaynSuwlDTolSUEU0ErVvju3NURg==} + peerDependencies: + vite: '*' + peerDependenciesMeta: + vite: + optional: true + vite@5.4.10: resolution: {integrity: sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==} engines: {node: ^18.0.0 || >=20.0.0} @@ -10605,8 +10621,6 @@ snapshots: '@vue/shared': 3.5.13 vue: 3.5.13(typescript@5.6.3) - '@vue/shared@3.5.12': {} - '@vue/shared@3.5.13': {} '@vue/test-utils@2.4.6': @@ -12679,6 +12693,8 @@ snapshots: slash: 5.1.0 unicorn-magic: 0.1.0 + globrex@0.1.2: {} + gopd@1.0.1: dependencies: get-intrinsic: 1.2.4 @@ -14232,7 +14248,7 @@ snapshots: '@unhead/shared': 1.11.11 '@unhead/ssr': 1.11.11 '@unhead/vue': 1.11.11(vue@3.5.13(typescript@5.6.3)) - '@vue/shared': 3.5.12 + '@vue/shared': 3.5.13 acorn: 8.14.0 c12: 2.0.1(magicast@0.3.5) chokidar: 4.0.1 @@ -15958,6 +15974,10 @@ snapshots: ts-toolbelt@9.6.0: {} + tsconfck@3.1.4(typescript@5.6.3): + optionalDependencies: + typescript: 5.6.3 + tsconfig-paths@4.2.0: dependencies: json5: 2.2.3 @@ -16502,6 +16522,17 @@ snapshots: transitivePeerDependencies: - supports-color + vite-tsconfig-paths@5.1.3(typescript@5.6.3)(vite@5.4.11(@types/node@22.9.0)(terser@5.36.0)): + dependencies: + debug: 4.3.7(supports-color@9.4.0) + globrex: 0.1.2 + tsconfck: 3.1.4(typescript@5.6.3) + optionalDependencies: + vite: 5.4.11(@types/node@22.9.0)(terser@5.36.0) + transitivePeerDependencies: + - supports-color + - typescript + vite@5.4.10(@types/node@22.9.0)(terser@5.36.0): dependencies: esbuild: 0.21.5 @@ -16533,7 +16564,7 @@ snapshots: '@types/markdown-it': 14.1.2 '@vitejs/plugin-vue': 5.1.4(vite@5.4.10(@types/node@22.9.0)(terser@5.36.0))(vue@3.5.13(typescript@5.6.3)) '@vue/devtools-api': 7.6.3 - '@vue/shared': 3.5.12 + '@vue/shared': 3.5.13 '@vueuse/core': 11.2.0(vue@3.5.13(typescript@5.6.3)) '@vueuse/integrations': 11.2.0(axios@1.7.7)(change-case@5.4.4)(focus-trap@7.6.0)(vue@3.5.13(typescript@5.6.3)) focus-trap: 7.6.0