Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

21
Frontend-Learner/node_modules/nuxt-quasar-ui/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2023-PRESENT Ege İliklier (https://github.com/Maiquu)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

248
Frontend-Learner/node_modules/nuxt-quasar-ui/README.md generated vendored Normal file
View file

@ -0,0 +1,248 @@
![Quasar Framework logo](https://cdn.quasar.dev/logo-v2/header.png)
# [Quasar](https://quasar.dev/) Module for [Nuxt](https://nuxt.com/)
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
- [✨  Release Notes](/CHANGELOG.md)
<!-- - [📖 &nbsp;Documentation](https://example.com) -->
## Features
- Automatically import [components](https://quasar.dev/vue-components)
- Automatically import [directives](https://quasar.dev/vue-directives)
- Automatically import svg icon sets provided by [`@quasar/extras`](https://github.com/quasarframework/quasar/tree/dev/extras)
- Configure used [animations](https://animate.style/), [webfonts and icon sets via](https://github.com/quasarframework/quasar/tree/dev/extras) `nuxt.config`
- Configure [Sass/Scss variables](https://quasar.dev/style/sass-scss-variables) used by `quasar`
- [Nuxt DevTools](https://devtools.nuxtjs.org/) support
## Quick Setup
Add `nuxt-quasar-ui` dependency to your project
```bash
npx nuxi@latest module add quasar
```
That's it! You can now use Quasar Nuxt in your Nuxt app ✨
## Demo
[StackBlitz](https://stackblitz.com/edit/github-g9bzsz?file=nuxt.config.ts)
## Usage
```vue
<template>
<q-btn color="primary" label="Primary" />
<QBtn color="secondary" label="Secondary" />
<LazyQBtn color="amber" glossy label="Amber" />
</template>
```
```ts
// app.config.ts
export default defineAppConfig({
// Configure Quasar's Vue plugin (with HMR support)
nuxtQuasar: {
brand: {
primary: '#3993DD'
},
}
})
```
```ts
// nuxt.config.ts
export default defineNuxtConfig({
quasar: {
// Configurable Component Defaults
components: {
defaults: {
QBtn: {
dense: true,
flat: true,
},
QInput: {
dense: true
}
}
}
}
})
```
> See detailed usage at [playground](https://github.com/Maiquu/nuxt-quasar/tree/main/playground)
## Options
### plugins
- Type: `string[]`
- Default: `[]`
List of quasar plugins to apply. (`Dialog`, `Notify` etc.)
### sassVariables
- Type: `boolean | string`
- Default: `false`
Enables usage of Quasar Sass/SCSS variables in `<style>` tags.
Can optionally be a string which points to a file that contains the variables.
> Requires `sass` installed.
> **Note**: Variables will not be injected if any `.sass` file from `quasar` is imported manually.
### lang
- Type: `string`
- Default: `'en-US'`
Default language pack used by Quasar Components.
### iconSet
- Type: `string | QuasarIconSet`
- Default: `'material-icons'`
Icon set used by Quasar Components. Should also be included in `extra.fontIcons` to take effect.
### cssAddon
- Type: `boolean`
- Default: `false`
When enabled, it provides breakpoint aware versions for all flex (and display) related CSS classes.
> **Warning**
> Note that there will be a noticeable bump in CSS footprint when enabling it. So only do it if you really need it.
### appConfigKey
- Type: `string`
- Default: `nuxtQuasar`
Config key used to configure quasar plugin.
### config
- Type: `object`
- Default: `{}`
Configurate default settings of UI related plugins and directives (`Dialog`, `Ripple` etc).
This object can also be configured via `app.config.ts`.
### config.brand
- Type: `object`
- Default: `{}`
Modify css variables used by Quasar. Alternative to `sassVariables`.
This option basicly appends a css file with variables defined at root level.
### extras.font
- Type: `'roboto-font' | 'roboto-font-latin-ext' | null`
- Default: `null`
Requires `@quasar/extras`.
### extras.fontIcons
- Type: `string[]`
- Default: `[]`
Import webfont icon sets provided by `@quasar/extras`.
### extras.svgIcons
- Type: `string[]`
- Default: `[]`
Auto-import svg icon sets provided by `@quasar/extras`.
### extras.animations
- Type: `string[] | "all"`
- Default: `[]`
Import animations provided by `@quasar/extras`.
### components.autoImport
- Type: `boolean`
- Default: `true`
Auto-import quasar components
### components.defaults
- Type: `object`
- Default: `{}`
Set default prop values for quasar components. Does not support props that accepts function values.
## CSS Import Ordering
Module will import css in following order:
1) Fonts
2) Icons
3) Animations
4) Quasar CSS
It is possible to change this order via `css` option.
### Example
```js
export default defineNuxtConfig({
css: [
// ...
'quasar/fonts',
'quasar/animations',
'quasar/icons',
'quasar/css',
// ...
]
})
```
## Notes
Avoid using quasar plugins and composables that manipulate `<meta>` tags.
Use [`useHead`](https://nuxt.com/docs/api/composables/use-head) instead.
List of known plugins/composables that do this:
- [`AddressbarColor`](https://quasar.dev/quasar-plugins/addressbar-color)
- [`Meta`](https://quasar.dev/quasar-plugins/meta)
- [`useMeta`](https://quasar.dev/vue-composables/use-meta)
Quasar 2.15.0 introduces `useId` and `useHydrate` functions which are also provided by nuxt. These functions are not auto-imported in favor of nuxt. If you want to use them for some reason, you need to explicity import them.
## Development
```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
```
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/nuxt-quasar-ui/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/nuxt-quasar-ui
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-quasar-ui.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/nuxt-quasar-ui
[license-src]: https://img.shields.io/npm/l/nuxt-quasar-ui.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/nuxt-quasar-ui

View file

@ -0,0 +1,106 @@
import * as _nuxt_schema from '@nuxt/schema';
import { QuasarUIConfiguration as QuasarUIConfiguration$1, QuasarIconSets, QuasarPlugins, QuasarLanguageCodes, QuasarIconSet, QuasarFonts, QuasarAnimations } from 'quasar';
type ExtractFont<T extends string> = T extends `svg-${string}` ? never : T;
type ExtractSvg<T extends string> = T extends `svg-${infer F}` ? F : never;
type QuasarFontIconSet = ExtractFont<QuasarIconSets>;
type QuasarSvgIconSet = ExtractSvg<QuasarIconSets>;
type QuasarUIConfiguration = Omit<QuasarUIConfiguration$1, 'lang' | 'capacitor' | 'cordova'> & {
addressbarColor?: string;
brand?: {
'dark-page'?: string;
};
};
interface QuasarComponentDefaults {
}
interface ModuleOptions {
/**
* Would you like to use Quasar's SCSS/Sass variables?
* - `true`
* --> yes, all my vue files will be able to use $primary etc
* - `false`
* --> no, don't make the variables available in vue files
* - `'src/my-variables.sass'`
* --> yes, and I'd also like to customize those variables
*
* **Requires `sass`**
*
* **Note:** Variables will not be injected if any `.sass` file from `quasar` is imported manually.
*
* @default false
*/
sassVariables?: string | boolean;
/**
* Quasar Plugins
*
* @see [Documentation](https://quasar.dev/quasar-plugins/)
*/
plugins?: (keyof QuasarPlugins & string)[];
config?: QuasarUIConfiguration;
/**
* Default Language pack used by Quasar
*
* @see [Documentation](https://quasar.dev/options/quasar-language-packs)
*/
lang?: QuasarLanguageCodes;
/**
* Icon Set used by Quasar Components.
* @default 'material-icons'
*/
iconSet?: QuasarIconSets | QuasarIconSet;
/**
* If selected quasar `iconSet` is a font set, it will automatically be included in `extras.fontIcons`.
* @default true
*/
autoIncludeIconSet?: boolean;
/**
* App Config Key
*
* @default 'nuxtQuasar'
*/
appConfigKey?: string;
/**
* When enabled, it provides breakpoint aware versions for all flex (and display) related CSS classes.
*
* @see [Documentation](https://quasar.dev/layout/grid/introduction-to-flexbox#flex-addons)
*/
cssAddon?: boolean;
/**
* `@quasar/extras` options.
*
* @see [Documentation](https://github.com/quasarframework/quasar/blob/dev/extras/README.md)
*/
extras?: {
font?: QuasarFonts | null;
/** Icons that are imported as webfont. */
fontIcons?: QuasarFontIconSet[];
/** Automaticly import selected svg icon sets provided by `@quasar/extras`. */
svgIcons?: QuasarSvgIconSet[];
/**
* Animations provided by quasar.
*
* @see [Documentation](https://quasar.dev/options/animations)
*/
animations?: QuasarAnimations[] | 'all';
};
/**
* Component Settings
*/
components?: {
/**
* Set defaults for quasar components
*/
defaults?: QuasarComponentDefaults;
/**
* Auto-import quasar components
* @default true
*/
autoImport?: boolean;
};
}
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
export { _default as default };
export type { ModuleOptions, QuasarComponentDefaults, QuasarUIConfiguration };

View file

@ -0,0 +1,12 @@
{
"name": "quasar",
"version": "3.0.0",
"configKey": "quasar",
"compatibility": {
"nuxt": ">=3.0.0"
},
"builder": {
"@nuxt/module-builder": "1.0.2",
"unbuild": "3.6.1"
}
}

View file

@ -0,0 +1,584 @@
import path, { dirname, resolve } from 'node:path';
import { useNuxt, logger, defineNuxtModule, createResolver, resolvePath, addPlugin, addTemplate, addTypeTemplate, addComponent, addImports, addImportsSources } from '@nuxt/kit';
import { parseNodeModulePath } from 'mlly';
import MagicString from 'magic-string';
import os from 'node:os';
import { readFile } from 'node:fs/promises';
import pMemoize from 'p-memoize';
import semver from 'semver';
const version = "3.0.0";
const directivesRegExp = /(?<=[ (])_?resolveDirective\(\s*["']([^'"]*)["'][^)]*\)/g;
function transformDirectivesPlugin(context) {
const { sourcemap } = useNuxt().options;
return {
name: "quasar:directive",
enforce: "post",
transform(code, id) {
const [filename] = id.split("?", 2);
if (!filename || !filename.endsWith(".vue"))
return null;
const s = new MagicString(code);
const directives = [];
let counter = 0;
s.replace(directivesRegExp, (full, name) => {
const directive = context.imports.directives.find((d) => d.kebabCase === name);
if (directive) {
const alias = `__q_directive_${counter++}`;
directives.push({
name: directive.name,
alias
});
return alias;
} else {
return full;
}
});
if (directives.length) {
s.prepend(
`${directives.map((d) => `import { ${d.name} as ${d.alias} } from "quasar"`).join("\n")}
`
);
}
if (s.hasChanged()) {
return {
code: s.toString(),
map: sourcemap[context.mode] ? s.generateMap({ source: id, includeContent: true }) : void 0
};
}
}
};
}
const isWindows = os.platform() === "win32";
function slash(p) {
return p.replace(/\\/g, "/");
}
function normalizePath(id) {
return path.posix.normalize(isWindows ? slash(id) : id);
}
const readFileMemoized = pMemoize(async (path2) => {
return readFile(path2, "utf-8");
});
const readJSON = pMemoize(async (path2) => {
return JSON.parse(await readFile(path2, "utf-8"));
});
const PASCAL_CASE = /[a-z][A-Z]|^[A-Z]/g;
function kebabCase(string) {
return string.replaceAll(
PASCAL_CASE,
(match) => match.length === 1 ? match[0].toLowerCase() : `${match[0]}-${match[1].toLowerCase()}`
);
}
function hasKeys(object) {
return Object.keys(object || {}).length > 0;
}
function parseVueRequest(id) {
const [filename = "", rawQuery] = id.split("?", 2);
const query = Object.fromEntries(new URLSearchParams(rawQuery));
if (query.vue != null) {
query.vue = true;
}
return {
filename,
query
};
}
function uniq(arr) {
return [...new Set(arr)];
}
function transformScssPlugin({ options }) {
const sassVariables = typeof options.sassVariables === "string" ? normalizePath(options.sassVariables) : options.sassVariables;
const scssTransform = createScssTransform("scss", sassVariables);
const sassTransform = createScssTransform("sass", sassVariables);
return {
name: "quasar:scss",
enforce: "pre",
transform(src, id) {
const { filename, query } = parseVueRequest(id);
let code;
if (query.vue && query.type === "style") {
const lang = Object.keys(query).find((k) => k.startsWith("lang."));
if (lang?.endsWith(".scss")) {
code = scssTransform(src);
} else if (lang?.endsWith(".sass")) {
code = sassTransform(src);
}
}
if (!query.vue) {
if (filename.endsWith(".scss")) {
code = scssTransform(src);
} else if (filename.endsWith(".sass")) {
code = sassTransform(src);
}
}
if (code) {
return { code, map: null };
}
}
};
}
function createScssTransform(fileExtension, sassVariables) {
return (content) => {
const hasQuasarVariables = content.includes("quasar/src/css/variables") || content.includes("quasar/dist/") || /@use\s+['"]quasar(?:[/'"]|$)/.test(content);
const sassUseStatements = [];
if (hasQuasarVariables) {
return content;
} else if (typeof sassVariables === "string") {
sassUseStatements.push(`@use '${sassVariables}' as *`);
} else {
sassUseStatements.push("@use 'quasar/src/css/variables.sass' as *");
}
sassUseStatements.push("");
const prefix = fileExtension === "sass" ? sassUseStatements.join("\n") : sassUseStatements.join(";\n");
const useIndex = Math.max(content.lastIndexOf("@use "), content.lastIndexOf("@forward "));
if (useIndex === -1) {
return prefix + content;
}
const newLineIndex = content.indexOf("\n", useIndex);
if (newLineIndex !== -1) {
const index = newLineIndex + 1;
return content.substring(0, index) + prefix + content.substring(index);
}
return `${content}
${prefix}`;
};
}
const QUASAR_ENTRY = "quasar";
const QUASAR_VIRTUAL_ENTRY = "/__quasar/entry.mjs";
function virtualQuasarEntryPlugin(context) {
const { resolveQuasar, quasarVersion } = context;
const quasarGte216 = semver.gte(quasarVersion, "2.16.0");
const clientEntry = quasarGte216 ? resolveQuasar("dist/quasar.client.js") : resolveQuasar("dist/quasar.esm.js");
const serverEntry = quasarGte216 ? resolveQuasar("dist/quasar.server.prod.js") : resolveQuasar("src/index.ssr.js");
return {
name: "quasar:entry",
enforce: "pre",
config(config) {
config.ssr ??= {};
config.ssr.noExternal ??= [];
if (config.ssr.noExternal !== true) {
config.ssr.noExternal = toArray(config.ssr.noExternal);
config.ssr.noExternal.push(/\/node_modules\/quasar\/src\//);
}
},
resolveId(id) {
if (id === QUASAR_ENTRY) {
return {
id: context.dev ? context.mode === "client" ? clientEntry : serverEntry : QUASAR_VIRTUAL_ENTRY,
moduleSideEffects: false
};
}
},
async load(id) {
if (!context.dev && id === QUASAR_VIRTUAL_ENTRY)
return Object.entries(context.imports.raw).filter(([, path]) => !path.includes("/__tests__/")).map(([name, path]) => `export { default as ${name} } from "quasar/${path}"`).join("\n");
}
};
}
function toArray(value) {
return Array.isArray(value) ? value : [value];
}
const moduleName = "nuxt-quasar-ui";
const quasarFontsPath = "quasar/fonts";
const quasarAnimationsPath = "quasar/animations";
const quasarIconsPath = "quasar/icons";
const quasarCssPath = "quasar/css";
const quasarBrandPath = "quasar/brand";
const RESOLVED_ID$1 = "/__quasar/animations.css";
const RESOLVED_ID_WITH_QUERY_RE$1 = /([/\\])__quasar\1animations\.css(\?.*)?$/;
function virtualAnimationsPlugin({ options, resolveQuasarExtras }) {
return {
name: "quasar:animations",
resolveId(id) {
if (id.match(RESOLVED_ID_WITH_QUERY_RE$1))
return id;
const [path] = id.split("?");
if (path === quasarAnimationsPath)
return RESOLVED_ID$1;
},
async load(id) {
if (!RESOLVED_ID_WITH_QUERY_RE$1.test(id))
return;
let animations = options.extras?.animations || [];
if (animations === "all") {
const { generalAnimations, inAnimations, outAnimations } = await import('@quasar/extras/animate/animate-list.mjs');
animations = [...generalAnimations, ...inAnimations, ...outAnimations];
} else {
animations = uniq(animations);
}
const cssArray = await Promise.all(
animations.map(
(animation) => readFile(resolveQuasarExtras(`animate/${animation}.css`), "utf8")
)
);
return cssArray.join("\n");
}
};
}
const RESOLVED_ID = "/__quasar/brand.css";
const RESOLVED_ID_WITH_QUERY_RE = /([/\\])__quasar\1brand\.css(\?.*)?$/;
function virtualBrandPlugin(context) {
return {
name: "quasar:brand",
resolveId(id) {
if (id.match(RESOLVED_ID_WITH_QUERY_RE))
return id;
const [path] = id.split("?");
if (path === quasarBrandPath)
return RESOLVED_ID;
},
load(id) {
if (RESOLVED_ID_WITH_QUERY_RE.test(id))
return [
":root {",
...Object.entries(context.options.config?.brand || {}).map(([name, color]) => ` --q-${name}: ${color};`),
"}"
].join("\n");
}
};
}
function setupCss(css, options) {
const brand = options.config?.brand || {};
if (css.includes(quasarBrandPath)) {
logger.warn('Re-ordering "quasar/brand" is deprecated. In a future version, brand variables will always be defined in body tag.');
}
if (!css.includes(quasarBrandPath) && Object.keys(brand).length) {
css.unshift(quasarBrandPath);
}
const quasarCss = [
typeof options.sassVariables === "string" ? "quasar/dist/quasar.sass" : "quasar/dist/quasar.css"
];
if (options.cssAddon) {
quasarCss.push("quasar/dist/quasar.addon.css");
}
const index = css.indexOf(quasarCssPath);
if (index !== -1) {
css.splice(index, 1, ...quasarCss);
} else {
css.unshift(...quasarCss);
}
const animations = options.extras?.animations || [];
if (!css.includes(quasarAnimationsPath) && animations.length) {
css.unshift(quasarAnimationsPath);
}
if (options.extras?.fontIcons) {
const i = css.indexOf(quasarIconsPath);
if (i !== -1) {
css.splice(i, 1, ...uniq(options.extras.fontIcons).map(resolveFontIcon));
} else {
css.unshift(...uniq(options.extras.fontIcons).map(resolveFontIcon));
}
}
if (options.extras?.font) {
const i = css.indexOf(quasarFontsPath);
if (i !== -1) {
css.splice(i, 1, resolveFont(options.extras.font));
} else {
css.unshift(resolveFont(options.extras.font));
}
}
return css;
}
function resolveFontIcon(icon) {
return `@quasar/extras/${icon}/${icon}.css`;
}
function resolveFont(font) {
return `@quasar/extras/${font}/${font}.css`;
}
function when(condition, content) {
return condition ? typeof content === "function" ? content() : content : "";
}
function generateTemplateQuasarConfig(context) {
const plugins = uniq(context.options.plugins || []);
const { config, lang, iconSet, components } = context.options;
const componentsWithDefaults = Object.entries(components?.defaults || {}).filter(([_, props]) => hasKeys(props)).map(([name]) => name);
const ext = semver.gte(context.quasarVersion, "2.16.0") ? ".js" : ".mjs";
return `${when(lang, () => `import lang from "quasar/lang/${lang}${ext}"`)}
${when(typeof iconSet === "string", () => `import iconSet from "quasar/icon-set/${iconSet}${ext}"`)}
${when(plugins.length, () => `import { ${plugins} } from "quasar"`)}
${when(componentsWithDefaults.length, () => `import { ${componentsWithDefaults} } from "quasar"`)}
export const componentsWithDefaults = { ${componentsWithDefaults} }
export const appConfigKey = ${JSON.stringify(context.options.appConfigKey)}
export const quasarNuxtConfig = {
${when(lang, "lang,")}
${typeof iconSet === "string" ? "iconSet" : `iconSet: ${iconSet ? JSON.stringify(iconSet) : '"material-icons"'}`},
components: ${JSON.stringify(components || {})},
plugins: {${plugins.join(",") || ""}},
${when(config, () => `config: ${JSON.stringify(config)}`)}
}`;
}
async function generateTemplateShims(context) {
const componentNames = context.imports.components.map((c) => c.name);
return `type KeysMatching<T, V> = {
[K in keyof T]-?: T[K] extends V ? K : never
}[keyof T] & keyof T
type OptionalKeys<T extends object> = Exclude<{
[K in keyof T]: T extends Record<K, T[K]> ? never : K
}[keyof T], undefined>
type OmitMatching<T extends object, V> = Omit<T, KeysMatching<T, V>>
type OmitFnProps<T extends object> = OmitMatching<T, ((...args: any[]) => any) | undefined>
type PickOptionalProps<T extends object> = Pick<T, OptionalKeys<T>>
declare module '${moduleName}' {
interface QuasarComponentDefaults {
${componentNames.map(
(name) => ` ${name}?: PickOptionalProps<OmitFnProps<import("quasar").${name}Props>>`
).join("\n")}
}
}
declare module '@nuxt/schema' {
interface AppConfigInput {
[${JSON.stringify(context.options.appConfigKey)}]?: import("nuxt-quasar-ui").QuasarUIConfiguration
}
interface AppConfig {
[${JSON.stringify(context.options.appConfigKey)}]?: import("nuxt-quasar-ui").QuasarUIConfiguration
}
}
export {}
`;
}
const module$1 = defineNuxtModule({
meta: {
name: "quasar",
version,
configKey: "quasar",
compatibility: {
nuxt: ">=3.0.0"
}
},
defaults: {
lang: "en-US",
iconSet: "material-icons",
autoIncludeIconSet: true,
cssAddon: false,
sassVariables: false,
appConfigKey: "nuxtQuasar",
components: {
defaults: {},
autoImport: true
},
plugins: [],
extras: {}
},
async setup(options, nuxt) {
const { resolve: resolveLocal } = createResolver(import.meta.url);
const { resolve: resolveQuasar } = createResolver(dirname(await resolvePath("quasar/package.json")));
const { resolve: resolveQuasarExtras } = createResolver(dirname(await resolvePath("@quasar/extras/package.json")));
const { version: quasarVersion } = await readJSON(resolveQuasar("package.json"));
const importMap = await readJSON(resolveQuasar("dist/transforms/import-map.json"));
const transformAssetUrls = await readJSON(resolveQuasar("dist/transforms/loader-asset-urls.json"));
const imports = categorizeImports(importMap, resolveQuasar);
const sassVersion = await getSassVersion();
const baseContext = {
ssr: nuxt.options.ssr,
dev: nuxt.options.dev,
imports,
options,
quasarVersion,
sassVersion,
resolveLocal,
resolveQuasar,
resolveQuasarExtras
};
if (options.autoIncludeIconSet && typeof options.iconSet === "string" && isFontIconSet(options.iconSet) && !options.extras?.fontIcons?.includes(options.iconSet)) {
options.extras ??= {};
options.extras.fontIcons ??= [];
options.extras.fontIcons.push(options.iconSet);
}
setupCss(nuxt.options.css, options);
addPlugin(resolveLocal("./runtime/plugin"));
addTemplate({
write: true,
filename: "quasar.config.mjs",
getContents: () => generateTemplateQuasarConfig(baseContext)
});
addTypeTemplate({
filename: "quasar.shims.d.ts",
getContents: () => generateTemplateShims(baseContext)
});
if (options.components?.autoImport !== false) {
for (const component of imports.components) {
addComponent({
name: component.name,
export: component.name,
filePath: "quasar",
// TOFIX: Nuxt v3.13.2 tries to resolve full component paths with following PR: https://github.com/nuxt/nuxt/pull/28843
// Since this module has a custom way of resolving quasar, this breaks things.
// Adding this property prevents nuxt from resolving components, but since this is an internal property, it might break again in future.
// @ts-expect-error untyped internal property
_scanned: true
});
}
}
if (nuxt.options.imports.autoImport !== false) {
const ignoredComposables = ["useId", "useHydration"];
for (const composable of imports.composables.filter((c) => !ignoredComposables.includes(c.name))) {
addImports({
name: composable.name,
from: "quasar"
});
}
if (options.plugins) {
for (const plugin of uniq(options.plugins)) {
const pluginPath = imports.plugins.find((p) => p.name === plugin)?.path;
if (pluginPath) {
addImports({
name: plugin,
from: "quasar"
});
}
}
}
if (options.extras?.svgIcons) {
for (const iconSet of uniq(options.extras.svgIcons)) {
const icons = await getIconsFromIconset(iconSet, resolveQuasarExtras);
addImportsSources({
from: `@quasar/extras/${iconSet}`,
imports: icons
});
}
}
}
nuxt.hook("prepare:types", ({ references }) => {
references.unshift({ types: "quasar" });
});
nuxt.hook("vite:extendConfig", (config, { isClient, isServer }) => {
const ssr = nuxt.options.ssr;
const context = {
...baseContext,
mode: isServer ? "server" : "client"
};
config.optimizeDeps ??= {};
config.optimizeDeps.exclude ??= [];
config.optimizeDeps.exclude.push("quasar");
config.vue ??= {};
config.vue.template ??= {};
if (config.vue.template.transformAssetUrls !== false) {
config.vue.template.transformAssetUrls ??= {};
config.vue.template.transformAssetUrls = {
...config.vue.template.transformAssetUrls,
...transformAssetUrls
};
}
config.define = {
...config.define,
__QUASAR_VERSION__: `'${quasarVersion}'`,
__QUASAR_SSR__: ssr,
__QUASAR_SSR_SERVER__: ssr && isServer,
__QUASAR_SSR_CLIENT__: ssr && isClient,
__QUASAR_SSR_PWA__: false
};
config.plugins ??= [];
config.plugins.push(
virtualAnimationsPlugin(context),
virtualBrandPlugin(context),
transformDirectivesPlugin(context),
virtualQuasarEntryPlugin(context)
);
if (options.sassVariables) {
config.plugins.push(transformScssPlugin(context));
}
});
nuxt.hook("nitro:config", async (config) => {
config.replace = {
...config.replace,
__QUASAR_VERSION__: `'${quasarVersion}'`,
__QUASAR_SSR__: nuxt.options.ssr,
__QUASAR_SSR_SERVER__: true,
__QUASAR_SSR_CLIENT__: false,
__QUASAR_SSR_PWA__: false
};
config.externals ??= {};
config.externals.inline ??= [];
config.externals.inline.push("quasar");
});
nuxt.hook("devtools:customTabs", (tabs) => {
tabs.push({
name: "quasar",
title: "Quasar",
icon: "vscode-icons-file-type-light-quasar",
view: {
type: "iframe",
src: "https://quasar.dev/vue-components"
}
});
});
}
});
function isFontIconSet(iconSet) {
return !iconSet.startsWith("svg-");
}
function categorizeImports(importMap, quasarResolve) {
const imports = {
raw: importMap,
components: [],
composables: [],
directives: [],
plugins: []
};
for (const [name, path] of Object.entries(importMap)) {
const importData = {
name,
path: quasarResolve(path)
};
if (path.includes("/components/") && !path.includes("/__tests__/")) {
imports.components.push(importData);
} else if (path.includes("/composables/")) {
imports.composables.push(importData);
} else if (path.includes("/directives/")) {
imports.directives.push({
...importData,
kebabCase: kebabCase(name)
});
} else if (path.includes("/plugins/")) {
imports.plugins.push(importData);
}
}
return imports;
}
const iconDeclarationPattern = /^export declare const ([a-zA-Z\d]+): string;?$/gm;
async function getIconsFromIconset(iconSet, resolveQuasarExtras) {
try {
const icons = await readJSON(resolveQuasarExtras(`${iconSet}/icons.json`));
return icons;
} catch {
const path = resolveQuasarExtras(`${iconSet}/index.d.ts`);
const dts = await readFileMemoized(path);
const icons = [...dts.matchAll(iconDeclarationPattern)].map((arr) => arr[1]);
return icons;
}
}
async function getSassVersion() {
try {
const sassEntry = await resolvePath("sass");
const modulePath = parseNodeModulePath(sassEntry);
if (modulePath.dir) {
const { version: version2 } = await readJSON(resolve(modulePath.dir, modulePath.name, "./package.json"));
return version2;
}
} catch {
}
return null;
}
export { module$1 as default };

View file

@ -0,0 +1,7 @@
import type { QVueGlobals } from 'quasar';
declare const _default: import("nuxt/app").Plugin<{
q: QVueGlobals;
}> & import("nuxt/app").ObjectPlugin<{
q: QVueGlobals;
}>;
export default _default;

View file

@ -0,0 +1,165 @@
import { Quasar, useQuasar } from "quasar";
import { defuFn } from "defu";
import { defineNuxtPlugin } from "#app";
import { computed, reactive, useAppConfig, useHead, watch } from "#imports";
import { appConfigKey, componentsWithDefaults, quasarNuxtConfig } from "#build/quasar.config.mjs";
function getUpdatedDefaults(cfg, prevCfg) {
const prevKeys = Object.keys(prevCfg);
return {
...Object.fromEntries(prevKeys.map((k) => [k, void 0])),
...cfg
};
}
function getPrimaryColor() {
return getComputedStyle(document.body).getPropertyValue("--q-primary").trim();
}
function omit(object, keys) {
return Object.keys(object).reduce((output, key) => {
if (!keys.includes(key)) {
output[key] = object[key];
}
return output;
}, {});
}
export default defineNuxtPlugin((nuxt) => {
const quasarAppConfig = useAppConfig()[appConfigKey];
const { lang, iconSet, plugins, components } = quasarNuxtConfig;
let ssrContext;
let quasarProxy;
let config = defuFn(quasarAppConfig, omit(quasarNuxtConfig.config || {}, ["brand"]));
if (import.meta.server) {
const BRAND_RE = /--q-[\w-]+:.+?;/g;
const meta = reactive({
bodyClasses: "",
htmlAttrs: "",
endingHeadTags: ""
});
const htmlAttrsRecord = computed(
() => Object.fromEntries(
meta.htmlAttrs.split(" ").map((attr) => attr.split("="))
)
);
const bodyStyles = computed(() => {
return [...meta.endingHeadTags.matchAll(BRAND_RE)].map((match) => match[0]).join("");
});
useHead(
computed(() => ({
bodyAttrs: {
class: meta.bodyClasses,
style: bodyStyles.value
},
htmlAttrs: htmlAttrsRecord.value
}))
);
ssrContext = {
req: nuxt.ssrContext.event.node.req,
res: nuxt.ssrContext.event.node.res
};
quasarProxy = {
install({ ssrContext: ssrContext2 }) {
meta.bodyClasses = ssrContext2._meta.bodyClasses;
meta.htmlAttrs = ssrContext2._meta.htmlAttrs;
meta.endingHeadTags = ssrContext2._meta.endingHeadTags;
ssrContext2._meta = new Proxy({}, {
get(target, key) {
return meta[key] ?? target[key];
},
set(target, key, value) {
if (typeof meta[key] === "string") {
meta[key] = value;
} else {
target[key] = value;
}
return true;
}
});
}
};
} else {
quasarProxy = {
install({ onSSRHydrated }) {
nuxt.hook("app:suspense:resolve", () => {
onSSRHydrated.forEach((fn) => fn());
});
}
};
}
nuxt.vueApp.use(Quasar, {
lang,
iconSet,
plugins: {
quasarProxy,
...plugins
},
config
}, ssrContext);
const quasar = useQuasar();
const asDefault = (value) => value && typeof value === "object" ? () => value : value;
for (const [name, propDefaults] of Object.entries(components.defaults || {})) {
const component = componentsWithDefaults[name];
if (!component) {
continue;
}
for (const [propName, defaultValue] of Object.entries(propDefaults)) {
const propConfig = component.props[propName];
if (Array.isArray(propConfig) || typeof propConfig === "function") {
component.props[propName] = {
type: propConfig,
default: asDefault(defaultValue)
};
} else if (typeof propConfig === "object") {
if (propConfig) {
propConfig.default = asDefault(defaultValue);
} else {
component.props[propName] = {
default: asDefault(defaultValue)
};
}
} else {
throw new TypeError(`Unexpected prop definition type used at ${name}.props.${propName}, please open an issue.`);
}
}
}
if (import.meta.dev && import.meta.client) {
watch(
() => quasarAppConfig,
(newAppConfig) => {
const prevConfig = config;
config = defuFn(newAppConfig, quasarNuxtConfig.config);
quasar.addressbarColor?.set(config.addressbarColor || getPrimaryColor());
const modifiedBrand = getUpdatedDefaults(
config.brand || {},
prevConfig.brand || {}
);
for (const [name, color] of Object.entries(modifiedBrand)) {
if (!color) {
document.body.style.removeProperty(`--q-${name}`);
} else {
document.body.style.setProperty(`--q-${name}`, color);
}
}
if (prevConfig.dark !== config.dark) {
quasar.dark.set(config.dark || false);
}
quasar.loading?.setDefaults(getUpdatedDefaults(
config.loading || {},
prevConfig.loading || {}
));
quasar.loadingBar?.setDefaults(getUpdatedDefaults(
config.loadingBar || {},
prevConfig.loadingBar || {}
));
plugins.Notify?.setDefaults(getUpdatedDefaults(
config.loadingBar || {},
prevConfig.loadingBar || {}
));
},
{ deep: true }
);
}
return {
provide: {
q: quasar
}
};
});

View file

@ -0,0 +1,3 @@
export { default } from './module.mjs'
export { type ModuleOptions, type QuasarComponentDefaults, type QuasarUIConfiguration } from './module.mjs'

View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016-present - Nuxt Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,117 @@
[![Nuxt banner](https://github.com/nuxt/nuxt/blob/main/.github/assets/banner.svg)](https://nuxt.com)
# Nuxt
<p>
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a>
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a>
<a href="https://github.com/nuxt/nuxt/blob/main/LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
<a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt%20Docs-18181B?logo=nuxt" alt="Website"></a>
<a href="https://chat.nuxt.dev"><img src="https://img.shields.io/badge/Nuxt%20Discord-18181B?logo=discord" alt="Discord"></a>
<a href="https://securityscorecards.dev/"><img src="https://api.securityscorecards.dev/projects/github.com/nuxt/nuxt/badge" alt="Nuxt openssf scorecard score"></a>
</p>
Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.
It provides a number of features that make it easy to build fast, SEO-friendly, and scalable web applications, including:
- Server-side rendering, static site generation, hybrid rendering and edge-side rendering
- Automatic routing with code-splitting and pre-fetching
- Data fetching and state management
- Search engine optimization and defining meta tags
- Auto imports of components, composables and utils
- TypeScript with zero configuration
- Go full-stack with our server/ directory
- Extensible with [200+ modules](https://nuxt.com/modules)
- Deployment to a variety of [hosting platforms](https://nuxt.com/deploy)
- ...[and much more](https://nuxt.com) 🚀
### Table of Contents
- 🚀 [Getting Started](#getting-started)
- 💻 [ Vue Development](#vue-development)
- 📖 [Documentation](#documentation)
- 🧩 [Modules](#modules)
- ❤️ [Contribute](#contribute)
- 🏠 [Local Development](#local-development)
- 🛟 [Professional Support](#professional-support)
- 🔗 [Follow Us](#follow-us)
- ⚖️ [License](#license)
---
## <a name="getting-started">🚀 Getting Started</a>
Use the following command to create a new starter project. This will create a starter project with all the necessary files and dependencies:
```bash
npm create nuxt@latest <my-project>
```
> [!TIP]
> Discover also [nuxt.new](https://nuxt.new): Open a Nuxt starter on CodeSandbox, StackBlitz or locally to get up and running in a few seconds.
## <a name="vue-development">💻 Vue Development</a>
Simple, intuitive and powerful, Nuxt lets you write Vue components in a way that makes sense. Every repetitive task is automated, so you can focus on writing your full-stack Vue application with confidence.
Example of an `app.vue`:
```vue
<script setup lang="ts">
useSeoMeta({
title: 'Meet Nuxt',
description: 'The Intuitive Vue Framework.',
})
</script>
<template>
<div id="app">
<AppHeader />
<NuxtPage />
<AppFooter />
</div>
</template>
<style scoped>
#app {
background-color: #020420;
color: #00DC82;
}
</style>
```
## <a name="documentation">📖 Documentation</a>
We highly recommend you take a look at the [Nuxt documentation](https://nuxt.com/docs) to level up. Its a great resource for learning more about the framework. It covers everything from getting started to advanced topics.
## <a name="modules">🧩 Modules</a>
Discover our [list of modules](https://nuxt.com/modules) to supercharge your Nuxt project, created by the Nuxt team and community.
## <a name="contribute">❤️ Contribute</a>
We invite you to contribute and help improve Nuxt 💚
Here are a few ways you can get involved:
- **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/4.x/community/reporting-bugs) to learn how to submit a bug report.
- **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/4.x/community/contribution) to share your suggestions.
- **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/4.x/community/getting-help) provides resources to help you out.
## <a name="local-development">🏠 Local Development</a>
Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/4.x/community/framework-contribution#setup) to contribute to the framework and documentation.
## <a name="professional-support">🛟 Professional Support</a>
- Technical audit & consulting: [Nuxt Experts](https://nuxt.com/enterprise/support)
- Custom development & more: [Nuxt Agencies Partners](https://nuxt.com/enterprise/agencies)
## <a name="follow-us">🔗 Follow Us</a>
<p valign="center">
<a href="https://go.nuxt.com/discord"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/discord.svg" alt="Discord"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/x"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/twitter.svg" alt="Twitter"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/github"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/github.svg" alt="GitHub"></a>&nbsp;&nbsp;<a href="https://go.nuxt.com/bluesky"><img width="20px" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/bluesky.svg" alt="Bluesky"></a>
</p>
## <a name="license">⚖️ License</a>
[MIT](https://github.com/nuxt/nuxt/blob/main/LICENSE)

View file

@ -0,0 +1,552 @@
import * as _nuxt_schema from '@nuxt/schema';
import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, NuxtAppConfig, NuxtCompatibility, NuxtCompatibilityIssues, Component, ComponentsDir, NuxtTemplate, NuxtMiddleware, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
import { LoadConfigOptions } from 'c12';
import { Import, InlinePreset } from 'unimport';
import { WebpackPluginInstance, Configuration } from 'webpack';
import { RspackPluginInstance } from '@rspack/core';
import { Plugin, UserConfig } from 'vite';
import * as unctx from 'unctx';
import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types';
import { GlobOptions } from 'tinyglobby';
import * as consola from 'consola';
import { ConsolaOptions } from 'consola';
/**
* Define a Nuxt module, automatically merging defaults with user provided options, installing
* any hooks that are provided, and calling an optional setup function for full control.
*/
declare function defineNuxtModule<TOptions extends ModuleOptions>(definition: ModuleDefinition<TOptions, Partial<TOptions>, false> | NuxtModule<TOptions, Partial<TOptions>, false>): NuxtModule<TOptions, TOptions, false>;
declare function defineNuxtModule<TOptions extends ModuleOptions>(): {
with: <TOptionsDefaults extends Partial<TOptions>>(definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | NuxtModule<TOptions, TOptionsDefaults, true>) => NuxtModule<TOptions, TOptionsDefaults, true>;
};
type ModuleToInstall = string | NuxtModule<ModuleOptions, Partial<ModuleOptions>, false>;
/**
* Installs a set of modules on a Nuxt instance.
* @internal
*/
declare function installModules(modulesToInstall: Map<ModuleToInstall, Record<string, any>>, resolvedModulePaths: Set<string>, nuxt?: Nuxt): Promise<void>;
/**
* Installs a module on a Nuxt instance.
* @deprecated Use module dependencies.
*/
declare function installModule<T extends string | NuxtModule, Config extends Extract<NonNullable<NuxtConfig['modules']>[number], [T, any]>>(moduleToInstall: T, inlineOptions?: [Config] extends [never] ? any : Config[1], nuxt?: Nuxt): Promise<void>;
declare function resolveModuleWithOptions(definition: NuxtModule<any> | string | false | undefined | null | [(NuxtModule | string)?, Record<string, any>?], nuxt: Nuxt): {
resolvedPath?: string;
module: string | NuxtModule<any>;
options: Record<string, any>;
} | undefined;
declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{
nuxtModule: NuxtModule<any>;
buildTimeModuleMeta: ModuleMeta;
resolvedModulePath?: string;
}>;
declare function getDirectory(p: string): string;
declare const normalizeModuleTranspilePath: (p: string) => string;
/**
* Check if a Nuxt module is installed by name.
*
* This will check both the installed modules and the modules to be installed. Note
* that it cannot detect if a module is _going to be_ installed programmatically by another module.
*/
declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
/**
* Checks if a Nuxt Module is compatible with a given semver version.
*/
declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
/**
* Get the version of a Nuxt module.
*
* Scans installed modules for the version, if it's not found it will attempt to load the module instance and get the version from there.
*/
declare function getNuxtModuleVersion(module: string | NuxtModule, nuxt?: Nuxt | any): Promise<string | false>;
interface LoadNuxtConfigOptions extends Omit<LoadConfigOptions<NuxtConfig>, 'overrides'> {
overrides?: Exclude<LoadConfigOptions<NuxtConfig>['overrides'], Promise<any> | Function>;
}
declare function loadNuxtConfig(opts: LoadNuxtConfigOptions): Promise<NuxtOptions>;
declare function extendNuxtSchema(def: SchemaDefinition | (() => SchemaDefinition)): void;
interface LoadNuxtOptions extends LoadNuxtConfigOptions {
/** Load nuxt with development mode */
dev?: boolean;
/** Use lazy initialization of nuxt if set to false */
ready?: boolean;
}
declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
declare function buildNuxt(nuxt: Nuxt): Promise<any>;
interface LayerDirectories {
/** Nuxt rootDir (`/` by default) */
readonly root: string;
/** Nitro source directory (`/server` by default) */
readonly server: string;
/** Local modules directory (`/modules` by default) */
readonly modules: string;
/** Shared directory (`/shared` by default) */
readonly shared: string;
/** Public directory (`/public` by default) */
readonly public: string;
/** Nuxt srcDir (`/app/` by default) */
readonly app: string;
/** Layouts directory (`/app/layouts` by default) */
readonly appLayouts: string;
/** Middleware directory (`/app/middleware` by default) */
readonly appMiddleware: string;
/** Pages directory (`/app/pages` by default) */
readonly appPages: string;
/** Plugins directory (`/app/plugins` by default) */
readonly appPlugins: string;
}
/**
* Get the resolved directory paths for all layers in a Nuxt application.
*
* Returns an array of LayerDirectories objects, ordered by layer priority:
* - The first layer is the user/project layer (highest priority)
* - Earlier layers override later layers in the array
* - Base layers appear last in the array (lowest priority)
*
* @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
* @returns Array of LayerDirectories objects, ordered by priority (user layer first)
*/
declare function getLayerDirectories(nuxt?: _nuxt_schema.Nuxt): LayerDirectories[];
declare function setGlobalHead(head: NuxtAppConfig['head']): void;
declare function addImports(imports: Import | Import[]): void;
declare function addImportsDir(dirs: string | string[], opts?: {
prepend?: boolean;
}): void;
declare function addImportsSources(presets: InlinePreset | InlinePreset[]): void;
/**
* Access 'resolved' Nuxt runtime configuration, with values updated from environment.
*
* This mirrors the runtime behavior of Nitro.
*/
declare function useRuntimeConfig(): Record<string, any>;
/**
* Update Nuxt runtime configuration.
*/
declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
interface ExtendConfigOptions {
/**
* Install plugin on dev
* @default true
*/
dev?: boolean;
/**
* Install plugin on build
* @default true
*/
build?: boolean;
/**
* Install plugin on server side
* @default true
*/
server?: boolean;
/**
* Install plugin on client side
* @default true
*/
client?: boolean;
/**
* Prepends the plugin to the array with `unshift()` instead of `push()`.
*/
prepend?: boolean;
}
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
}
interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, 'server' | 'client'> {
/**
* Extend server Vite configuration
* @default true
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
* You can likely use a Vite plugin to achieve the same result.
*/
server?: boolean;
/**
* Extend client Vite configuration
* @default true
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
* You can likely use a Vite plugin to achieve the same result.
*/
client?: boolean;
}
/**
* Extend webpack config
*
* The fallback function might be called multiple times
* when applying to both client and server builds.
*/
declare const extendWebpackConfig: (fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions) => void;
/**
* Extend rspack config
*
* The fallback function might be called multiple times
* when applying to both client and server builds.
*/
declare const extendRspackConfig: (fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions) => void;
/**
* Extend Vite config
*/
declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): (() => void) | undefined;
/**
* Append webpack plugin to the config.
*/
declare function addWebpackPlugin(pluginOrGetter: WebpackPluginInstance | WebpackPluginInstance[] | (() => WebpackPluginInstance | WebpackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
/**
* Append rspack plugin to the config.
*/
declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance | RspackPluginInstance[] | (() => RspackPluginInstance | RspackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
/**
* Append Vite plugin to the config.
*/
declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?: ExtendConfigOptions): void;
interface AddBuildPluginFactory {
vite?: () => Plugin | Plugin[];
webpack?: () => WebpackPluginInstance | WebpackPluginInstance[];
rspack?: () => RspackPluginInstance | RspackPluginInstance[];
}
declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
declare function normalizeSemanticVersion(version: string): string;
/**
* Check version constraints and return incompatibility issues as an array
*/
declare function checkNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<NuxtCompatibilityIssues>;
/**
* Check version constraints and throw a detailed error if has any, otherwise returns true
*/
declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<true>;
/**
* Check version constraints and return true if passed, otherwise returns false
*/
declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
/**
* Check if current Nuxt instance is of specified major version
*/
declare function isNuxtMajorVersion(majorVersion: 2 | 3 | 4, nuxt?: Nuxt): boolean;
/**
* @deprecated Use `isNuxtMajorVersion(2, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
*/
declare function isNuxt2(nuxt?: Nuxt): boolean;
/**
* @deprecated Use `isNuxtMajorVersion(3, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
*/
declare function isNuxt3(nuxt?: Nuxt): boolean;
/**
* Get nuxt version
*/
declare function getNuxtVersion(nuxt?: Nuxt | any): string;
/**
* Register a directory to be scanned for components and imported only when used.
*/
declare function addComponentsDir(dir: ComponentsDir, opts?: {
prepend?: boolean;
}): void;
type AddComponentOptions = {
name: string;
filePath: string;
} & Partial<Exclude<Component, 'shortPath' | 'async' | 'level' | 'import' | 'asyncImport'>>;
/**
* This utility takes a file path or npm package that is scanned for named exports, which are get added automatically
*/
declare function addComponentExports(opts: Omit<AddComponentOptions, 'name'> & {
prefix?: string;
}): void;
/**
* Register a component by its name and filePath.
*/
declare function addComponent(opts: AddComponentOptions): void;
/**
* Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
* @deprecated Use `getNuxtCtx` instead
*/
declare const nuxtCtx: unctx.UseContext<Nuxt>;
/** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
declare const getNuxtCtx: () => Nuxt | null;
/**
* Get access to Nuxt instance.
*
* Throws an error if Nuxt instance is unavailable.
* @example
* ```js
* const nuxt = useNuxt()
* ```
*/
declare function useNuxt(): Nuxt;
/**
* Get access to Nuxt instance.
*
* Returns null if Nuxt instance is unavailable.
* @example
* ```js
* const nuxt = tryUseNuxt()
* if (nuxt) {
* // Do something
* }
* ```
*/
declare function tryUseNuxt(): Nuxt | null;
declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
declare function createIsIgnored(nuxt?: _nuxt_schema.Nuxt | null): (pathname: string, stats?: unknown) => boolean;
/**
* Return a filter function to filter an array of paths
*/
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: _nuxt_schema.Nuxt | null): boolean;
declare function resolveIgnorePatterns(relativePath?: string): string[];
declare function addLayout(template: NuxtTemplate | string, name?: string): void;
declare function extendPages(cb: NuxtHooks['pages:extend']): void;
interface ExtendRouteRulesOptions {
/**
* Override route rule config
* @default false
*/
override?: boolean;
}
declare function extendRouteRules(route: string, rule: NitroRouteConfig, options?: ExtendRouteRulesOptions): void;
interface AddRouteMiddlewareOptions {
/**
* Override existing middleware with the same name, if it exists
* @default false
*/
override?: boolean;
/**
* Prepend middleware to the list
* @default false
*/
prepend?: boolean;
}
declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], options?: AddRouteMiddlewareOptions): void;
declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
/**
* Registers a nuxt plugin and to the plugins array.
*
* Note: You can use mode or .client and .server modifiers with fileName option
* to use plugin only in client or server side.
*
* Note: By default plugin is prepended to the plugins array. You can use second argument to append (push) instead.
* @example
* ```js
* import { createResolver } from '@nuxt/kit'
* const resolver = createResolver(import.meta.url)
*
* addPlugin({
* src: resolver.resolve('templates/foo.js'),
* filename: 'foo.server.js' // [optional] only include in server bundle
* })
* ```
*/
interface AddPluginOptions {
append?: boolean;
}
declare function addPlugin(_plugin: NuxtPlugin | string, opts?: AddPluginOptions): NuxtPlugin;
/**
* Adds a template and registers as a nuxt plugin.
*/
declare function addPluginTemplate(plugin: NuxtPluginTemplate | string, opts?: AddPluginOptions): NuxtPlugin;
interface ResolvePathOptions {
/** Base for resolving paths from. Default is Nuxt rootDir. */
cwd?: string;
/** An object of aliases. Default is Nuxt configured aliases. */
alias?: Record<string, string>;
/**
* The file extensions to try.
* Default is Nuxt configured extensions.
*
* Isn't considered when `type` is set to `'dir'`.
*/
extensions?: string[];
/**
* Whether to resolve files that exist in the Nuxt VFS (for example, as a Nuxt template).
* @default false
*/
virtual?: boolean;
/**
* Whether to fallback to the original path if the resolved path does not exist instead of returning the normalized input path.
* @default false
*/
fallbackToOriginal?: boolean;
/**
* The type of the path to be resolved.
* @default 'file'
*/
type?: PathType;
}
/**
* Resolve the full path to a file or a directory (based on the provided type), respecting Nuxt alias and extensions options.
*
* If a path cannot be resolved, normalized input will be returned unless the `fallbackToOriginal` option is set to `true`,
* in which case the original input path will be returned.
*/
declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
/**
* Try to resolve first existing file in paths
*/
declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: PathType): Promise<string | null>;
/**
* Resolve path aliases respecting Nuxt alias options
*/
declare function resolveAlias(path: string, alias?: Record<string, string>): string;
interface Resolver {
resolve(...path: string[]): string;
resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
}
/**
* Create a relative resolver
*/
declare function createResolver(base: string | URL): Resolver;
declare function resolveNuxtModule(base: string, paths: string[]): Promise<string[]>;
type PathType = 'file' | 'dir';
/**
* Resolve absolute file paths in the provided directory with respect to `.nuxtignore` and return them sorted.
* @param path path to the directory to resolve files in
* @param pattern glob pattern or an array of glob patterns to match files
* @param opts options for globbing
* @param opts.followSymbolicLinks whether to follow symbolic links, default is `true`
* @param opts.ignore additional glob patterns to ignore
* @returns sorted array of absolute file paths
*/
declare function resolveFiles(path: string, pattern: string | string[], opts?: {
followSymbolicLinks?: boolean;
ignore?: GlobOptions['ignore'];
}): Promise<string[]>;
/**
* Adds a nitro server handler
*
*/
declare function addServerHandler(handler: NitroEventHandler): void;
/**
* Adds a nitro server handler for development-only
*
*/
declare function addDevServerHandler(handler: NitroDevEventHandler): void;
/**
* Adds a Nitro plugin
*/
declare function addServerPlugin(plugin: string): void;
/**
* Adds routes to be prerendered
*/
declare function addPrerenderRoutes(routes: string | string[]): void;
/**
* Access to the Nitro instance
*
* **Note:** You can call `useNitro()` only after `ready` hook.
*
* **Note:** Changes to the Nitro instance configuration are not applied.
* @example
*
* ```ts
* nuxt.hook('ready', () => {
* console.log(useNitro())
* })
* ```
*/
declare function useNitro(): Nitro;
/**
* Add server imports to be auto-imported by Nitro
*/
declare function addServerImports(imports: Import | Import[]): void;
/**
* Add directories to be scanned for auto-imports by Nitro
*/
declare function addServerImportsDir(dirs: string | string[], opts?: {
prepend?: boolean;
}): void;
/**
* Add directories to be scanned by Nitro. It will check for subdirectories,
* which will be registered just like the `~/server` folder is.
*/
declare function addServerScanDir(dirs: string | string[], opts?: {
prepend?: boolean;
}): void;
/**
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
*/
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
/**
* Adds a virtual file that can be used within the Nuxt Nitro server build.
*/
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
/**
* Renders given types during build to disk in the project `buildDir`
* and register them as types.
*
* You can pass a second context object to specify in which context the type should be added.
*
* If no context object is passed, then it will only be added to the nuxt context.
*/
declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>, context?: {
nitro?: boolean;
nuxt?: boolean;
node?: boolean;
shared?: boolean;
}): ResolvedNuxtTemplate<T>;
/**
* Normalize a nuxt template object
*/
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildDir?: string): ResolvedNuxtTemplate<T>;
/**
* Trigger rebuilding Nuxt templates
*
* You can pass a filter within the options to selectively regenerate a subset of templates.
*/
declare function updateTemplates(options?: {
filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
}): Promise<any>;
declare function writeTypes(nuxt: Nuxt): Promise<void>;
declare const logger: consola.ConsolaInstance;
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola.ConsolaInstance;
interface ResolveModuleOptions {
/** @deprecated use `url` with URLs pointing at a file - never a directory */
paths?: string | string[];
url?: URL | URL[];
/** @default ['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts'] */
extensions?: string[];
}
declare function directoryToURL(dir: string): URL;
/**
* Resolve a module from a given root path using an algorithm patterned on
* the upcoming `import.meta.resolve`. It returns a file URL
*
* @internal
*/
declare function tryResolveModule(id: string, url: URL | URL[]): Promise<string | undefined>;
/** @deprecated pass URLs pointing at files */
declare function tryResolveModule(id: string, url: string | string[]): Promise<string | undefined>;
declare function resolveModule(id: string, options?: ResolveModuleOptions): string;
interface ImportModuleOptions extends ResolveModuleOptions {
/** Automatically de-default the result of requiring the module. */
interopDefault?: boolean;
}
declare function importModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T>;
declare function tryImportModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T | undefined> | undefined;
/**
* @deprecated Please use `importModule` instead.
*/
declare function requireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T;
/**
* @deprecated Please use `tryImportModule` instead.
*/
declare function tryRequireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T | undefined;
export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, runWithNuxtContext, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LayerDirectories, LoadNuxtConfigOptions, LoadNuxtOptions, ResolveModuleOptions, ResolvePathOptions, Resolver };

View file

@ -0,0 +1,552 @@
import * as _nuxt_schema from '@nuxt/schema';
import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, NuxtAppConfig, NuxtCompatibility, NuxtCompatibilityIssues, Component, ComponentsDir, NuxtTemplate, NuxtMiddleware, NuxtHooks, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
import { LoadConfigOptions } from 'c12';
import { Import, InlinePreset } from 'unimport';
import { WebpackPluginInstance, Configuration } from 'webpack';
import { RspackPluginInstance } from '@rspack/core';
import { Plugin, UserConfig } from 'vite';
import * as unctx from 'unctx';
import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types';
import { GlobOptions } from 'tinyglobby';
import * as consola from 'consola';
import { ConsolaOptions } from 'consola';
/**
* Define a Nuxt module, automatically merging defaults with user provided options, installing
* any hooks that are provided, and calling an optional setup function for full control.
*/
declare function defineNuxtModule<TOptions extends ModuleOptions>(definition: ModuleDefinition<TOptions, Partial<TOptions>, false> | NuxtModule<TOptions, Partial<TOptions>, false>): NuxtModule<TOptions, TOptions, false>;
declare function defineNuxtModule<TOptions extends ModuleOptions>(): {
with: <TOptionsDefaults extends Partial<TOptions>>(definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | NuxtModule<TOptions, TOptionsDefaults, true>) => NuxtModule<TOptions, TOptionsDefaults, true>;
};
type ModuleToInstall = string | NuxtModule<ModuleOptions, Partial<ModuleOptions>, false>;
/**
* Installs a set of modules on a Nuxt instance.
* @internal
*/
declare function installModules(modulesToInstall: Map<ModuleToInstall, Record<string, any>>, resolvedModulePaths: Set<string>, nuxt?: Nuxt): Promise<void>;
/**
* Installs a module on a Nuxt instance.
* @deprecated Use module dependencies.
*/
declare function installModule<T extends string | NuxtModule, Config extends Extract<NonNullable<NuxtConfig['modules']>[number], [T, any]>>(moduleToInstall: T, inlineOptions?: [Config] extends [never] ? any : Config[1], nuxt?: Nuxt): Promise<void>;
declare function resolveModuleWithOptions(definition: NuxtModule<any> | string | false | undefined | null | [(NuxtModule | string)?, Record<string, any>?], nuxt: Nuxt): {
resolvedPath?: string;
module: string | NuxtModule<any>;
options: Record<string, any>;
} | undefined;
declare function loadNuxtModuleInstance(nuxtModule: string | NuxtModule, nuxt?: Nuxt): Promise<{
nuxtModule: NuxtModule<any>;
buildTimeModuleMeta: ModuleMeta;
resolvedModulePath?: string;
}>;
declare function getDirectory(p: string): string;
declare const normalizeModuleTranspilePath: (p: string) => string;
/**
* Check if a Nuxt module is installed by name.
*
* This will check both the installed modules and the modules to be installed. Note
* that it cannot detect if a module is _going to be_ installed programmatically by another module.
*/
declare function hasNuxtModule(moduleName: string, nuxt?: Nuxt): boolean;
/**
* Checks if a Nuxt Module is compatible with a given semver version.
*/
declare function hasNuxtModuleCompatibility(module: string | NuxtModule, semverVersion: string, nuxt?: Nuxt): Promise<boolean>;
/**
* Get the version of a Nuxt module.
*
* Scans installed modules for the version, if it's not found it will attempt to load the module instance and get the version from there.
*/
declare function getNuxtModuleVersion(module: string | NuxtModule, nuxt?: Nuxt | any): Promise<string | false>;
interface LoadNuxtConfigOptions extends Omit<LoadConfigOptions<NuxtConfig>, 'overrides'> {
overrides?: Exclude<LoadConfigOptions<NuxtConfig>['overrides'], Promise<any> | Function>;
}
declare function loadNuxtConfig(opts: LoadNuxtConfigOptions): Promise<NuxtOptions>;
declare function extendNuxtSchema(def: SchemaDefinition | (() => SchemaDefinition)): void;
interface LoadNuxtOptions extends LoadNuxtConfigOptions {
/** Load nuxt with development mode */
dev?: boolean;
/** Use lazy initialization of nuxt if set to false */
ready?: boolean;
}
declare function loadNuxt(opts: LoadNuxtOptions): Promise<Nuxt>;
declare function buildNuxt(nuxt: Nuxt): Promise<any>;
interface LayerDirectories {
/** Nuxt rootDir (`/` by default) */
readonly root: string;
/** Nitro source directory (`/server` by default) */
readonly server: string;
/** Local modules directory (`/modules` by default) */
readonly modules: string;
/** Shared directory (`/shared` by default) */
readonly shared: string;
/** Public directory (`/public` by default) */
readonly public: string;
/** Nuxt srcDir (`/app/` by default) */
readonly app: string;
/** Layouts directory (`/app/layouts` by default) */
readonly appLayouts: string;
/** Middleware directory (`/app/middleware` by default) */
readonly appMiddleware: string;
/** Pages directory (`/app/pages` by default) */
readonly appPages: string;
/** Plugins directory (`/app/plugins` by default) */
readonly appPlugins: string;
}
/**
* Get the resolved directory paths for all layers in a Nuxt application.
*
* Returns an array of LayerDirectories objects, ordered by layer priority:
* - The first layer is the user/project layer (highest priority)
* - Earlier layers override later layers in the array
* - Base layers appear last in the array (lowest priority)
*
* @param nuxt - The Nuxt instance to get layers from. Defaults to the current Nuxt context.
* @returns Array of LayerDirectories objects, ordered by priority (user layer first)
*/
declare function getLayerDirectories(nuxt?: _nuxt_schema.Nuxt): LayerDirectories[];
declare function setGlobalHead(head: NuxtAppConfig['head']): void;
declare function addImports(imports: Import | Import[]): void;
declare function addImportsDir(dirs: string | string[], opts?: {
prepend?: boolean;
}): void;
declare function addImportsSources(presets: InlinePreset | InlinePreset[]): void;
/**
* Access 'resolved' Nuxt runtime configuration, with values updated from environment.
*
* This mirrors the runtime behavior of Nitro.
*/
declare function useRuntimeConfig(): Record<string, any>;
/**
* Update Nuxt runtime configuration.
*/
declare function updateRuntimeConfig(runtimeConfig: Record<string, unknown>): void | Promise<void>;
interface ExtendConfigOptions {
/**
* Install plugin on dev
* @default true
*/
dev?: boolean;
/**
* Install plugin on build
* @default true
*/
build?: boolean;
/**
* Install plugin on server side
* @default true
*/
server?: boolean;
/**
* Install plugin on client side
* @default true
*/
client?: boolean;
/**
* Prepends the plugin to the array with `unshift()` instead of `push()`.
*/
prepend?: boolean;
}
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
}
interface ExtendViteConfigOptions extends Omit<ExtendConfigOptions, 'server' | 'client'> {
/**
* Extend server Vite configuration
* @default true
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
* You can likely use a Vite plugin to achieve the same result.
*/
server?: boolean;
/**
* Extend client Vite configuration
* @default true
* @deprecated calling \`extendViteConfig\` with only server/client environment is deprecated.
* Nuxt 5+ uses the Vite Environment API which shares a configuration between environments.
* You can likely use a Vite plugin to achieve the same result.
*/
client?: boolean;
}
/**
* Extend webpack config
*
* The fallback function might be called multiple times
* when applying to both client and server builds.
*/
declare const extendWebpackConfig: (fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions) => void;
/**
* Extend rspack config
*
* The fallback function might be called multiple times
* when applying to both client and server builds.
*/
declare const extendRspackConfig: (fn: ((config: Configuration) => void), options?: ExtendWebpackConfigOptions) => void;
/**
* Extend Vite config
*/
declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): (() => void) | undefined;
/**
* Append webpack plugin to the config.
*/
declare function addWebpackPlugin(pluginOrGetter: WebpackPluginInstance | WebpackPluginInstance[] | (() => WebpackPluginInstance | WebpackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
/**
* Append rspack plugin to the config.
*/
declare function addRspackPlugin(pluginOrGetter: RspackPluginInstance | RspackPluginInstance[] | (() => RspackPluginInstance | RspackPluginInstance[]), options?: ExtendWebpackConfigOptions): void;
/**
* Append Vite plugin to the config.
*/
declare function addVitePlugin(pluginOrGetter: Plugin | Plugin[] | (() => Plugin | Plugin[]), options?: ExtendConfigOptions): void;
interface AddBuildPluginFactory {
vite?: () => Plugin | Plugin[];
webpack?: () => WebpackPluginInstance | WebpackPluginInstance[];
rspack?: () => RspackPluginInstance | RspackPluginInstance[];
}
declare function addBuildPlugin(pluginFactory: AddBuildPluginFactory, options?: ExtendConfigOptions): void;
declare function normalizeSemanticVersion(version: string): string;
/**
* Check version constraints and return incompatibility issues as an array
*/
declare function checkNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<NuxtCompatibilityIssues>;
/**
* Check version constraints and throw a detailed error if has any, otherwise returns true
*/
declare function assertNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<true>;
/**
* Check version constraints and return true if passed, otherwise returns false
*/
declare function hasNuxtCompatibility(constraints: NuxtCompatibility, nuxt?: Nuxt): Promise<boolean>;
/**
* Check if current Nuxt instance is of specified major version
*/
declare function isNuxtMajorVersion(majorVersion: 2 | 3 | 4, nuxt?: Nuxt): boolean;
/**
* @deprecated Use `isNuxtMajorVersion(2, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
*/
declare function isNuxt2(nuxt?: Nuxt): boolean;
/**
* @deprecated Use `isNuxtMajorVersion(3, nuxt)` instead. This may be removed in \@nuxt/kit v5 or a future major version.
*/
declare function isNuxt3(nuxt?: Nuxt): boolean;
/**
* Get nuxt version
*/
declare function getNuxtVersion(nuxt?: Nuxt | any): string;
/**
* Register a directory to be scanned for components and imported only when used.
*/
declare function addComponentsDir(dir: ComponentsDir, opts?: {
prepend?: boolean;
}): void;
type AddComponentOptions = {
name: string;
filePath: string;
} & Partial<Exclude<Component, 'shortPath' | 'async' | 'level' | 'import' | 'asyncImport'>>;
/**
* This utility takes a file path or npm package that is scanned for named exports, which are get added automatically
*/
declare function addComponentExports(opts: Omit<AddComponentOptions, 'name'> & {
prefix?: string;
}): void;
/**
* Register a component by its name and filePath.
*/
declare function addComponent(opts: AddComponentOptions): void;
/**
* Direct access to the Nuxt global context - see https://github.com/unjs/unctx.
* @deprecated Use `getNuxtCtx` instead
*/
declare const nuxtCtx: unctx.UseContext<Nuxt>;
/** Direct access to the Nuxt context with asyncLocalStorage - see https://github.com/unjs/unctx. */
declare const getNuxtCtx: () => Nuxt | null;
/**
* Get access to Nuxt instance.
*
* Throws an error if Nuxt instance is unavailable.
* @example
* ```js
* const nuxt = useNuxt()
* ```
*/
declare function useNuxt(): Nuxt;
/**
* Get access to Nuxt instance.
*
* Returns null if Nuxt instance is unavailable.
* @example
* ```js
* const nuxt = tryUseNuxt()
* if (nuxt) {
* // Do something
* }
* ```
*/
declare function tryUseNuxt(): Nuxt | null;
declare function runWithNuxtContext<T extends (...args: any[]) => any>(nuxt: Nuxt, fn: T): ReturnType<T>;
declare function createIsIgnored(nuxt?: _nuxt_schema.Nuxt | null): (pathname: string, stats?: unknown) => boolean;
/**
* Return a filter function to filter an array of paths
*/
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: _nuxt_schema.Nuxt | null): boolean;
declare function resolveIgnorePatterns(relativePath?: string): string[];
declare function addLayout(template: NuxtTemplate | string, name?: string): void;
declare function extendPages(cb: NuxtHooks['pages:extend']): void;
interface ExtendRouteRulesOptions {
/**
* Override route rule config
* @default false
*/
override?: boolean;
}
declare function extendRouteRules(route: string, rule: NitroRouteConfig, options?: ExtendRouteRulesOptions): void;
interface AddRouteMiddlewareOptions {
/**
* Override existing middleware with the same name, if it exists
* @default false
*/
override?: boolean;
/**
* Prepend middleware to the list
* @default false
*/
prepend?: boolean;
}
declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], options?: AddRouteMiddlewareOptions): void;
declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
/**
* Registers a nuxt plugin and to the plugins array.
*
* Note: You can use mode or .client and .server modifiers with fileName option
* to use plugin only in client or server side.
*
* Note: By default plugin is prepended to the plugins array. You can use second argument to append (push) instead.
* @example
* ```js
* import { createResolver } from '@nuxt/kit'
* const resolver = createResolver(import.meta.url)
*
* addPlugin({
* src: resolver.resolve('templates/foo.js'),
* filename: 'foo.server.js' // [optional] only include in server bundle
* })
* ```
*/
interface AddPluginOptions {
append?: boolean;
}
declare function addPlugin(_plugin: NuxtPlugin | string, opts?: AddPluginOptions): NuxtPlugin;
/**
* Adds a template and registers as a nuxt plugin.
*/
declare function addPluginTemplate(plugin: NuxtPluginTemplate | string, opts?: AddPluginOptions): NuxtPlugin;
interface ResolvePathOptions {
/** Base for resolving paths from. Default is Nuxt rootDir. */
cwd?: string;
/** An object of aliases. Default is Nuxt configured aliases. */
alias?: Record<string, string>;
/**
* The file extensions to try.
* Default is Nuxt configured extensions.
*
* Isn't considered when `type` is set to `'dir'`.
*/
extensions?: string[];
/**
* Whether to resolve files that exist in the Nuxt VFS (for example, as a Nuxt template).
* @default false
*/
virtual?: boolean;
/**
* Whether to fallback to the original path if the resolved path does not exist instead of returning the normalized input path.
* @default false
*/
fallbackToOriginal?: boolean;
/**
* The type of the path to be resolved.
* @default 'file'
*/
type?: PathType;
}
/**
* Resolve the full path to a file or a directory (based on the provided type), respecting Nuxt alias and extensions options.
*
* If a path cannot be resolved, normalized input will be returned unless the `fallbackToOriginal` option is set to `true`,
* in which case the original input path will be returned.
*/
declare function resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
/**
* Try to resolve first existing file in paths
*/
declare function findPath(paths: string | string[], opts?: ResolvePathOptions, pathType?: PathType): Promise<string | null>;
/**
* Resolve path aliases respecting Nuxt alias options
*/
declare function resolveAlias(path: string, alias?: Record<string, string>): string;
interface Resolver {
resolve(...path: string[]): string;
resolvePath(path: string, opts?: ResolvePathOptions): Promise<string>;
}
/**
* Create a relative resolver
*/
declare function createResolver(base: string | URL): Resolver;
declare function resolveNuxtModule(base: string, paths: string[]): Promise<string[]>;
type PathType = 'file' | 'dir';
/**
* Resolve absolute file paths in the provided directory with respect to `.nuxtignore` and return them sorted.
* @param path path to the directory to resolve files in
* @param pattern glob pattern or an array of glob patterns to match files
* @param opts options for globbing
* @param opts.followSymbolicLinks whether to follow symbolic links, default is `true`
* @param opts.ignore additional glob patterns to ignore
* @returns sorted array of absolute file paths
*/
declare function resolveFiles(path: string, pattern: string | string[], opts?: {
followSymbolicLinks?: boolean;
ignore?: GlobOptions['ignore'];
}): Promise<string[]>;
/**
* Adds a nitro server handler
*
*/
declare function addServerHandler(handler: NitroEventHandler): void;
/**
* Adds a nitro server handler for development-only
*
*/
declare function addDevServerHandler(handler: NitroDevEventHandler): void;
/**
* Adds a Nitro plugin
*/
declare function addServerPlugin(plugin: string): void;
/**
* Adds routes to be prerendered
*/
declare function addPrerenderRoutes(routes: string | string[]): void;
/**
* Access to the Nitro instance
*
* **Note:** You can call `useNitro()` only after `ready` hook.
*
* **Note:** Changes to the Nitro instance configuration are not applied.
* @example
*
* ```ts
* nuxt.hook('ready', () => {
* console.log(useNitro())
* })
* ```
*/
declare function useNitro(): Nitro;
/**
* Add server imports to be auto-imported by Nitro
*/
declare function addServerImports(imports: Import | Import[]): void;
/**
* Add directories to be scanned for auto-imports by Nitro
*/
declare function addServerImportsDir(dirs: string | string[], opts?: {
prepend?: boolean;
}): void;
/**
* Add directories to be scanned by Nitro. It will check for subdirectories,
* which will be registered just like the `~/server` folder is.
*/
declare function addServerScanDir(dirs: string | string[], opts?: {
prepend?: boolean;
}): void;
/**
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
*/
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
/**
* Adds a virtual file that can be used within the Nuxt Nitro server build.
*/
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
/**
* Renders given types during build to disk in the project `buildDir`
* and register them as types.
*
* You can pass a second context object to specify in which context the type should be added.
*
* If no context object is passed, then it will only be added to the nuxt context.
*/
declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>, context?: {
nitro?: boolean;
nuxt?: boolean;
node?: boolean;
shared?: boolean;
}): ResolvedNuxtTemplate<T>;
/**
* Normalize a nuxt template object
*/
declare function normalizeTemplate<T>(template: NuxtTemplate<T> | string, buildDir?: string): ResolvedNuxtTemplate<T>;
/**
* Trigger rebuilding Nuxt templates
*
* You can pass a filter within the options to selectively regenerate a subset of templates.
*/
declare function updateTemplates(options?: {
filter?: (template: ResolvedNuxtTemplate<any>) => boolean;
}): Promise<any>;
declare function writeTypes(nuxt: Nuxt): Promise<void>;
declare const logger: consola.ConsolaInstance;
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): consola.ConsolaInstance;
interface ResolveModuleOptions {
/** @deprecated use `url` with URLs pointing at a file - never a directory */
paths?: string | string[];
url?: URL | URL[];
/** @default ['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts'] */
extensions?: string[];
}
declare function directoryToURL(dir: string): URL;
/**
* Resolve a module from a given root path using an algorithm patterned on
* the upcoming `import.meta.resolve`. It returns a file URL
*
* @internal
*/
declare function tryResolveModule(id: string, url: URL | URL[]): Promise<string | undefined>;
/** @deprecated pass URLs pointing at files */
declare function tryResolveModule(id: string, url: string | string[]): Promise<string | undefined>;
declare function resolveModule(id: string, options?: ResolveModuleOptions): string;
interface ImportModuleOptions extends ResolveModuleOptions {
/** Automatically de-default the result of requiring the module. */
interopDefault?: boolean;
}
declare function importModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T>;
declare function tryImportModule<T = unknown>(id: string, opts?: ImportModuleOptions): Promise<T | undefined> | undefined;
/**
* @deprecated Please use `importModule` instead.
*/
declare function requireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T;
/**
* @deprecated Please use `tryImportModule` instead.
*/
declare function tryRequireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T | undefined;
export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, runWithNuxtContext, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
export type { AddComponentOptions, AddPluginOptions, AddRouteMiddlewareOptions, ExtendConfigOptions, ExtendRouteRulesOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, ImportModuleOptions, LayerDirectories, LoadNuxtConfigOptions, LoadNuxtOptions, ResolveModuleOptions, ResolvePathOptions, Resolver };

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,65 @@
{
"name": "@nuxt/kit",
"version": "4.2.2",
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt/nuxt.git",
"directory": "packages/kit"
},
"homepage": "https://nuxt.com/docs/4.x/api/kit",
"description": "Toolkit for authoring modules and interacting with Nuxt",
"license": "MIT",
"type": "module",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.mjs"
},
"./package.json": "./package.json"
},
"files": [
"dist"
],
"dependencies": {
"c12": "^3.3.2",
"consola": "^3.4.2",
"defu": "^6.1.4",
"destr": "^2.0.5",
"errx": "^0.1.0",
"exsolve": "^1.0.8",
"ignore": "^7.0.5",
"jiti": "^2.6.1",
"klona": "^2.0.6",
"mlly": "^1.8.0",
"ohash": "^2.0.11",
"pathe": "^2.0.3",
"pkg-types": "^2.3.0",
"rc9": "^2.1.2",
"scule": "^1.3.0",
"semver": "^7.7.3",
"tinyglobby": "^0.2.15",
"ufo": "^1.6.1",
"unctx": "^2.4.1",
"untyped": "^2.0.0"
},
"devDependencies": {
"@rspack/core": "1.6.7",
"@types/semver": "7.7.1",
"hookable": "5.5.3",
"nitropack": "2.12.9",
"unbuild": "3.6.1",
"unimport": "5.5.0",
"vite": "7.2.7",
"vitest": "3.2.4",
"webpack": "5.103.0",
"@nuxt/schema": "4.2.2"
},
"engines": {
"node": ">=18.12.0"
},
"scripts": {
"test:attw": "attw --pack"
}
}

View file

@ -0,0 +1,67 @@
{
"name": "nuxt-quasar-ui",
"type": "module",
"version": "3.0.0",
"description": "Quasar Module for Nuxt (Unofficial)",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Maiquu/nuxt-quasar"
},
"exports": {
".": {
"types": "./dist/types.d.mts",
"import": "./dist/module.mjs"
}
},
"main": "./dist/module.mjs",
"files": [
"dist"
],
"peerDependencies": {
"@quasar/extras": "^1",
"quasar": "^2.8.0"
},
"dependencies": {
"@nuxt/kit": "^4.2.1",
"defu": "^6.1.4",
"magic-string": "^0.30.21",
"mlly": "^1.8.0",
"p-memoize": "^8.0.0",
"semver": "^7.7.3"
},
"devDependencies": {
"@nuxt/devtools": "^3.1.1",
"@nuxt/eslint-config": "^1.11.0",
"@nuxt/module-builder": "^1.0.2",
"@nuxt/schema": "^4.2.1",
"@nuxt/test-utils": "^3.20.1",
"@quasar/extras": "^1.17.0",
"@types/jsdom": "^27.0.0",
"@types/semver": "^7.7.1",
"changelogen": "^0.6.2",
"eslint": "^9.39.1",
"jsdom": "^27.2.0",
"nuxt": "^4.2.1",
"quasar": "^2.18.6",
"sass": "^1.94.2",
"typescript": "^5.9.3",
"vite": "^7.2.4",
"vitest": "^3.2.4",
"vue": "^3.5.25",
"vue-tsc": "^3.1.5"
},
"scripts": {
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:analyze": "nuxi analyze playground",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
"dev:preview": "nuxi preview playground",
"bump": "./scripts/bump.sh",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest run",
"test:watch": "vitest watch",
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
}
}