Comparing version 1.7.2 to 1.8.0
{ | ||
"name": "ziggy-js", | ||
"version": "1.7.2", | ||
"version": "1.8.0", | ||
"description": "Use your Laravel named routes in JavaScript.", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"files": [ | ||
"src/js", | ||
"src/js/index.d.ts", | ||
"dist" | ||
@@ -39,2 +39,3 @@ ], | ||
"esmodule": "dist/index.es.js", | ||
"types": "src/js/index.d.ts", | ||
"repository": { | ||
@@ -45,9 +46,9 @@ "type": "git", | ||
"scripts": { | ||
"build": "microbundle --name route --format modern,es,umd --external none --no-sourcemap", | ||
"build:vue": "microbundle --entry src/js/vue.js --output dist/vue.js --name ZiggyVue --format modern,es,umd --external none --no-sourcemap", | ||
"build:react": "microbundle --entry src/js/react.js --output dist/react.js --name ZiggyReact --format modern,es,umd --external none --no-sourcemap", | ||
"build": "microbundle --name route --format modern,es,umd --external none --no-sourcemap --no-generateTypes", | ||
"build:vue": "microbundle --entry src/js/vue.js --output dist/vue.js --name ZiggyVue --format modern,es,umd --external none --no-sourcemap --no-generateTypes", | ||
"build:react": "microbundle --entry src/js/react.js --output dist/react.js --name ZiggyReact --format modern,es,umd --external none --no-sourcemap --no-generateTypes", | ||
"watch": "npm run build watch", | ||
"build:npm": "microbundle --name route --format modern,es,umd --no-sourcemap", | ||
"build:npm:vue": "microbundle --entry src/js/vue.js --output dist/vue.js --name ZiggyVue --format modern,es,umd --no-sourcemap", | ||
"build:npm:react": "microbundle --entry src/js/react.js --output dist/react.js --name ZiggyReact --format modern,es,umd --no-sourcemap", | ||
"build:npm": "microbundle --name route --format modern,es,umd --no-sourcemap --no-generateTypes", | ||
"build:npm:vue": "microbundle --entry src/js/vue.js --output dist/vue.js --name ZiggyVue --format modern,es,umd --no-sourcemap --no-generateTypes", | ||
"build:npm:react": "microbundle --entry src/js/react.js --output dist/react.js --name ZiggyReact --format modern,es,umd --no-sourcemap --no-generateTypes", | ||
"test": "jest --verbose", | ||
@@ -54,0 +55,0 @@ "prepublishOnly": "npm run build:npm && npm run build:npm:vue && npm run build:npm:react" |
@@ -20,3 +20,3 @@ ![Ziggy - Use your Laravel named routes in JavaScript](https://raw.githubusercontent.com/tighten/ziggy/main/ziggy-banner.png) | ||
- [Route-model binding](#route-model-binding) | ||
- [TypeScript support](#typescript-support) | ||
- [TypeScript](#typescript) | ||
- [**Advanced Setup**](#advanced-setup) | ||
@@ -35,4 +35,8 @@ - [JavaScript frameworks](#javascript-frameworks) | ||
Install Ziggy into your Laravel app with `composer require tightenco/ziggy`. | ||
Install Ziggy in your Laravel app: | ||
```bash | ||
composer require tightenco/ziggy | ||
``` | ||
Add the `@routes` Blade directive to your main layout (_before_ your application's JavaScript), and the `route()` helper function will now be available globally! | ||
@@ -286,6 +290,34 @@ | ||
#### TypeScript support | ||
#### TypeScript | ||
Unofficial TypeScript type definitions for Ziggy are maintained by [benallfree](https://github.com/benallfree) as part of [Definitely Typed](https://github.com/DefinitelyTyped/DefinitelyTyped), and can be installed with `npm install @types/ziggy-js`. | ||
Ziggy includes TypeScript type definitions, and a helper command that can generate additional type definitions to enable route name and parameter autocompletion. | ||
To generate the route types, run Ziggy's Artisan command with the `--types` or `--types-only` option: | ||
```bash | ||
php artisan ziggy:generate --types | ||
``` | ||
To make your IDE aware that Ziggy's `route()` helper is available globally, and to type it correctly, add a declaration like this in a `.d.ts` file somewhere in your project: | ||
```ts | ||
import routeFn from 'ziggy-js'; | ||
declare global { | ||
var route: typeof routeFn; | ||
} | ||
``` | ||
If you don't have Ziggy's NPM package installed, add the following to your `jsconfig.json` or `tsconfig.json` to load Ziggy's types from the Composer vendor directory: | ||
```json | ||
{ | ||
"compilerOptions": { | ||
"paths": { | ||
"ziggy-js": ["./vendor/tightenco/ziggy"] | ||
} | ||
} | ||
} | ||
``` | ||
## Advanced Setup | ||
@@ -292,0 +324,0 @@ |
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
668
92540
13
386
1