@hybridly/vite 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -19,18 +19,18 @@ const icons = require('unplugin-icons/vite');
19
19
  const loaders = require('unplugin-icons/loaders');
20
20
  const vue = require('@vitejs/plugin-vue');
21
21
 
22
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
22
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
23
23
 
24
- const laravel__default = /*#__PURE__*/_interopDefaultLegacy(laravel);
25
- const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
26
- const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
27
- const makeDebugger__default = /*#__PURE__*/_interopDefaultLegacy(makeDebugger);
28
- const run__default = /*#__PURE__*/_interopDefaultLegacy(run);
29
- const autoimport__default = /*#__PURE__*/_interopDefaultLegacy(autoimport);
30
- const vueComponents__default = /*#__PURE__*/_interopDefaultLegacy(vueComponents);
31
- const iconsResolver__default = /*#__PURE__*/_interopDefaultLegacy(iconsResolver);
32
- const icons__default = /*#__PURE__*/_interopDefaultLegacy(icons);
33
- const vue__default = /*#__PURE__*/_interopDefaultLegacy(vue);
24
+ const laravel__default = /*#__PURE__*/_interopDefaultCompat(laravel);
25
+ const path__default = /*#__PURE__*/_interopDefaultCompat(path);
26
+ const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
27
+ const makeDebugger__default = /*#__PURE__*/_interopDefaultCompat(makeDebugger);
28
+ const run__default = /*#__PURE__*/_interopDefaultCompat(run);
29
+ const autoimport__default = /*#__PURE__*/_interopDefaultCompat(autoimport);
30
+ const vueComponents__default = /*#__PURE__*/_interopDefaultCompat(vueComponents);
31
+ const iconsResolver__default = /*#__PURE__*/_interopDefaultCompat(iconsResolver);
32
+ const icons__default = /*#__PURE__*/_interopDefaultCompat(icons);
33
+ const vue__default = /*#__PURE__*/_interopDefaultCompat(vue);
34
34
 
35
35
  const LAYOUT_PLUGIN_NAME = "vite:hybridly:layout";
36
36
  const CONFIG_PLUGIN_NAME = "vite:hybridly:config";
@@ -68,7 +68,7 @@ function generateTsConfig(options, config) {
68
68
  types: [
69
69
  "vite/client",
70
70
  "hybridly/client",
71
- ...options.icons !== false ? ["unplugin-icons/types/vue"] : []
71
+ ...options.icons !== false && isPackageInstalled("unplugin-icons") ? ["unplugin-icons/types/vue"] : []
72
72
  ],
73
73
  baseUrl: "..",
74
74
  paths: {
@@ -253,6 +253,7 @@ const initialize = (options, config) => {
253
253
  return getClientCode(config);
254
254
  }
255
255
  },
256
+ // Denies HMR for `.hybridly` content, it causes unwanted reloads
256
257
  async handleHotUpdate(ctx) {
257
258
  if (ctx.file.includes(".hybridly")) {
258
259
  return [];
@@ -479,12 +480,15 @@ function getVueOptions(options) {
479
480
  transformAssetUrls: {
480
481
  base: null,
481
482
  includeAbsolute: false
482
- }
483
+ },
484
+ ...options.vue?.template
483
485
  },
484
486
  script: {
485
487
  globalTypeFiles: [
486
488
  path__default.resolve(".hybridly/php-types.d.ts")
487
- ]
489
+ ],
490
+ defineModel: true,
491
+ ...options.vue?.script
488
492
  }
489
493
  },
490
494
  options.vue ?? {},
