@hybridly/vite 0.4.1 → 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: {
@@ -88,7 +88,13 @@ function generateTsConfig(options, config) {
88
88
  ...config.components.layouts.map(({ path: path2 }) => `../${path2}`),
89
89
  ...config.components.components.map(({ path: path2 }) => `../${path2}`),
90
90
  `../${config.architecture.root}/**/*`,
91
- "./*"
91
+ "../app/**/*",
92
+ "../src/**/*",
93
+ "./php-types.d.ts",
94
+ "./global-types.d.ts",
95
+ "./routes.d.ts",
96
+ "./components.d.ts",
97
+ "./auto-imports.d.ts"
92
98
  ],
93
99
  exclude: [
94
100
  "../public/**/*",
@@ -247,6 +253,7 @@ const initialize = (options, config) => {
247
253
  return getClientCode(config);
248
254
  }
249
255
  },
256
+ // Denies HMR for `.hybridly` content, it causes unwanted reloads
250
257
  async handleHotUpdate(ctx) {
251
258
  if (ctx.file.includes(".hybridly")) {
252
259
  return [];
@@ -342,6 +349,7 @@ function getLaravelOptions(options, config) {
342
349
  const HybridlyImports = {
343
350
  "hybridly/vue": [
344
351
  "useProperty",
352
+ "setProperty",
345
353
  "useRefinements",
346
354
  "useProperties",
347
355
  "useBackForward",
@@ -352,12 +360,12 @@ const HybridlyImports = {
352
360
  "usePaginator",
353
361
  "defineLayout",
354
362
  "defineLayoutProperties",
355
- "registerHook"
363
+ "registerHook",
364
+ "useRoute"
356
365
  ],
357
366
  "hybridly": [
358
367
  "router",
359
368
  "route",
360
- "current",
361
369
  "can"
362
370
  ]
363
371
  };
@@ -472,12 +480,15 @@ function getVueOptions(options) {
472
480
  transformAssetUrls: {
473
481
  base: null,
474
482
  includeAbsolute: false
475
- }
483
+ },
484
+ ...options.vue?.template
476
485
  },
477
486
  script: {
478
487
  globalTypeFiles: [
479
- path__default.resolve(".hybridly/back-end.d.ts")
480
- ]
488
+ path__default.resolve(".hybridly/php-types.d.ts")
489
+ ],
490
+ defineModel: true,
491
+ ...options.vue?.script
481
492
  }
482
493
  },
483
494
  options.vue ?? {},
@@ -501,5 +512,5 @@ async function plugin(options = {}) {
501
512
 
502
513
  exports.HybridlyImports = HybridlyImports;
503
514
  exports.HybridlyResolver = HybridlyResolver;
504
- exports["default"] = plugin;
515
+ exports.default = plugin;
505
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: {
@@ -71,7 +71,13 @@ function generateTsConfig(options, config) {
71
71
  ...config.components.layouts.map(({ path: path2 }) => `../${path2}`),
72
72
  ...config.components.components.map(({ path: path2 }) => `../${path2}`),
73
73
  `../${config.architecture.root}/**/*`,
74
- "./*"
74
+ "../app/**/*",
75
+ "../src/**/*",
76
+ "./php-types.d.ts",
77
+ "./global-types.d.ts",
78
+ "./routes.d.ts",
79
+ "./components.d.ts",
80
+ "./auto-imports.d.ts"
75
81
  ],
76
82
  exclude: [
77
83
  "../public/**/*",
@@ -230,6 +236,7 @@ const initialize = (options, config) => {
230
236
  return getClientCode(config);
231
237
  }
232
238
  },
239
+ // Denies HMR for `.hybridly` content, it causes unwanted reloads
233
240
  async handleHotUpdate(ctx) {
234
241
  if (ctx.file.includes(".hybridly")) {
235
242
  return [];
@@ -325,6 +332,7 @@ function getLaravelOptions(options, config) {
325
332
  const HybridlyImports = {
326
333
  "hybridly/vue": [
327
334
  "useProperty",
335
+ "setProperty",
328
336
  "useRefinements",
329
337
  "useProperties",
330
338
  "useBackForward",
@@ -335,12 +343,12 @@ const HybridlyImports = {
335
343
  "usePaginator",
336
344
  "defineLayout",
337
345
  "defineLayoutProperties",
338
- "registerHook"
346
+ "registerHook",
347
+ "useRoute"
339
348
  ],
340
349
  "hybridly": [
341
350
  "router",
342
351
  "route",
343
- "current",
344
352
  "can"
345
353
  ]
346
354
  };
@@ -455,12 +463,15 @@ function getVueOptions(options) {
455
463
  transformAssetUrls: {
456
464
  base: null,
457
465
  includeAbsolute: false
458
- }
466
+ },
467
+ ...options.vue?.template
459
468
  },
460
469
  script: {
461
470
  globalTypeFiles: [
462
- path.resolve(".hybridly/back-end.d.ts")
463
- ]
471
+ path.resolve(".hybridly/php-types.d.ts")
472
+ ],
473
+ defineModel: true,
474
+ ...options.vue?.script
464
475
  }
465
476
  },
466
477
  options.vue ?? {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hybridly/vite",
3
- "version": "0.4.1",
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.2.12",
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
- "unplugin-auto-import": "^0.16.4",
48
- "unplugin-icons": "^0.16.2",
48
+ "unplugin-auto-import": "^0.16.6",
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.1"
52
+ "@hybridly/core": "0.4.3"
52
53
  },
53
54
  "devDependencies": {
54
- "@iconify/json": "^2.2.74",
55
- "rollup": "^3.23.1",
56
- "vite": "^4.3.9",
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": {