@nuxt/types
Advanced tools
@@ -32,2 +32,3 @@ import { IncomingMessage, ServerResponse } from 'http' | ||
route: Route | ||
from: Route | ||
store: Store<any> | ||
@@ -104,1 +105,8 @@ env: Record<string, any> | ||
} | ||
// window.$nuxt | ||
declare global { | ||
interface Window { | ||
$nuxt: NuxtApp | ||
} | ||
} |
@@ -6,2 +6,22 @@ # Change Log | ||
# [0.4.0](https://github.com/nuxt/typescript/compare/@nuxt/types@0.3.4...@nuxt/types@0.4.0) (2019-11-30) | ||
### Bug Fixes | ||
* **types:** add `from` property in context interface ([#209](https://github.com/nuxt/typescript/issues/209)) ([cb98916](https://github.com/nuxt/typescript/commit/cb989165a9e98a231d92095af4fdd0f5015614d0)) | ||
* **types:** add babel preset types for function argument ([#192](https://github.com/nuxt/typescript/issues/192)) ([fff6f92](https://github.com/nuxt/typescript/commit/fff6f92b60b1ee7f9665e16972810c3f03029267)), closes [#6691](https://github.com/nuxt/typescript/issues/6691) | ||
* **types:** fix build.hotMiddleware.client ([7f5d9f8](https://github.com/nuxt/typescript/commit/7f5d9f8b9be802d53286603120145428a9643f57)), closes [#187](https://github.com/nuxt/typescript/issues/187) | ||
### Features | ||
* **types:** add types for NuxtConfigurationLoaders ([#202](https://github.com/nuxt/typescript/issues/202)) ([df586d0](https://github.com/nuxt/typescript/commit/df586d0a17cb843a907da89e2ee715257e13e4ce)) | ||
* **types:** add types for NuxtConfigurationRender ([#203](https://github.com/nuxt/typescript/issues/203)) ([bc394de](https://github.com/nuxt/typescript/commit/bc394de9ebac22b7911a15203d247121d85f3aae)) | ||
* **types:** add window.$nuxt type ([63847c7](https://github.com/nuxt/typescript/commit/63847c741103286e61e014e191648346e4b3b275)), closes [#194](https://github.com/nuxt/typescript/issues/194) | ||
## [0.3.4](https://github.com/nuxt/typescript/compare/@nuxt/types@0.3.3...@nuxt/types@0.3.4) (2019-11-05) | ||
@@ -8,0 +28,0 @@ |
@@ -18,6 +18,61 @@ /** | ||
import { TerserPluginOptions } from 'terser-webpack-plugin' | ||
import { Options as FileLoaderOptions } from 'file-loader' | ||
import { Options as PugOptions } from 'pug' | ||
import * as Less from 'less' | ||
import { Options as SassOptions } from 'node-sass' | ||
import { VueLoaderOptions } from 'vue-loader' | ||
type NuxtConfigurationLoaders = any // TBD | ||
interface FileLoaderOptions { | ||
fallback?: string | ||
limit?: number | boolean | string | ||
mimetype?: string | ||
} | ||
type CssLoaderUrlFunction = (url: string, resourcePath: string) => boolean | ||
type CssLoaderImportFunction = (parsedImport: string, resourcePath: string) => boolean | ||
type CssLoaderMode = 'global' | 'local' | ||
interface CssLoaderModulesOptions { | ||
context?: string | ||
getLocalIdent?: (context: string, localIdentName: string, localName: string, options: CssLoaderModulesOptions) => string | ||
hashPrefix?: string | ||
localIdentName?: string | ||
localIdentRegExp?: string | RegExp | ||
mode?: CssLoaderMode | ||
} | ||
interface CssLoaderOptions { | ||
import?: boolean | CssLoaderImportFunction | ||
importLoaders?: number | ||
localsConvention?: 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ||
modules?: boolean | CssLoaderMode | CssLoaderModulesOptions | ||
onlyLocals?: boolean | ||
sourceMap?: boolean | ||
url?: boolean | CssLoaderUrlFunction | ||
} | ||
interface NuxtConfigurationLoaders { | ||
css?: CssLoaderOptions | ||
cssModules?: CssLoaderOptions | ||
file?: FileLoaderOptions | ||
fontUrl?: FileLoaderOptions | ||
imgUrl?: FileLoaderOptions | ||
less?: Less.Options | ||
pugPlain?: PugOptions | ||
sass?: SassOptions | ||
scss?: SassOptions | ||
stylus?: any // TBD | ||
vue?: VueLoaderOptions | ||
vueStyle?: { | ||
manualInject?: boolean | ||
ssrId?: boolean | ||
shadowMode?: boolean | ||
} | ||
} | ||
interface NuxtBabelPresetEnv { | ||
envName: 'client' | 'modern' | 'server' | ||
isClient: boolean | ||
isDev: boolean | ||
isLegacy: boolean | ||
isModern: boolean | ||
isServer: boolean | ||
@@ -61,3 +116,3 @@ } | ||
hardSource?: boolean | ||
hotMiddleware?: WebpackHotMiddlewareOptions | ||
hotMiddleware?: WebpackHotMiddlewareOptions & { client: any /* TBD */ } | ||
html?: { minify: HtmlMinifierOptions } | ||
@@ -64,0 +119,0 @@ indicator?: boolean |
@@ -10,2 +10,3 @@ /** | ||
import { IncomingMessage, ServerResponse } from 'http' | ||
import { CompressionOptions } from 'compression' | ||
@@ -17,10 +18,54 @@ import { Options as EtagOptions } from 'etag' | ||
type NuxtEtagOptions = EtagOptions & { | ||
hash?: (html: string) => string | ||
} | ||
type ServePlaceholderHandler = 'default' | 'css' | 'html' | 'js' | 'json' | 'map' | 'plain' | 'image' | ||
interface ServePlaceholderOptions { | ||
handlers?: Record<string, ServePlaceholderHandler | null | false> | ||
mimes?: Record<ServePlaceholderHandler, string | false | undefined> | ||
noCache?: boolean | ||
placeholders?: Record<ServePlaceholderHandler, string | Buffer | false> | ||
skipUnknown?: boolean | ||
statusCode?: false | number | ||
} | ||
type CspPolicyName = 'child-src' | 'connect-src' | 'default-src' | 'font-src' | 'frame-src' | 'img-src' | 'manifest-src' | 'media-src' | 'object-src' | 'prefetch-src' | 'script-src' | 'script-src-elem' | 'script-src-attr' | 'style-src' | 'style-src-elem' | 'style-src-attr' | 'worker-src' | 'base-uri' | 'plugin-types' | 'sandbox' | 'form-action' | 'frame-ancestors' | 'navigate-to' | 'report-uri' | 'report-to' | 'block-all-mixed-content' | 'referrer' | 'require-sri-for' | 'trusted-types' | 'upgrade-insecure-requests' | ||
interface CspOptions { | ||
addMeta?: boolean | ||
allowedSources?: string[] | ||
hashAlgorithm?: string | ||
policies?: Record<CspPolicyName, string[]> | ||
reportOnly?: boolean | ||
unsafeInlineCompatibility?: boolean | ||
} | ||
interface PreloadFile { | ||
asType: 'script' | 'style' | 'font' | ||
extension: string | ||
file: string | ||
fileWithoutQuery: string | ||
} | ||
export interface NuxtConfigurationRender { | ||
bundleRenderer?: BundleRendererOptions | ||
compressor?: CompressionOptions | NuxtConfigurationServerMiddleware | false | ||
csp?: any // TBD | ||
csp?: boolean | CspOptions | ||
dist?: ServeStaticOptions | ||
etag?: EtagOptions | false | ||
fallback?: any // https://github.com/nuxt/serve-placeholder types TBD | ||
http2?: any // TBD | ||
etag?: NuxtEtagOptions | false | ||
fallback?: { | ||
dist?: ServePlaceholderOptions | ||
static?: ServePlaceholderOptions | ||
} | ||
http2?: { | ||
push?: boolean | ||
shouldPush?: boolean | ||
pushAssets?: ( | ||
req: IncomingMessage, | ||
res: ServerResponse, | ||
publicPath: string, | ||
preloadFiles: PreloadFile[] | ||
) => string[] | ||
} | ||
injectScripts?: boolean | ||
resourceHints?: boolean | ||
@@ -27,0 +72,0 @@ ssr?: boolean |
{ | ||
"name": "@nuxt/types", | ||
"version": "0.3.4", | ||
"version": "0.4.0", | ||
"description": "Nuxt.js types", | ||
@@ -17,8 +17,12 @@ "repository": "nuxt/typescript", | ||
"@types/express": "^4.17.2", | ||
"@types/file-loader": "^4.2.0", | ||
"@types/html-minifier": "^3.5.3", | ||
"@types/node": "^12.12.5", | ||
"@types/less": "^3.0.1", | ||
"@types/node": "^12.12.14", | ||
"@types/node-sass": "^4.11.0", | ||
"@types/optimize-css-assets-webpack-plugin": "^5.0.1", | ||
"@types/pug": "^2.0.4", | ||
"@types/serve-static": "^1.13.3", | ||
"@types/terser-webpack-plugin": "^2.2.0", | ||
"@types/webpack": "^4.39.8", | ||
"@types/webpack": "^4.41.0", | ||
"@types/webpack-bundle-analyzer": "^2.13.3", | ||
@@ -25,0 +29,0 @@ "@types/webpack-dev-middleware": "^2.0.3", |
34449
16.91%652
18.33%18
28.57%