@@ -508,5 +512,5 @@ async function plugin(options = {}) {
508
512
 
509
513
  exports.HybridlyImports = HybridlyImports;
510
514
  exports.HybridlyResolver = HybridlyResolver;
511
- exports["default"] = plugin;
515
+ exports.default = plugin;
512
516
  exports.layout = layout;
@@ -0,0 +1,81 @@
1
+ import { Plugin } from 'vite';
2
+ import { DynamicConfiguration } from '@hybridly/core';
3
+ import autoimport from 'unplugin-auto-import/vite';
4
+ import icons from 'unplugin-icons/vite';
5
+ import laravel from 'laravel-vite-plugin';
6
+ import { Runner } from 'vite-plugin-run';
7
+ import vue from '@vitejs/plugin-vue';
8
+ import vueComponents from 'unplugin-vue-components/vite';
9
+ import { ComponentResolver } from 'unplugin-vue-components/types';
10
+
11
+ type AutoImportOptions = Parameters<typeof autoimport>[0];
12
+ declare const HybridlyImports: {
13
+ 'hybridly/vue': string[];
14
+ hybridly: string[];
15
+ };
16
+
17
+ type IconsOptions = Parameters<typeof icons>[0];
18
+ type CustomIconOptions = string[] | {
19
+ /** Name of the icons directory under the root directory. */
20
+ icons?: string;
21
+ /** Names of the custom icon collections that should be registered. */
22
+ collections?: string[];
23
+ };
24
+
25
+ type LaravelOptions = Exclude<Parameters<typeof laravel>[0], string | string[]>;
26
+
27
+ type VueOptions = Parameters<typeof vue>[0];
28
+
29
+ type VueComponentsOptions = Parameters<typeof vueComponents>[0] & {
30
+ /** Name of the Link component. */
31
+ linkName?: string;
32
+ /** Custom prefix for Headless UI components. */
33
+ headlessUiPrefix?: string;
34
+ };
35
+ type CustomResolvers = ComponentResolver | ComponentResolver[];
36
+ type CustomComponentsOptions = VueComponentsOptions;
37
+ declare function HybridlyResolver(linkName?: string): {
38
+ type: "component";
39
+ resolve: (name: string) => {
40
+ from: string;
41
+ name: string;
42
+ as: string;
43
+ } | undefined;
44
+ };
45
+
46
+ interface ViteOptions {
47
+ /** Path to the PHP executable. */
48
+ php?: string;
49
+ /** Options for the layout plugin. */
50
+ layout?: LayoutOptions;
51
+ /** Options for `@vitejs/plugin-vue`. */
52
+ vue?: false | VueOptions;
53
+ /** Options for `laravel-vite-plugin`. Set to `false` to disable. */
54
+ laravel?: false | Partial<LaravelOptions>;
55
+ /** Options for `vite-plugin-run`. Set to `false` to disable. */
56
+ run?: false | Runner[];
57
+ /** Options for `unplugin-auto-import`. Set to `false` to disable. */
58
+ autoImports?: false | AutoImportOptions;
59
+ /** Options for `unplugin-vue-components`. Set to `false` to disable. */
60
+ vueComponents?: false | CustomComponentsOptions;
61
+ /** Options for `unplugin-icons`. Set to `false` to disable. */
62
+ icons?: false | IconsOptions;
63
+ /** Options for custom icon collections. */
64
+ customIcons?: CustomIconOptions;
65
+ /** Override vue component resolvers. */
66
+ overrideResolvers?: CustomResolvers;
67
+ /** Whether to write shims. */
68
+ shims?: boolean;
69
+ }
70
+ interface LayoutOptions {
71
+ /** Custom RegExp for parsing the template string. */
72
+ templateRegExp?: RegExp;
73
+ /** Name of the layout used when no argument is provided to `layout`. */
74
+ defaultLayoutName?: string;
75
+ }
76
+
77
+ declare const _default: (options: ViteOptions, config: DynamicConfiguration) => Plugin;
78
+
79
+ declare function plugin(options?: ViteOptions): Promise<any[]>;
80
+
81
+ export { HybridlyImports, HybridlyResolver, type ViteOptions as Options, plugin as default, _default as layout };
@@ -0,0 +1,81 @@
1
+ import { Plugin } from 'vite';
2
+ import { DynamicConfiguration } from '@hybridly/core';
3
+ import autoimport from 'unplugin-auto-import/vite';
4
+ import icons from 'unplugin-icons/vite';
5
+ import laravel from 'laravel-vite-plugin';
6
+ import { Runner } from 'vite-plugin-run';
7
+ import vue from '@vitejs/plugin-vue';
8
+ import vueComponents from 'unplugin-vue-components/vite';
9
+ import { ComponentResolver } from 'unplugin-vue-components/types';
10
+
11
+ type AutoImportOptions = Parameters<typeof autoimport>[0];
12
+ declare const HybridlyImports: {
13
+ 'hybridly/vue': string[];
14
+ hybridly: string[];
15
+ };
16
+
17
+ type IconsOptions = Parameters<typeof icons>[0];
18
+ type CustomIconOptions = string[] | {
19
+ /** Name of the icons directory under the root directory. */
20
+ icons?: string;
21
+ /** Names of the custom icon collections that should be registered. */
22
+ collections?: string[];
23
+ };
24
+
25
+ type LaravelOptions = Exclude<Parameters<typeof laravel>[0], string | string[]>;
26
+
27
+ type VueOptions = Parameters<typeof vue>[0];
28
+
29
+ type VueComponentsOptions = Parameters<typeof vueComponents>[0] & {
30
+ /** Name of the Link component. */
31
+ linkName?: string;
32
+ /** Custom prefix for Headless UI components. */
33
+ headlessUiPrefix?: string;
34
+ };
35
+ type CustomResolvers = ComponentResolver | ComponentResolver[];
36
+ type CustomComponentsOptions = VueComponentsOptions;
37
+ declare function HybridlyResolver(linkName?: string): {
38
+ type: "component";
39
+ resolve: (name: string) => {
40
+ from: string;
41
+ name: string;
42
+ as: string;
43
+ } | undefined;
44
+ };
45
+
46
+ interface ViteOptions {
47
+ /** Path to the PHP executable. */
48
+ php?: string;
49
+ /** Options for the layout plugin. */
50
+ layout?: LayoutOptions;
51
+ /** Options for `@vitejs/plugin-vue`. */
52
+ vue?: false | VueOptions;
53
+ /** Options for `laravel-vite-plugin`. Set to `false` to disable. */
54
+ laravel?: false | Partial<LaravelOptions>;
55
+ /** Options for `vite-plugin-run`. Set to `false` to disable. */
56
+ run?: false | Runner[];
57
+ /** Options for `unplugin-auto-import`. Set to `false` to disable. */
58
+ autoImports?: false | AutoImportOptions;
59
+ /** Options for `unplugin-vue-components`. Set to `false` to disable. */
60
+ vueComponents?: false | CustomComponentsOptions;
61
+ /** Options for `unplugin-icons`. Set to `false` to disable. */
62
+ icons?: false | IconsOptions;
63
+ /** Options for custom icon collections. */
64
+ customIcons?: CustomIconOptions;
65
+ /** Override vue component resolvers. */
66
+ overrideResolvers?: CustomResolvers;
67
+ /** Whether to write shims. */
68
+ shims?: boolean;
69
+ }
70
+ interface LayoutOptions {
71
+ /** Custom RegExp for parsing the template string. */
72
+ templateRegExp?: RegExp;
73
+ /** Name of the layout used when no argument is provided to `layout`. */
74
+ defaultLayoutName?: string;
75
+ }
76
+
77
+ declare const _default: (options: ViteOptions, config: DynamicConfiguration) => Plugin;
78
+
79
+ declare function plugin(options?: ViteOptions): Promise<any[]>;
80
+
81
+ export { HybridlyImports, HybridlyResolver, type ViteOptions as Options, plugin as default, _default as layout };
package/dist/index.d.ts CHANGED
@@ -78,4 +78,4 @@ declare const _default: (options: ViteOptions, config: DynamicConfiguration) =>
78
78
 
79
79
  declare function plugin(options?: ViteOptions): Promise<any[]>;
80
80
 
81
- export { HybridlyImports, HybridlyResolver, ViteOptions as Options, plugin as default, _default as layout };
81
+ export { HybridlyImports, HybridlyResolver, type ViteOptions as Options, plugin as default, _default as layout };
package/dist/index.mjs CHANGED
@@ -51,7 +51,7 @@ function generateTsConfig(options, config) {
51
51
  types: [
52
52
  "vite/client",
53
53
  "hybridly/client",
54
- ...options.icons !== false ? ["unplugin-icons/types/vue"] : []
54
+ ...options.icons !== false && isPackageInstalled("unplugin-icons") ? ["unplugin-icons/types/vue"] : []
55
55
  ],
56
56
  baseUrl: "..",
57
57
  paths: {
@@ -236,6 +236,7 @@ const initialize = (options, config) => {
236
236
  return getClientCode(config);
237
237
  }
238
238
  },
239
+ // Denies HMR for `.hybridly` content, it causes unwanted reloads
239
240
  async handleHotUpdate(ctx) {
240
241
  if (ctx.file.includes(".hybridly")) {
241
242
  return [];
@@ -462,12 +463,15 @@ function getVueOptions(options) {
462
463
  transformAssetUrls: {
463
464
  base: null,
464
465
  includeAbsolute: false
465
- }
466
+ },
467
+ ...options.vue?.template
466
468
  },
467
469
  script: {
468
470
  globalTypeFiles: [
469
471
  path.resolve(".hybridly/php-types.d.ts")
470
- ]
472
+ ],
473
+ defineModel: true,
474
+ ...options.vue?.script
471
475
  }
472
476
  },
473
477
  options.vue ?? {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hybridly/vite",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Vite plugin for Hybridly",
5
5
  "keywords": [
6
6
  "hybridly",
@@ -36,24 +36,25 @@
36
36
  "module": "dist/index.mjs",
37
37
  "types": "dist/index.d.ts",
38
38
  "peerDependencies": {
39
+ "vite": "^4.4.9",
39
40
  "vue": "^3.2.45"
40
41
  },
41
42
  "dependencies": {
42
- "@vitejs/plugin-vue": "^4.2.3",
43
- "fast-glob": "^3.3.0",
44
- "laravel-vite-plugin": "^0.7.8",
43
+ "@vitejs/plugin-vue": "^4.3.3",
44
+ "fast-glob": "^3.3.1",
45
+ "laravel-vite-plugin": "^0.8.0",
45
46
  "local-pkg": "^0.4.3",
46
47
  "throttle-debounce": "^5.0.0",
47
48
  "unplugin-auto-import": "^0.16.6",
48
- "unplugin-icons": "^0.16.3",
49
+ "unplugin-icons": "^0.16.6",
49
50
  "unplugin-vue-components": "^0.25.1",
50
51
  "vite-plugin-run": "^0.4.1",
51
- "@hybridly/core": "0.4.2"
52
+ "@hybridly/core": "0.4.3"
52
53
  },
53
54
  "devDependencies": {
54
- "@iconify/json": "^2.2.89",
55
- "rollup": "^3.26.2",
56
- "vite": "^4.4.3",
55
+ "@iconify/json": "^2.2.107",
56
+ "rollup": "^3.28.1",
57
+ "vite": "^4.4.9",
57
58
  "vue": "^3.3.4"
58
59
  },
59
60
  "scripts": {