vue3-lazy-hydration
Advanced tools
Comparing version 1.1.3 to 1.2.0
{ | ||
"name": "vue3-lazy-hydration", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Lazy Hydration for Vue 3 SSR", | ||
@@ -25,17 +25,21 @@ "keywords": [ | ||
], | ||
"main": "./dist/vue3LazyHydration.cjs.js", | ||
"module": "./dist/esm/index.js", | ||
"type": "module", | ||
"main": "./dist/vue3-lazy-hydration.cjs", | ||
"module": "./dist/esm/vue3-lazy-hydration.mjs", | ||
"exports": { | ||
".": { | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/vue3LazyHydration.cjs.js" | ||
"types": "./dist/vue3-lazy-hydration.d.ts", | ||
"import": "./dist/esm/vue3-lazy-hydration.mjs", | ||
"require": "./dist/vue3-lazy-hydration.cjs" | ||
} | ||
}, | ||
"types": "./dist/vue3-lazy-hydration.d.ts", | ||
"engines": { | ||
"node": ">=14.6" | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"test:unit": "vitest", | ||
"coverage": "vitest run --coverage", | ||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.cts,.mts --fix --ignore-path .gitignore" | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
@@ -46,22 +50,60 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "3.0.1", | ||
"@vitest/ui": "0.21.1", | ||
"@vue/server-renderer": "3.2.37", | ||
"@commitlint/cli": "17.1.2", | ||
"@commitlint/config-conventional": "17.1.0", | ||
"@microsoft/api-extractor": "7.31.2", | ||
"@rushstack/eslint-patch": "1.2.0", | ||
"@types/node": "18.7.18", | ||
"@vitejs/plugin-vue": "3.1.0", | ||
"@vitest/coverage-c8": "^0.23.4", | ||
"@vitest/ui": "0.23.4", | ||
"@vue/eslint-config-airbnb-with-typescript": "7.0.0", | ||
"@vue/server-renderer": "3.2.39", | ||
"@vue/test-utils": "2.0.2", | ||
"c8": "7.12.0", | ||
"eslint": "8.21.0", | ||
"eslint-config-airbnb-base": "15.0.0", | ||
"@vue/tsconfig": "0.1.3", | ||
"commitizen": "4.2.5", | ||
"cz-conventional-changelog": "3.3.0", | ||
"eslint": "8.23.1", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-config-vitest-globals": "0.0.3", | ||
"eslint-define-config": "1.7.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"eslint-plugin-vue": "9.3.0", | ||
"eslint-plugin-vitest-globals": "1.2.0", | ||
"eslint-plugin-vue": "9.5.1", | ||
"happy-dom": "6.0.4", | ||
"lint-staged": "13.0.3", | ||
"pnpm": "7.12.2", | ||
"prettier": "2.7.1", | ||
"sass": "1.54.3", | ||
"vite": "3.0.5", | ||
"vitest": "0.21.1", | ||
"vue": "3.2.37", | ||
"vue-router": "4.1.3" | ||
"rimraf": "3.0.2", | ||
"sass": "1.55.0", | ||
"simple-git-hooks": "2.8.0", | ||
"typescript": "4.8.3", | ||
"vite": "3.1.3", | ||
"vitest": "0.23.4", | ||
"vue": "3.2.39", | ||
"vue-router": "4.1.5" | ||
}, | ||
"simple-git-hooks": { | ||
"pre-commit": "pnpm lint-staged --concurrent false", | ||
"prepare-commit-msg": "cat $1 | npx commitlint -q || (exec < /dev/tty && node_modules/.bin/cz --hook || true)", | ||
"commit-msg": "npx --no -- commitlint --edit $1" | ||
}, | ||
"lint-staged": { | ||
"*": [ | ||
"prettier --write --cache --ignore-unknown" | ||
], | ||
"src/**/*.ts": [ | ||
"eslint --cache --fix" | ||
] | ||
}, | ||
"packageManager": "pnpm@7.12.2", | ||
"scripts": { | ||
"preinstall": "npx only-allow pnpm", | ||
"postinstall": "simple-git-hooks", | ||
"build": "rimraf dist && vite build && pnpm build-temp-types ", | ||
"build-temp-types": "tsc --emitDeclarationOnly -p ./tsconfig.types.json && api-extractor run && rimraf temp", | ||
"dev": "rimraf dist && vite", | ||
"test:unit": "vitest", | ||
"coverage": "vitest run --coverage", | ||
"format": "prettier --write --cache .", | ||
"lint": "eslint --cache ." | ||
} | ||
} | ||
} |
@@ -9,3 +9,3 @@ # vue3-lazy-hydration | ||
Use the package manager [yarn v1](https://classic.yarnpkg.com/) or [npm](https://github.com/npm/cli) to install vue3-lazy-hydration. | ||
Use [yarn v1](https://classic.yarnpkg.com/), [npm](https://github.com/npm/cli) or [pnpm](https://pnpm.io/) package manager to install vue3-lazy-hydration. | ||
@@ -18,6 +18,13 @@ ```bash | ||
npm install vue3-lazy-hydration | ||
# install with pnpm | ||
pnpm add vue3-lazy-hydration | ||
``` | ||
Optionally make the renderless component [available globally](https://vuejs.org/guide/components/registration.html#global-registration). | ||
### Importing Renderless Component | ||
If you want to use the renderless component you can either import it directly inside your Vue SFCs (see examples below) or make it [available globally](https://vuejs.org/guide/components/registration.html#global-registration). | ||
#### Global import for Vue | ||
```js | ||
@@ -29,9 +36,23 @@ import { createSSRApp } from 'vue'; | ||
app.component( | ||
// custom registered name | ||
'LazyHydrate', | ||
LazyHydrationWrapper | ||
); | ||
app.component('LazyHydrationWrapper', LazyHydrationWrapper); | ||
// or, you can use a custom registered name: | ||
// use <LazyHydrate> instead of <LazyHydrationWrapper> | ||
app.component('LazyHydrate', LazyHydrationWrapper); | ||
``` | ||
#### Global import for Nuxt 3 | ||
Create a [Nuxt 3 plugin](https://v3.nuxtjs.org/guide/directory-structure/plugins/) inside the `plugins` directory. The filename doesn't matter as Nuxt [auto-imports](https://v3.nuxtjs.org/guide/directory-structure/plugins/#which-files-are-registered) all top-level files of this directory. | ||
```js | ||
// plugins/lazy-hydration.ts | ||
import { LazyHydrationWrapper } from 'vue3-lazy-hydration'; | ||
export default defineNuxtPlugin((nuxtApp) => { | ||
// for custom registered name see Vue example above | ||
nuxtApp.vueApp.component('LazyHydrationWrapper', LazyHydrationWrapper); | ||
}); | ||
``` | ||
## Usage | ||
@@ -475,2 +496,4 @@ | ||
Use the [pnpm](https://pnpm.io/) package manager to install vue3-lazy-hydration. | ||
1. Clone the repository | ||
@@ -487,7 +510,3 @@ | ||
```bash | ||
# with yarn | ||
yarn | ||
# with npm | ||
npm install | ||
pnpm i | ||
``` | ||
@@ -498,7 +517,3 @@ | ||
```bash | ||
# with yarn | ||
yarn dev | ||
# with npm | ||
npm run dev | ||
pnpm dev | ||
``` | ||
@@ -505,0 +520,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55517
1284
523
Yes
32
27
2
1