refactor: update nuxt version and nuxt-module

next
Mert Sincan 2025-02-28 11:32:34 +00:00
parent e53d48ed62
commit 9462acb06e
24 changed files with 2466 additions and 3411 deletions

28
.gitignore vendored
View File

@ -1,15 +1,31 @@
node_modules # Nuxt dev/build outputs
coverage .output
*.log* .data
.nuxt .nuxt
.nitro .nitro
.cache .cache
.output
.env
dist dist
# Node dependencies
node_modules
# Logs
logs
*.log*
# Misc
.DS_Store .DS_Store
.fleet
.idea .idea
.eslintcache .eslintcache
api-generator/typedoc.json coverage
**/.DS_Store **/.DS_Store
# Local env files
.env
.env.*
!.env.example
# Custom
api-generator/typedoc.json
apps/showcase/components.d.ts apps/showcase/components.d.ts

1
apps/showcase/README.md Normal file
View File

@ -0,0 +1 @@
# Showcase

View File

@ -18,7 +18,8 @@ try {
// https://nuxt.com/docs/api/configuration/nuxt-config // https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({ export default defineNuxtConfig({
typescript: false, compatibilityDate: '2024-11-01',
devtools: { enabled: false },
modules: ['@primevue/nuxt-module'], modules: ['@primevue/nuxt-module'],
components: { components: {
path: '~/components', path: '~/components',
@ -28,7 +29,9 @@ export default defineNuxtConfig({
resolve: { resolve: {
dedupe: ['vue', '@primeuix/styles', '@primeuix/themes', '@primeuix/utils'], dedupe: ['vue', '@primeuix/styles', '@primeuix/themes', '@primeuix/utils'],
optimizeDeps: { optimizeDeps: {
disabled: true disabled: true,
noDiscovery: true,
include: []
}, },
alias alias
} }
@ -40,14 +43,7 @@ export default defineNuxtConfig({
'/accessibility': { redirect: { to: '/guides/accessibility', statusCode: 301 } }, '/accessibility': { redirect: { to: '/guides/accessibility', statusCode: 301 } },
'/installation': { redirect: { to: '/vite', statusCode: 301 } } '/installation': { redirect: { to: '/vite', statusCode: 301 } }
}, },
primevue: primevue: {
PROCESS_ENV.DEV_ENV === 'hot'
? {
usePrimeVue: false,
autoImport: true,
loadStyles: false
}
: {
autoImport: true, // When enabled, the module automatically imports PrimeVue components and directives used throughout the application. autoImport: true, // When enabled, the module automatically imports PrimeVue components and directives used throughout the application.
importTheme: { from: '@/themes/app-theme.js' } importTheme: { from: '@/themes/app-theme.js' }
}, },

View File

@ -13,15 +13,6 @@
"bugs": { "bugs": {
"url": "https://github.com/primefaces/primevue/issues" "url": "https://github.com/primefaces/primevue/issues"
}, },
"scripts": {
"build": "pnpm run build:prebuild && nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"build:prebuild": "node ./scripts/prebuild.js",
"build:apidoc": "node ./scripts/build-apidoc.js"
},
"keywords": [ "keywords": [
"primevue", "primevue",
"vue", "vue",
@ -37,35 +28,42 @@
"unstyled", "unstyled",
"passthrough" "passthrough"
], ],
"devDependencies": { "type": "module",
"@stackblitz/sdk": "^1.8.2", "scripts": {
"autoprefixer": "^10.4.16", "build": "pnpm run build:prebuild && nuxt build",
"chart.js": "3.3.2", "dev": "nuxt dev",
"jsdom": "^19.0.0", "generate": "nuxt generate",
"nuxt": "3.3.2", "preview": "nuxt preview",
"postcss": "^8.4.31", "postinstall": "nuxt prepare",
"prettier": "2.7.1", "build:prebuild": "node ./scripts/prebuild.js",
"primeicons": "^7.0.0", "build:apidoc": "node ./scripts/build-apidoc.js"
"quill": "2.0.0",
"sass": "1.45.0",
"sass-loader": "8.0.2",
"tailwindcss": "^3.4.1",
"tailwindcss-primeui": "^0.4.0",
"typedoc": "0.23.23",
"primevue": "workspace:*",
"@primevue/core": "workspace:*",
"@primevue/nuxt-module": "workspace:*",
"@primevue/forms": "workspace:*",
"@primeuix/themes": "catalog:",
"yup": "1.4.0",
"zod": "3.23.8",
"valibot": "^0.42.1",
"superstruct": "^2.0.2"
}, },
"dependencies": { "dependencies": {
"@docsearch/js": "^3.3.3" "@docsearch/js": "catalog:app",
"@primeuix/themes": "catalog:",
"@primevue/core": "workspace:*",
"@primevue/forms": "workspace:*",
"@primevue/nuxt-module": "workspace:*",
"primeicons": "catalog:",
"primevue": "workspace:*",
"chart.js": "catalog:app",
"quill": "catalog:app",
"superstruct": "^2.0.2",
"valibot": "^0.42.1",
"yup": "1.4.0",
"zod": "3.23.8"
}, },
"engines": { "devDependencies": {
"node": ">=12.11.0" "@stackblitz/sdk": "^1.8.2",
"autoprefixer": "^10",
"jsdom": "^19.0.0",
"nuxt": "catalog:app",
"postcss": "^8.4.31",
"sass": "catalog:app",
"sass-loader": "catalog:app",
"tailwindcss": "^3",
"tailwindcss-primeui": "catalog:",
"typedoc": "0.27.9",
"vite": "catalog:app"
} }
} }

View File

@ -1,296 +0,0 @@
import alias from '@rollup/plugin-alias';
import { babel } from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import postcss from 'rollup-plugin-postcss';
import vue from 'rollup-plugin-vue';
import fs from 'fs-extra';
import path from 'path';
import viteConfig, { THEME_PRESETS } from './nuxt-vite.config.js';
import pkg from './package.json';
// globals
const GLOBALS = {
vue: 'Vue'
};
// externals
const GLOBAL_EXTERNALS = ['vue', 'chart.js/auto', 'quill'];
const INLINE_EXTERNALS = Object.keys(viteConfig.resolve.alias);
const EXTERNALS = [...GLOBAL_EXTERNALS, ...INLINE_EXTERNALS];
// alias
const ALIAS_ENTRIES = Object.entries(viteConfig.resolve.alias).map(([key, value]) => ({ find: key, replacement: value }));
// plugins
const BABEL_PLUGIN_OPTIONS = {
extensions: ['.js', '.vue'],
exclude: 'node_modules/**',
presets: ['@babel/preset-env'],
plugins: [],
skipPreflightCheck: true,
babelHelpers: 'runtime',
babelrc: false
};
const ALIAS_PLUGIN_OPTIONS = {
entries: ALIAS_ENTRIES
};
const POSTCSS_PLUGIN_OPTIONS = {
sourceMap: false
};
const TERSER_PLUGIN_OPTIONS = {
compress: {
keep_infinity: true,
pure_getters: true,
reduce_funcs: true
},
mangle: {
reserved: ['theme', 'css']
}
};
const PLUGINS = [vue(), postcss(POSTCSS_PLUGIN_OPTIONS), babel(BABEL_PLUGIN_OPTIONS)];
const ENTRY = {
entries: [],
onwarn(warning) {
if (warning.code === 'CIRCULAR_DEPENDENCY') {
//console.error(`(!) ${warning.message}`);
return;
}
},
format: {
cjs_es(options) {
return ENTRY.format.cjs(options).es(options);
},
cjs({ input, output, minify }) {
ENTRY.entries.push({
onwarn: ENTRY.onwarn,
input,
plugins: [...PLUGINS, minify && terser(TERSER_PLUGIN_OPTIONS)],
external: EXTERNALS,
inlineDynamicImports: true,
output: [
{
format: 'cjs',
file: `${output}${minify ? '.min' : ''}.cjs`,
sourcemap: true,
exports: 'auto'
}
]
});
return ENTRY.format;
},
es({ input, output, minify }) {
ENTRY.entries.push({
onwarn: ENTRY.onwarn,
input,
plugins: [...PLUGINS, minify && terser(TERSER_PLUGIN_OPTIONS)],
external: EXTERNALS,
inlineDynamicImports: true,
output: [
{
format: 'es',
file: `${output}${minify ? '.min' : ''}.mjs`,
sourcemap: true,
exports: 'auto'
}
]
});
return ENTRY.format;
},
umd({ name, input, output, minify }) {
ENTRY.entries.push({
onwarn: ENTRY.onwarn,
input,
plugins: [alias(ALIAS_PLUGIN_OPTIONS), ...PLUGINS, minify && terser(TERSER_PLUGIN_OPTIONS)],
external: GLOBAL_EXTERNALS,
inlineDynamicImports: true,
output: [
{
format: 'umd',
name: name ?? 'PrimeVue',
file: `${output}${minify ? '.min' : ''}.js`,
globals: GLOBALS,
exports: 'auto'
}
]
});
return ENTRY.format;
}
}
};
function addFile() {
fs.readdirSync(path.resolve(__dirname, process.env.INPUT_DIR), { withFileTypes: true })
.filter((dir) => dir.isDirectory())
.forEach(({ name: folderName }) => {
fs.readdirSync(path.resolve(__dirname, process.env.INPUT_DIR + folderName)).forEach((file) => {
let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
if (name === folderName) {
const input = process.env.INPUT_DIR + folderName + '/' + file;
const output = process.env.OUTPUT_DIR + folderName + '/' + name;
ENTRY.format.es({ input, output });
}
});
});
}
function addIcon() {
const iconDir = path.resolve(__dirname, process.env.INPUT_DIR + 'icons');
fs.readdirSync(path.resolve(__dirname, iconDir), { withFileTypes: true })
.filter((dir) => dir.isDirectory())
.forEach(({ name: folderName }) => {
fs.readdirSync(path.resolve(__dirname, iconDir + '/' + folderName)).forEach((file) => {
if (/\.vue$/.test(file)) {
const name = file.split(/(.vue)$/)[0].toLowerCase();
const input = process.env.INPUT_DIR + 'icons/' + folderName + '/' + file;
const output = process.env.OUTPUT_DIR + 'icons/' + folderName + '/' + name;
ENTRY.format.es({ input, output });
}
});
});
}
function addStyle() {
fs.readdirSync(path.resolve(__dirname, process.env.INPUT_DIR), { withFileTypes: true })
.filter((dir) => dir.isDirectory())
.forEach(({ name: folderName }) => {
try {
fs.readdirSync(path.resolve(__dirname, process.env.INPUT_DIR + folderName + '/style')).forEach((file) => {
if (/\.js$/.test(file)) {
const name = file.split(/(.js)$/)[0].toLowerCase();
const input = process.env.INPUT_DIR + folderName + '/style/' + file;
const output = process.env.OUTPUT_DIR + folderName + '/style/' + name;
ENTRY.format.es({ input, output });
}
});
} catch {}
});
}
function traverseDir(dir, condition, callback) {
try {
const files = fs.readdirSync(dir);
files.forEach((file) => {
const filePath = path.join(dir, file);
const fileStat = fs.statSync(filePath);
if (fileStat.isDirectory()) {
traverseDir(filePath, condition, callback);
} else if (condition?.(file) && fileStat.isFile()) {
callback?.(file, filePath, dir);
}
});
} catch {}
}
function addThemes() {
traverseDir(
path.resolve(__dirname, process.env.INPUT_DIR + 'themes'),
(file) => file === 'index.js',
(file, filePath, folderPath) => {
const searchFolder = '/' + process.env.INPUT_DIR;
const folderName = folderPath.substring(folderPath.indexOf(searchFolder) + searchFolder.length);
const input = process.env.INPUT_DIR + folderName + '/' + file;
const output = process.env.OUTPUT_DIR + folderName + '/' + 'index';
ENTRY.format.es({ input, output });
}
);
}
function addCore() {
ENTRY.format.es({ input: process.env.INPUT_DIR + 'config/PrimeVue.js', output: process.env.OUTPUT_DIR + 'config/config' });
ENTRY.format.es({ input: process.env.INPUT_DIR + 'service/PrimeVueService.js', output: process.env.OUTPUT_DIR + 'service/primevueservice' });
}
function addPassThrough() {
ENTRY.format.es({ input: process.env.INPUT_DIR + 'passthrough/index.js', output: process.env.OUTPUT_DIR + 'passthrough/index' });
}
function addLibrary() {
THEME_PRESETS?.forEach((preset) => {
ENTRY.format.umd({ name: `PrimeVue.Themes.${preset[0].toUpperCase() + preset.slice(1)}`, input: process.env.INPUT_DIR + `themes/${preset}/index.js`, output: process.env.OUTPUT_DIR + `umd/themes/${preset}`, minify: true });
});
ENTRY.format.umd({ name: 'PrimeVue', input: process.env.INPUT_DIR + 'primevue.js', output: process.env.OUTPUT_DIR + 'umd/primevue', minify: true });
}
function addPackageJson() {
const outputDir = path.resolve(__dirname, process.env.OUTPUT_DIR);
const packageJson = `{
"name": "primevue",
"version": "${pkg.version}",
"private": "false",
"author": "PrimeTek Informatics",
"description": "PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, which has 370+ ready to use UI blocks to build spectacular applications in no time.",
"homepage": "https://primevue.org/",
"repository": {
"type": "git",
"url": "https://github.com/primefaces/primevue.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/primefaces/primevue/issues"
},
"keywords": [
"primevue",
"vue",
"vue.js",
"vue2",
"vue3",
"ui library",
"component library",
"material",
"bootstrap",
"fluent",
"tailwind",
"unstyled",
"passthrough"
],
"unpkg": "umd/primevue.min.js",
"jsdelivr": "umd/primevue.min.js",
"web-types": "./web-types.json",
"vetur": {
"tags": "./vetur-tags.json",
"attributes": "./vetur-attributes.json"
},
"sideEffects": [
"*.vue"
],
"peerDependencies": {
"vue": "^3.5.0"
},
"engines": {
"node": ">=12.11.0"
}
}`;
!fs.existsSync(outputDir) && fs.mkdirSync(outputDir);
fs.writeFileSync(path.resolve(outputDir, 'package.json'), packageJson);
}
addCore();
addStyle();
addThemes();
addIcon();
addFile();
addPassThrough();
addLibrary();
addPackageJson();
export default ENTRY.entries;

View File

@ -1,10 +1,10 @@
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
const primeui = require('tailwindcss-primeui'); import PrimeUI from 'tailwindcss-primeui';
module.exports = { export default {
darkMode: ['selector', '[class="p-dark"]'], darkMode: ['selector', '[class="p-dark"]'],
content: ['./pages/**/*.vue', './layouts/**/*.vue', './components/**/*.{js,vue,ts}', './doc/**/*.{js,vue,ts}', './error.vue'], content: ['./pages/**/*.vue', './layouts/**/*.vue', './components/**/*.{js,vue,ts}', './doc/**/*.{js,vue,ts}', './error.vue'],
plugins: [primeui], plugins: [PrimeUI],
theme: { theme: {
screens: { screens: {
sm: '576px', sm: '576px',

View File

@ -1,4 +1,6 @@
{ {
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"lib": ["dom", "dom.iterable", "esnext"], "lib": ["dom", "dom.iterable", "esnext"],

View File

@ -35,6 +35,7 @@
"dev": "pnpm --filter showcase dev", "dev": "pnpm --filter showcase dev",
"preview": "pnpm --filter showcase preview", "preview": "pnpm --filter showcase preview",
"hot:dev": "DEV_ENV=hot pnpm --filter showcase dev", "hot:dev": "DEV_ENV=hot pnpm --filter showcase dev",
"labs:dev": "pnpm --filter labs dev",
"module:dev": "pnpm --filter @primevue/nuxt-module dev", "module:dev": "pnpm --filter @primevue/nuxt-module dev",
"security:check": "pnpm audit --prod --audit-level high", "security:check": "pnpm audit --prod --audit-level high",
"lint": "eslint .", "lint": "eslint .",
@ -55,10 +56,10 @@
"eslint-plugin-vue": "^9.32.0", "eslint-plugin-vue": "^9.32.0",
"globals": "^15.14.0", "globals": "^15.14.0",
"pnpm": "^9.6.0", "pnpm": "^9.6.0",
"prettier": "3.4.2", "prettier": "^3.5.2",
"rollup-plugin-postcss": "^4.0.0", "rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-vue": "^6.0.0-beta.9", "rollup-plugin-vue": "^6.0.0-beta.9",
"typescript": "^4.9.4" "typescript": "^5.7.3"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@ -1,39 +1,84 @@
![@primevue/nuxt-module](https://github.com/primefaces/primevue-nuxt-module/assets/11868120/c35e1180-573f-4650-bbe9-0c79bff71f05) <!--
Get your module up and running quickly.
# PrimeVue Nuxt Module Find and replace all on all files (CMD+SHIFT+F):
- Name: My Module
- Package name: my-module
- Description: My new Nuxt module
-->
# My Module
[![npm version][npm-version-src]][npm-version-href] [![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href] [![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Discord Chat][discord-src]](discord-href)
[![License][license-src]][license-href] [![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]
- [✨ Release Notes](https://github.com/primefaces/primevue/packages/nuxt-module/blob/main/CHANGELOG.md#changelog) My new Nuxt module for doing amazing things.
- [📖 Documentation](https://primevue.org/nuxt/)
- [✨ &nbsp;Release Notes](/CHANGELOG.md)
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
<!-- - [📖 &nbsp;Documentation](https://example.com) -->
## Features
<!-- Highlight some of the features your module provide here -->
- ⛰ &nbsp;Foo
- 🚠 &nbsp;Bar
- 🌲 &nbsp;Baz
## Quick Setup ## Quick Setup
1. Add `@primevue/nuxt-module` dependency to your project Install the module to your Nuxt application with one command:
```bash ```bash
npx nuxi@latest module add primevue npx nuxi module add my-module
``` ```
2. Add `@primevue/nuxt-module` to the `modules` section of `nuxt.config.{ts,js}` That's it! You can now use My Module in your Nuxt app ✨
```js
{ ## Contribution
modules: ['@primevue/nuxt-module'];
} <details>
<summary>Local development</summary>
```bash
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release
``` ```
That's it! You can now use `@primevue/nuxt-module` in your Nuxt app ✨ </details>
<!-- Badges --> <!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
[npm-version-href]: https://npmjs.com/package/my-module
[npm-version-src]: https://img.shields.io/npm/v/@primevue/nuxt-module/latest.svg?color [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
[npm-version-href]: https://npmjs.com/package/@primevue/nuxt-module [npm-downloads-href]: https://npm.chart.dev/my-module
[npm-downloads-src]: https://img.shields.io/npm/dm/@primevue/nuxt-module
[npm-downloads-href]: https://npmjs.com/package/@primevue/nuxt-module [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
[discord-src]: https://img.shields.io/discord/557940238991753223.svg?colorB=7289da&label=chat&logo=discord [license-href]: https://npmjs.com/package/my-module
[license-src]: https://img.shields.io/npm/l/@primevue/nuxt-module.svg?style=flat&colorB=yellow
[license-href]: https://npmjs.com/package/@primevue/nuxt-module [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
[nuxt-href]: https://nuxt.com

View File

@ -24,8 +24,8 @@
"primevue nuxt3", "primevue nuxt3",
"primevue 4" "primevue 4"
], ],
"sideEffects": false,
"type": "module", "type": "module",
"sideEffects": false,
"main": "./src/module.ts", "main": "./src/module.ts",
"types": "./src/types.d.ts", "types": "./src/types.d.ts",
"files": [ "files": [
@ -58,38 +58,36 @@
"build": "NODE_ENV=production INPUT_DIR=src/ OUTPUT_DIR=dist/ pnpm run build:package", "build": "NODE_ENV=production INPUT_DIR=src/ OUTPUT_DIR=dist/ pnpm run build:package",
"build:package": "pnpm run build:prebuild && pnpm run prepack", "build:package": "pnpm run build:prebuild && pnpm run prepack",
"build:prebuild": "node ./scripts/prebuild.mjs", "build:prebuild": "node ./scripts/prebuild.mjs",
"prepack": "nuxt-module-build", "prepack": "nuxt-module-build build",
"dev": "nuxi dev playground", "dev": "nuxi dev playground",
"dev:build": "nuxi build playground", "dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground", "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
"dev:link": "pnpm link --global && npm link", "dev:link": "pnpm link --global && npm link",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest watch" "test:watch": "vitest watch",
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@nuxt/kit": "^3.7.3", "@nuxt/kit": "^3",
"@primeuix/styled": "catalog:", "@primeuix/styled": "catalog:",
"@primeuix/utils": "catalog:", "@primeuix/utils": "catalog:",
"primevue": "workspace:*", "primevue": "workspace:*",
"@primevue/auto-import-resolver": "workspace:*", "@primevue/auto-import-resolver": "workspace:*",
"@primevue/metadata": "workspace:*", "@primevue/metadata": "workspace:*",
"unplugin-vue-components": "0.27.0", "unplugin-vue-components": "28.4.1",
"pathe": "^1.1.2" "pathe": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.17.17", "@primeuix/themes": "catalog:",
"@nuxt/devtools": "^0.8.5", "@nuxt/devtools": "^2.1.0",
"@nuxt/eslint-config": "^0.2.0", "@nuxt/eslint-config": "^1.1.0",
"@nuxt/module-builder": "^0.8.3", "@nuxt/module-builder": "^0.8.4",
"@nuxt/schema": "^3.7.3", "@nuxt/schema": "^3",
"@nuxt/test-utils": "^3.7.3", "@nuxt/test-utils": "^3",
"changelogen": "^0.5.5", "@types/node": "latest",
"nitropack": "^2.6.3", "changelogen": "^0.6.0",
"nuxt": "3.3.2", "nuxt": "catalog:app",
"vitest": "^1.6.0", "vitest": "^3.0.7",
"@primeuix/themes": "catalog:" "vue-tsc": "~2.1.6"
},
"engines": {
"node": ">=12.11.0"
} }
} }

View File

@ -1,7 +1,9 @@
// @ts-ignore
import Aura from '@primeuix/themes/aura'; import Aura from '@primeuix/themes/aura';
import { defineNuxtConfig } from 'nuxt/config';
export default defineNuxtConfig({ export default defineNuxtConfig({
compatibilityDate: '2025-02-27',
devtools: { enabled: true },
modules: ['../src/module'], modules: ['../src/module'],
primevue: { primevue: {
usePrimeVue: true, usePrimeVue: true,
@ -32,6 +34,5 @@ export default defineNuxtConfig({
include: undefined, include: undefined,
exclude: undefined exclude: undefined
} }
}, }
devtools: { enabled: true }
}); });

View File

@ -7,7 +7,7 @@
"build": "nuxi build", "build": "nuxi build",
"generate": "nuxi generate" "generate": "nuxi generate"
}, },
"devDependencies": { "dependencies": {
"nuxt": "3.3.2" "nuxt": "catalog:app"
} }
} }

View File

@ -1,5 +0,0 @@
import path from 'path';
import { removeBuild, resolvePath, updatePackageJson } from '../../../scripts/build-helper.mjs';
removeBuild(import.meta.url);
updatePackageJson(path.resolve(resolvePath(import.meta.url).__dirname, '../package.json'));

View File

@ -73,15 +73,7 @@ export default defineNuxtModule<ModuleOptions>({
resolvers: [ resolvers: [
PrimeVueResolver({ PrimeVueResolver({
components: moduleOptions.components, components: moduleOptions.components,
directives: moduleOptions.directives, directives: moduleOptions.directives
resolve: (meta: MetaType) => {
registeredStyles.push({
...meta,
name: `${meta.name}Style`,
as: `${meta.as}Style`,
from: `${meta.from}/style`
});
}
}) })
] ]
}, },

View File

@ -45,7 +45,8 @@ function registerComponents(resolvePath: any, moduleOptions: ModuleOptions) {
global: true global: true
}; };
!moduleOptions.autoImport && addComponent(opt); //!moduleOptions.autoImport && addComponent(opt);
addComponent(opt);
return { return {
..._item, ..._item,
@ -111,7 +112,8 @@ function registerStyles(resolvePath: any, registered: any, moduleOptions: Module
} }
]; ];
if (!moduleOptions.autoImport && !options?.unstyled) { if (!options?.unstyled) {
// !moduleOptions.autoImport && !options?.unstyled
if (isNotEmpty(registered?.components)) { if (isNotEmpty(registered?.components)) {
styles.push({ styles.push({
name: 'BaseComponentStyle', name: 'BaseComponentStyle',

View File

@ -1,16 +1,15 @@
import { $fetch, setup } from '@nuxt/test-utils'; import { fileURLToPath } from 'node:url'
import { fileURLToPath } from 'node:url'; import { describe, it, expect } from 'vitest'
import { describe, expect, it } from 'vitest'; import { setup, $fetch } from '@nuxt/test-utils/e2e'
describe('ssr', async () => { describe('ssr', async () => {
await setup({ await setup({
rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)) rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),
}); })
it('renders the index page', async () => { it('renders the index page', async () => {
// Get response to a server-rendered page with `$fetch`. // Get response to a server-rendered page with `$fetch`.
const html = await $fetch('/'); const html = await $fetch('/')
expect(html).toContain('<div>basic</div>')
expect(html).toContain('<div>basic</div>'); })
}); })
});

View File

@ -2,4 +2,5 @@
<div>basic</div> <div>basic</div>
</template> </template>
<script setup></script> <script setup>
</script>

View File

@ -1,5 +1,7 @@
import MyModule from '../../../src/module'; import MyModule from '../../../src/module'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [MyModule] modules: [
}); MyModule,
],
})

View File

@ -1,4 +1,5 @@
{ {
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"module": "es2022", "module": "es2022",
"moduleResolution": "Node", "moduleResolution": "Node",
@ -9,5 +10,9 @@
"@primevue/auto-import-resolver/*": ["../../packages/auto-import-resolver/src/*"] "@primevue/auto-import-resolver/*": ["../../packages/auto-import-resolver/src/*"]
} }
}, },
"exclude": ["node_modules"] "exclude": [
"dist",
"node_modules",
"playground"
]
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,3 +8,15 @@ catalog:
'@primeuix/forms': ^0.0.4 '@primeuix/forms': ^0.0.4
'@primeuix/styles': ^1.0.0 '@primeuix/styles': ^1.0.0
'@primeuix/themes': ^1.0.0 '@primeuix/themes': ^1.0.0
'tailwindcss-primeui': ^0.5.0
'primeicons': ^7.0.0
catalogs:
app:
'nuxt': 3.15.4
'vite': 6.0.11
'sass': 1.45.0
'sass-loader': 8.0.2
'@docsearch/js': ^3
'chart.js': 3.3.2
'quill': 2.0.0