@hybridly/vite 0.6.1 → 0.7.0
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 +48 -29
- package/dist/index.d.cts +14 -17
- package/dist/index.d.mts +14 -17
- package/dist/index.d.ts +14 -17
- package/dist/index.mjs +47 -30
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -175,7 +175,7 @@ function laravel(options, hybridlyConfig) {
|
|
|
175
175
|
let registered = `${colors__default.bold(hybridlyConfig.components.views.length)} ${colors__default.dim("views")}, `;
|
|
176
176
|
registered += `${colors__default.bold(hybridlyConfig.components.components.length)} ${colors__default.dim("components")}, `;
|
|
177
177
|
registered += `${colors__default.bold(hybridlyConfig.components.layouts.length)} ${colors__default.dim("layouts")}, `;
|
|
178
|
-
registered += `${colors__default.bold(hybridlyConfig.components.
|
|
178
|
+
registered += `${colors__default.bold(hybridlyConfig.components.files.length)} ${colors__default.dim("files")}`;
|
|
179
179
|
const latest = hybridlyConfig.versions.is_latest ? "" : colors__default.dim(`(${colors__default.yellow(`${hybridlyConfig.versions.latest} is available`)})`);
|
|
180
180
|
let version = `${colors__default.yellow(`v${hybridlyConfig.versions.composer}`)} ${colors__default.dim("(composer)")}, `;
|
|
181
181
|
version += `${colors__default.yellow(`v${hybridlyConfig.versions.npm}`)} ${colors__default.dim("(npm)")}`;
|
|
@@ -345,6 +345,16 @@ function generateLaravelIdeaHelper(config) {
|
|
|
345
345
|
parameters: [1]
|
|
346
346
|
}
|
|
347
347
|
]
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
complete: "routeName",
|
|
351
|
+
condition: [
|
|
352
|
+
{
|
|
353
|
+
classFqn: ["Hybridly\\Hybridly"],
|
|
354
|
+
methodNames: ["base"],
|
|
355
|
+
parameters: [1]
|
|
356
|
+
}
|
|
357
|
+
]
|
|
348
358
|
}
|
|
349
359
|
]
|
|
350
360
|
};
|
|
@@ -392,9 +402,9 @@ function write(data, filename) {
|
|
|
392
402
|
});
|
|
393
403
|
}
|
|
394
404
|
|
|
395
|
-
async function loadConfiguration(
|
|
405
|
+
async function loadConfiguration() {
|
|
396
406
|
try {
|
|
397
|
-
const php =
|
|
407
|
+
const php = process.env.PHP_EXECUTABLE_PATH ?? "php";
|
|
398
408
|
const stdout = node_child_process.execSync(`${php} artisan hybridly:config`);
|
|
399
409
|
return JSON.parse(stdout.toString("utf-8"));
|
|
400
410
|
} catch (e) {
|
|
@@ -457,7 +467,7 @@ const initialize = (options, config) => {
|
|
|
457
467
|
return await forceRestart("Routing changed");
|
|
458
468
|
}
|
|
459
469
|
if (/.*\.vue$/.test(file)) {
|
|
460
|
-
const updatedConfig = await loadConfiguration(
|
|
470
|
+
const updatedConfig = await loadConfiguration();
|
|
461
471
|
const viewsOrLayoutsChanged = didViewsOrLayoutsChange(updatedConfig, config);
|
|
462
472
|
if (viewsOrLayoutsChanged) {
|
|
463
473
|
return await forceRestart("View or layout changed");
|
|
@@ -550,10 +560,11 @@ function getRunOptions(options) {
|
|
|
550
560
|
if (options.run === false) {
|
|
551
561
|
return [];
|
|
552
562
|
}
|
|
563
|
+
const php = process.env.PHP_EXECUTABLE_PATH ?? "php";
|
|
553
564
|
return [
|
|
554
565
|
{
|
|
555
566
|
name: "Generate TypeScript types",
|
|
556
|
-
run: [
|
|
567
|
+
run: [php, "artisan", "hybridly:types"],
|
|
557
568
|
pattern: [
|
|
558
569
|
"+(app|src)/**/*Data.php",
|
|
559
570
|
"+(app|src)/**/Enums/*.php",
|
|
@@ -562,7 +573,7 @@ function getRunOptions(options) {
|
|
|
562
573
|
},
|
|
563
574
|
{
|
|
564
575
|
name: "Generate i18n",
|
|
565
|
-
run: [
|
|
576
|
+
run: [php, "artisan", "hybridly:i18n"],
|
|
566
577
|
pattern: "lang/**/*.php"
|
|
567
578
|
},
|
|
568
579
|
...options.run ?? []
|
|
@@ -583,8 +594,6 @@ const HybridlyImports = {
|
|
|
583
594
|
"useDialog",
|
|
584
595
|
"useHistoryState",
|
|
585
596
|
"usePaginator",
|
|
586
|
-
"defineLayout",
|
|
587
|
-
"defineLayoutProperties",
|
|
588
597
|
"registerHook",
|
|
589
598
|
"useRoute",
|
|
590
599
|
"useQueryParameters"
|
|
@@ -592,7 +601,8 @@ const HybridlyImports = {
|
|
|
592
601
|
"hybridly": [
|
|
593
602
|
"router",
|
|
594
603
|
"route",
|
|
595
|
-
"can"
|
|
604
|
+
"can",
|
|
605
|
+
"getRouterContext"
|
|
596
606
|
]
|
|
597
607
|
};
|
|
598
608
|
function getAutoImportsOptions(options, config) {
|
|
@@ -619,9 +629,9 @@ function getAutoImportsOptions(options, config) {
|
|
|
619
629
|
dirs: [
|
|
620
630
|
`${config.architecture.root_directory}/utils`,
|
|
621
631
|
`${config.architecture.root_directory}/composables`,
|
|
622
|
-
...config.components.
|
|
632
|
+
...config.components.files
|
|
623
633
|
],
|
|
624
|
-
imports: [
|
|
634
|
+
imports: options.autoImportsMap ?? [
|
|
625
635
|
"vue",
|
|
626
636
|
"vue/macros",
|
|
627
637
|
...presets.filter((pkg) => isPackageInstalled(pkg)),
|
|
@@ -641,8 +651,8 @@ async function getVueComponentsOptions(options, config) {
|
|
|
641
651
|
const hasIcons = options?.icons !== false;
|
|
642
652
|
const customCollections = Array.isArray(options.customIcons) ? options.customIcons : options.customIcons?.collections ?? [];
|
|
643
653
|
const overrideResolvers = options.overrideResolvers ? Array.isArray(options.overrideResolvers) ? options.overrideResolvers : [options.overrideResolvers] : false;
|
|
644
|
-
const
|
|
645
|
-
const
|
|
654
|
+
const shouldImportHeadlessUi = isPackageInstalled("@headlessui/vue") && options.vueComponents?.headlessUiPrefix !== false;
|
|
655
|
+
const shouldImportRadix = isPackageInstalled("radix-vue") && options.vueComponents?.radixPrefix !== false;
|
|
646
656
|
return utils.merge(
|
|
647
657
|
{
|
|
648
658
|
dirs: [
|
|
@@ -652,21 +662,27 @@ async function getVueComponentsOptions(options, config) {
|
|
|
652
662
|
dts: ".hybridly/components.d.ts",
|
|
653
663
|
resolvers: overrideResolvers || [
|
|
654
664
|
...hasIcons ? [iconsResolver__default({ customCollections })] : [],
|
|
655
|
-
...
|
|
656
|
-
...
|
|
665
|
+
...shouldImportHeadlessUi ? [resolvers.HeadlessUiResolver({ prefix: options?.vueComponents?.headlessUiPrefix || "Headless" })] : [],
|
|
666
|
+
...shouldImportRadix ? [await RadixResolver(options?.vueComponents?.radixPrefix || "Radix")] : [],
|
|
657
667
|
ProvidedComponentListResolver(config),
|
|
658
|
-
HybridlyResolver(options
|
|
668
|
+
HybridlyResolver(options, config)
|
|
659
669
|
]
|
|
660
670
|
},
|
|
661
671
|
options.vueComponents ?? {},
|
|
662
672
|
{ overwriteArray: false }
|
|
663
673
|
);
|
|
664
674
|
}
|
|
665
|
-
async function RadixResolver(prefix
|
|
675
|
+
async function RadixResolver(prefix) {
|
|
666
676
|
const radix = await importPackage("radix-vue/resolver");
|
|
667
677
|
return radix.default({ prefix });
|
|
668
678
|
}
|
|
669
|
-
function HybridlyResolver(
|
|
679
|
+
function HybridlyResolver(options, config) {
|
|
680
|
+
return [
|
|
681
|
+
HybridlyLinkResolver(options?.vueComponents === false ? void 0 : options?.vueComponents?.linkName),
|
|
682
|
+
ProvidedComponentListResolver(config)
|
|
683
|
+
];
|
|
684
|
+
}
|
|
685
|
+
function HybridlyLinkResolver(linkName = "RouterLink") {
|
|
670
686
|
return {
|
|
671
687
|
type: "component",
|
|
672
688
|
resolve: (name) => {
|
|
@@ -872,22 +888,25 @@ import '${LOCAL_BUILD_VIRTUAL_ID}'`;
|
|
|
872
888
|
}
|
|
873
889
|
|
|
874
890
|
async function plugin(options = {}) {
|
|
875
|
-
const config = await loadConfiguration(
|
|
891
|
+
const config = await loadConfiguration();
|
|
892
|
+
const resolvedOptions = typeof options === "function" ? await options(config) : options;
|
|
876
893
|
return [
|
|
877
|
-
initialize(
|
|
878
|
-
layout(
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
894
|
+
initialize(resolvedOptions, config),
|
|
895
|
+
layout(resolvedOptions, config),
|
|
896
|
+
resolvedOptions.laravel !== false && laravel(resolvedOptions, config),
|
|
897
|
+
resolvedOptions.run !== false && run__default(getRunOptions(resolvedOptions)),
|
|
898
|
+
resolvedOptions.vueComponents !== false && vueComponents__default(await getVueComponentsOptions(resolvedOptions, config)),
|
|
899
|
+
resolvedOptions.autoImports !== false && autoimport__default(getAutoImportsOptions(resolvedOptions, config)),
|
|
900
|
+
resolvedOptions.icons !== false && icons__default(getIconsOptions(resolvedOptions, config)),
|
|
901
|
+
resolvedOptions.vue !== false && vue__default(getVueOptions(resolvedOptions)),
|
|
902
|
+
resolvedOptions.killSwitch !== false && killSwitch(),
|
|
903
|
+
resolvedOptions.warnOnLocalBuilds !== false && warnOnLocalBuilds()
|
|
887
904
|
];
|
|
888
905
|
}
|
|
889
906
|
|
|
890
907
|
exports.HybridlyImports = HybridlyImports;
|
|
908
|
+
exports.HybridlyLinkResolver = HybridlyLinkResolver;
|
|
891
909
|
exports.HybridlyResolver = HybridlyResolver;
|
|
910
|
+
exports.ProvidedComponentListResolver = ProvidedComponentListResolver;
|
|
892
911
|
exports.default = plugin;
|
|
893
912
|
exports.layout = layout;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
2
1
|
import { DynamicConfiguration } from '@hybridly/core';
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
import { ImportsMap, PresetName } from 'unplugin-auto-import/types';
|
|
3
4
|
import autoimport from 'unplugin-auto-import/vite';
|
|
4
5
|
import icons from 'unplugin-icons/vite';
|
|
5
6
|
import { Runner } from 'vite-plugin-run';
|
|
@@ -26,25 +27,18 @@ type VueOptions = Parameters<typeof vue>[0];
|
|
|
26
27
|
type VueComponentsOptions = Parameters<typeof vueComponents>[0] & {
|
|
27
28
|
/** Name of the Link component. */
|
|
28
29
|
linkName?: string;
|
|
29
|
-
/**
|
|
30
|
-
headlessUiPrefix?: string;
|
|
31
|
-
/**
|
|
32
|
-
radixPrefix?: string;
|
|
30
|
+
/** Specify the prefix for the Headless UI integration, or disable it. */
|
|
31
|
+
headlessUiPrefix?: string | false;
|
|
32
|
+
/** Specify the prefix for the Radix integration, or disable it. */
|
|
33
|
+
radixPrefix?: string | false;
|
|
33
34
|
};
|
|
34
35
|
type CustomResolvers = ComponentResolver | ComponentResolver[];
|
|
35
36
|
type CustomComponentsOptions = VueComponentsOptions;
|
|
36
|
-
declare function HybridlyResolver(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
from: string;
|
|
40
|
-
name: string;
|
|
41
|
-
as: string;
|
|
42
|
-
} | undefined;
|
|
43
|
-
};
|
|
37
|
+
declare function HybridlyResolver(options: ViteOptions, config: DynamicConfiguration): ComponentResolver[];
|
|
38
|
+
declare function HybridlyLinkResolver(linkName?: string): ComponentResolver;
|
|
39
|
+
declare function ProvidedComponentListResolver(config: DynamicConfiguration): ComponentResolver;
|
|
44
40
|
|
|
45
41
|
interface ViteOptions {
|
|
46
|
-
/** Path to the PHP executable. */
|
|
47
|
-
php?: string;
|
|
48
42
|
/** Disables the Laravel integration. Useful if you prefer to use the official one. */
|
|
49
43
|
laravel?: false;
|
|
50
44
|
/** Options for the layout plugin. */
|
|
@@ -55,6 +49,8 @@ interface ViteOptions {
|
|
|
55
49
|
run?: false | Runner[];
|
|
56
50
|
/** Options for `unplugin-auto-import`. Set to `false` to disable. */
|
|
57
51
|
autoImports?: false | AutoImportOptions;
|
|
52
|
+
/** Import map for `unplugin-auto-import`. */
|
|
53
|
+
autoImportsMap?: Array<ImportsMap | PresetName>;
|
|
58
54
|
/** Options for `unplugin-vue-components`. Set to `false` to disable. */
|
|
59
55
|
vueComponents?: false | CustomComponentsOptions;
|
|
60
56
|
/** Options for `unplugin-icons`. Set to `false` to disable. */
|
|
@@ -89,6 +85,7 @@ interface TsConfigOptions {
|
|
|
89
85
|
|
|
90
86
|
declare const _default: (options: ViteOptions, config: DynamicConfiguration) => Plugin;
|
|
91
87
|
|
|
92
|
-
|
|
88
|
+
type Options = ViteOptions | ((config: DynamicConfiguration) => (ViteOptions | Promise<ViteOptions>));
|
|
89
|
+
declare function plugin(options?: Options): Promise<any[]>;
|
|
93
90
|
|
|
94
|
-
export { HybridlyImports, HybridlyResolver, type ViteOptions as Options, plugin as default, _default as layout };
|
|
91
|
+
export { HybridlyImports, HybridlyLinkResolver, HybridlyResolver, type ViteOptions as Options, ProvidedComponentListResolver, plugin as default, _default as layout };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
2
1
|
import { DynamicConfiguration } from '@hybridly/core';
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
import { ImportsMap, PresetName } from 'unplugin-auto-import/types';
|
|
3
4
|
import autoimport from 'unplugin-auto-import/vite';
|
|
4
5
|
import icons from 'unplugin-icons/vite';
|
|
5
6
|
import { Runner } from 'vite-plugin-run';
|
|
@@ -26,25 +27,18 @@ type VueOptions = Parameters<typeof vue>[0];
|
|
|
26
27
|
type VueComponentsOptions = Parameters<typeof vueComponents>[0] & {
|
|
27
28
|
/** Name of the Link component. */
|
|
28
29
|
linkName?: string;
|
|
29
|
-
/**
|
|
30
|
-
headlessUiPrefix?: string;
|
|
31
|
-
/**
|
|
32
|
-
radixPrefix?: string;
|
|
30
|
+
/** Specify the prefix for the Headless UI integration, or disable it. */
|
|
31
|
+
headlessUiPrefix?: string | false;
|
|
32
|
+
/** Specify the prefix for the Radix integration, or disable it. */
|
|
33
|
+
radixPrefix?: string | false;
|
|
33
34
|
};
|
|
34
35
|
type CustomResolvers = ComponentResolver | ComponentResolver[];
|
|
35
36
|
type CustomComponentsOptions = VueComponentsOptions;
|
|
36
|
-
declare function HybridlyResolver(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
from: string;
|
|
40
|
-
name: string;
|
|
41
|
-
as: string;
|
|
42
|
-
} | undefined;
|
|
43
|
-
};
|
|
37
|
+
declare function HybridlyResolver(options: ViteOptions, config: DynamicConfiguration): ComponentResolver[];
|
|
38
|
+
declare function HybridlyLinkResolver(linkName?: string): ComponentResolver;
|
|
39
|
+
declare function ProvidedComponentListResolver(config: DynamicConfiguration): ComponentResolver;
|
|
44
40
|
|
|
45
41
|
interface ViteOptions {
|
|
46
|
-
/** Path to the PHP executable. */
|
|
47
|
-
php?: string;
|
|
48
42
|
/** Disables the Laravel integration. Useful if you prefer to use the official one. */
|
|
49
43
|
laravel?: false;
|
|
50
44
|
/** Options for the layout plugin. */
|
|
@@ -55,6 +49,8 @@ interface ViteOptions {
|
|
|
55
49
|
run?: false | Runner[];
|
|
56
50
|
/** Options for `unplugin-auto-import`. Set to `false` to disable. */
|
|
57
51
|
autoImports?: false | AutoImportOptions;
|
|
52
|
+
/** Import map for `unplugin-auto-import`. */
|
|
53
|
+
autoImportsMap?: Array<ImportsMap | PresetName>;
|
|
58
54
|
/** Options for `unplugin-vue-components`. Set to `false` to disable. */
|
|
59
55
|
vueComponents?: false | CustomComponentsOptions;
|
|
60
56
|
/** Options for `unplugin-icons`. Set to `false` to disable. */
|
|
@@ -89,6 +85,7 @@ interface TsConfigOptions {
|
|
|
89
85
|
|
|
90
86
|
declare const _default: (options: ViteOptions, config: DynamicConfiguration) => Plugin;
|
|
91
87
|
|
|
92
|
-
|
|
88
|
+
type Options = ViteOptions | ((config: DynamicConfiguration) => (ViteOptions | Promise<ViteOptions>));
|
|
89
|
+
declare function plugin(options?: Options): Promise<any[]>;
|
|
93
90
|
|
|
94
|
-
export { HybridlyImports, HybridlyResolver, type ViteOptions as Options, plugin as default, _default as layout };
|
|
91
|
+
export { HybridlyImports, HybridlyLinkResolver, HybridlyResolver, type ViteOptions as Options, ProvidedComponentListResolver, plugin as default, _default as layout };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
2
1
|
import { DynamicConfiguration } from '@hybridly/core';
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
import { ImportsMap, PresetName } from 'unplugin-auto-import/types';
|
|
3
4
|
import autoimport from 'unplugin-auto-import/vite';
|
|
4
5
|
import icons from 'unplugin-icons/vite';
|
|
5
6
|
import { Runner } from 'vite-plugin-run';
|
|
@@ -26,25 +27,18 @@ type VueOptions = Parameters<typeof vue>[0];
|
|
|
26
27
|
type VueComponentsOptions = Parameters<typeof vueComponents>[0] & {
|
|
27
28
|
/** Name of the Link component. */
|
|
28
29
|
linkName?: string;
|
|
29
|
-
/**
|
|
30
|
-
headlessUiPrefix?: string;
|
|
31
|
-
/**
|
|
32
|
-
radixPrefix?: string;
|
|
30
|
+
/** Specify the prefix for the Headless UI integration, or disable it. */
|
|
31
|
+
headlessUiPrefix?: string | false;
|
|
32
|
+
/** Specify the prefix for the Radix integration, or disable it. */
|
|
33
|
+
radixPrefix?: string | false;
|
|
33
34
|
};
|
|
34
35
|
type CustomResolvers = ComponentResolver | ComponentResolver[];
|
|
35
36
|
type CustomComponentsOptions = VueComponentsOptions;
|
|
36
|
-
declare function HybridlyResolver(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
from: string;
|
|
40
|
-
name: string;
|
|
41
|
-
as: string;
|
|
42
|
-
} | undefined;
|
|
43
|
-
};
|
|
37
|
+
declare function HybridlyResolver(options: ViteOptions, config: DynamicConfiguration): ComponentResolver[];
|
|
38
|
+
declare function HybridlyLinkResolver(linkName?: string): ComponentResolver;
|
|
39
|
+
declare function ProvidedComponentListResolver(config: DynamicConfiguration): ComponentResolver;
|
|
44
40
|
|
|
45
41
|
interface ViteOptions {
|
|
46
|
-
/** Path to the PHP executable. */
|
|
47
|
-
php?: string;
|
|
48
42
|
/** Disables the Laravel integration. Useful if you prefer to use the official one. */
|
|
49
43
|
laravel?: false;
|
|
50
44
|
/** Options for the layout plugin. */
|
|
@@ -55,6 +49,8 @@ interface ViteOptions {
|
|
|
55
49
|
run?: false | Runner[];
|
|
56
50
|
/** Options for `unplugin-auto-import`. Set to `false` to disable. */
|
|
57
51
|
autoImports?: false | AutoImportOptions;
|
|
52
|
+
/** Import map for `unplugin-auto-import`. */
|
|
53
|
+
autoImportsMap?: Array<ImportsMap | PresetName>;
|
|
58
54
|
/** Options for `unplugin-vue-components`. Set to `false` to disable. */
|
|
59
55
|
vueComponents?: false | CustomComponentsOptions;
|
|
60
56
|
/** Options for `unplugin-icons`. Set to `false` to disable. */
|
|
@@ -89,6 +85,7 @@ interface TsConfigOptions {
|
|
|
89
85
|
|
|
90
86
|
declare const _default: (options: ViteOptions, config: DynamicConfiguration) => Plugin;
|
|
91
87
|
|
|
92
|
-
|
|
88
|
+
type Options = ViteOptions | ((config: DynamicConfiguration) => (ViteOptions | Promise<ViteOptions>));
|
|
89
|
+
declare function plugin(options?: Options): Promise<any[]>;
|
|
93
90
|
|
|
94
|
-
export { HybridlyImports, HybridlyResolver, type ViteOptions as Options, plugin as default, _default as layout };
|
|
91
|
+
export { HybridlyImports, HybridlyLinkResolver, HybridlyResolver, type ViteOptions as Options, ProvidedComponentListResolver, plugin as default, _default as layout };
|
package/dist/index.mjs
CHANGED
|
@@ -156,7 +156,7 @@ function laravel(options, hybridlyConfig) {
|
|
|
156
156
|
let registered = `${colors.bold(hybridlyConfig.components.views.length)} ${colors.dim("views")}, `;
|
|
157
157
|
registered += `${colors.bold(hybridlyConfig.components.components.length)} ${colors.dim("components")}, `;
|
|
158
158
|
registered += `${colors.bold(hybridlyConfig.components.layouts.length)} ${colors.dim("layouts")}, `;
|
|
159
|
-
registered += `${colors.bold(hybridlyConfig.components.
|
|
159
|
+
registered += `${colors.bold(hybridlyConfig.components.files.length)} ${colors.dim("files")}`;
|
|
160
160
|
const latest = hybridlyConfig.versions.is_latest ? "" : colors.dim(`(${colors.yellow(`${hybridlyConfig.versions.latest} is available`)})`);
|
|
161
161
|
let version = `${colors.yellow(`v${hybridlyConfig.versions.composer}`)} ${colors.dim("(composer)")}, `;
|
|
162
162
|
version += `${colors.yellow(`v${hybridlyConfig.versions.npm}`)} ${colors.dim("(npm)")}`;
|
|
@@ -326,6 +326,16 @@ function generateLaravelIdeaHelper(config) {
|
|
|
326
326
|
parameters: [1]
|
|
327
327
|
}
|
|
328
328
|
]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
complete: "routeName",
|
|
332
|
+
condition: [
|
|
333
|
+
{
|
|
334
|
+
classFqn: ["Hybridly\\Hybridly"],
|
|
335
|
+
methodNames: ["base"],
|
|
336
|
+
parameters: [1]
|
|
337
|
+
}
|
|
338
|
+
]
|
|
329
339
|
}
|
|
330
340
|
]
|
|
331
341
|
};
|
|
@@ -373,9 +383,9 @@ function write(data, filename) {
|
|
|
373
383
|
});
|
|
374
384
|
}
|
|
375
385
|
|
|
376
|
-
async function loadConfiguration(
|
|
386
|
+
async function loadConfiguration() {
|
|
377
387
|
try {
|
|
378
|
-
const php =
|
|
388
|
+
const php = process.env.PHP_EXECUTABLE_PATH ?? "php";
|
|
379
389
|
const stdout = execSync(`${php} artisan hybridly:config`);
|
|
380
390
|
return JSON.parse(stdout.toString("utf-8"));
|
|
381
391
|
} catch (e) {
|
|
@@ -438,7 +448,7 @@ const initialize = (options, config) => {
|
|
|
438
448
|
return await forceRestart("Routing changed");
|
|
439
449
|
}
|
|
440
450
|
if (/.*\.vue$/.test(file)) {
|
|
441
|
-
const updatedConfig = await loadConfiguration(
|
|
451
|
+
const updatedConfig = await loadConfiguration();
|
|
442
452
|
const viewsOrLayoutsChanged = didViewsOrLayoutsChange(updatedConfig, config);
|
|
443
453
|
if (viewsOrLayoutsChanged) {
|
|
444
454
|
return await forceRestart("View or layout changed");
|
|
@@ -531,10 +541,11 @@ function getRunOptions(options) {
|
|
|
531
541
|
if (options.run === false) {
|
|
532
542
|
return [];
|
|
533
543
|
}
|
|
544
|
+
const php = process.env.PHP_EXECUTABLE_PATH ?? "php";
|
|
534
545
|
return [
|
|
535
546
|
{
|
|
536
547
|
name: "Generate TypeScript types",
|
|
537
|
-
run: [
|
|
548
|
+
run: [php, "artisan", "hybridly:types"],
|
|
538
549
|
pattern: [
|
|
539
550
|
"+(app|src)/**/*Data.php",
|
|
540
551
|
"+(app|src)/**/Enums/*.php",
|
|
@@ -543,7 +554,7 @@ function getRunOptions(options) {
|
|
|
543
554
|
},
|
|
544
555
|
{
|
|
545
556
|
name: "Generate i18n",
|
|
546
|
-
run: [
|
|
557
|
+
run: [php, "artisan", "hybridly:i18n"],
|
|
547
558
|
pattern: "lang/**/*.php"
|
|
548
559
|
},
|
|
549
560
|
...options.run ?? []
|
|
@@ -564,8 +575,6 @@ const HybridlyImports = {
|
|
|
564
575
|
"useDialog",
|
|
565
576
|
"useHistoryState",
|
|
566
577
|
"usePaginator",
|
|
567
|
-
"defineLayout",
|
|
568
|
-
"defineLayoutProperties",
|
|
569
578
|
"registerHook",
|
|
570
579
|
"useRoute",
|
|
571
580
|
"useQueryParameters"
|
|
@@ -573,7 +582,8 @@ const HybridlyImports = {
|
|
|
573
582
|
"hybridly": [
|
|
574
583
|
"router",
|
|
575
584
|
"route",
|
|
576
|
-
"can"
|
|
585
|
+
"can",
|
|
586
|
+
"getRouterContext"
|
|
577
587
|
]
|
|
578
588
|
};
|
|
579
589
|
function getAutoImportsOptions(options, config) {
|
|
@@ -600,9 +610,9 @@ function getAutoImportsOptions(options, config) {
|
|
|
600
610
|
dirs: [
|
|
601
611
|
`${config.architecture.root_directory}/utils`,
|
|
602
612
|
`${config.architecture.root_directory}/composables`,
|
|
603
|
-
...config.components.
|
|
613
|
+
...config.components.files
|
|
604
614
|
],
|
|
605
|
-
imports: [
|
|
615
|
+
imports: options.autoImportsMap ?? [
|
|
606
616
|
"vue",
|
|
607
617
|
"vue/macros",
|
|
608
618
|
...presets.filter((pkg) => isPackageInstalled(pkg)),
|
|
@@ -622,8 +632,8 @@ async function getVueComponentsOptions(options, config) {
|
|
|
622
632
|
const hasIcons = options?.icons !== false;
|
|
623
633
|
const customCollections = Array.isArray(options.customIcons) ? options.customIcons : options.customIcons?.collections ?? [];
|
|
624
634
|
const overrideResolvers = options.overrideResolvers ? Array.isArray(options.overrideResolvers) ? options.overrideResolvers : [options.overrideResolvers] : false;
|
|
625
|
-
const
|
|
626
|
-
const
|
|
635
|
+
const shouldImportHeadlessUi = isPackageInstalled("@headlessui/vue") && options.vueComponents?.headlessUiPrefix !== false;
|
|
636
|
+
const shouldImportRadix = isPackageInstalled("radix-vue") && options.vueComponents?.radixPrefix !== false;
|
|
627
637
|
return merge(
|
|
628
638
|
{
|
|
629
639
|
dirs: [
|
|
@@ -633,21 +643,27 @@ async function getVueComponentsOptions(options, config) {
|
|
|
633
643
|
dts: ".hybridly/components.d.ts",
|
|
634
644
|
resolvers: overrideResolvers || [
|
|
635
645
|
...hasIcons ? [iconsResolver({ customCollections })] : [],
|
|
636
|
-
...
|
|
637
|
-
...
|
|
646
|
+
...shouldImportHeadlessUi ? [HeadlessUiResolver({ prefix: options?.vueComponents?.headlessUiPrefix || "Headless" })] : [],
|
|
647
|
+
...shouldImportRadix ? [await RadixResolver(options?.vueComponents?.radixPrefix || "Radix")] : [],
|
|
638
648
|
ProvidedComponentListResolver(config),
|
|
639
|
-
HybridlyResolver(options
|
|
649
|
+
HybridlyResolver(options, config)
|
|
640
650
|
]
|
|
641
651
|
},
|
|
642
652
|
options.vueComponents ?? {},
|
|
643
653
|
{ overwriteArray: false }
|
|
644
654
|
);
|
|
645
655
|
}
|
|
646
|
-
async function RadixResolver(prefix
|
|
656
|
+
async function RadixResolver(prefix) {
|
|
647
657
|
const radix = await importPackage("radix-vue/resolver");
|
|
648
658
|
return radix.default({ prefix });
|
|
649
659
|
}
|
|
650
|
-
function HybridlyResolver(
|
|
660
|
+
function HybridlyResolver(options, config) {
|
|
661
|
+
return [
|
|
662
|
+
HybridlyLinkResolver(options?.vueComponents === false ? void 0 : options?.vueComponents?.linkName),
|
|
663
|
+
ProvidedComponentListResolver(config)
|
|
664
|
+
];
|
|
665
|
+
}
|
|
666
|
+
function HybridlyLinkResolver(linkName = "RouterLink") {
|
|
651
667
|
return {
|
|
652
668
|
type: "component",
|
|
653
669
|
resolve: (name) => {
|
|
@@ -853,19 +869,20 @@ import '${LOCAL_BUILD_VIRTUAL_ID}'`;
|
|
|
853
869
|
}
|
|
854
870
|
|
|
855
871
|
async function plugin(options = {}) {
|
|
856
|
-
const config = await loadConfiguration(
|
|
872
|
+
const config = await loadConfiguration();
|
|
873
|
+
const resolvedOptions = typeof options === "function" ? await options(config) : options;
|
|
857
874
|
return [
|
|
858
|
-
initialize(
|
|
859
|
-
layout(
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
875
|
+
initialize(resolvedOptions, config),
|
|
876
|
+
layout(resolvedOptions, config),
|
|
877
|
+
resolvedOptions.laravel !== false && laravel(resolvedOptions, config),
|
|
878
|
+
resolvedOptions.run !== false && run(getRunOptions(resolvedOptions)),
|
|
879
|
+
resolvedOptions.vueComponents !== false && vueComponents(await getVueComponentsOptions(resolvedOptions, config)),
|
|
880
|
+
resolvedOptions.autoImports !== false && autoimport(getAutoImportsOptions(resolvedOptions, config)),
|
|
881
|
+
resolvedOptions.icons !== false && icons(getIconsOptions(resolvedOptions, config)),
|
|
882
|
+
resolvedOptions.vue !== false && vue(getVueOptions(resolvedOptions)),
|
|
883
|
+
resolvedOptions.killSwitch !== false && killSwitch(),
|
|
884
|
+
resolvedOptions.warnOnLocalBuilds !== false && warnOnLocalBuilds()
|
|
868
885
|
];
|
|
869
886
|
}
|
|
870
887
|
|
|
871
|
-
export { HybridlyImports, HybridlyResolver, plugin as default, layout };
|
|
888
|
+
export { HybridlyImports, HybridlyLinkResolver, HybridlyResolver, ProvidedComponentListResolver, plugin as default, layout };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridly/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Vite plugin for Hybridly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hybridly",
|
|
@@ -41,23 +41,23 @@
|
|
|
41
41
|
"vue": "^3.2.45"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@vitejs/plugin-vue": "^
|
|
44
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
45
45
|
"fast-glob": "^3.3.2",
|
|
46
46
|
"local-pkg": "^0.5.0",
|
|
47
|
-
"magic-string": "^0.30.
|
|
47
|
+
"magic-string": "^0.30.8",
|
|
48
48
|
"picocolors": "^1.0.0",
|
|
49
49
|
"throttle-debounce": "^5.0.0",
|
|
50
|
-
"unplugin-auto-import": "^0.17.
|
|
51
|
-
"unplugin-icons": "^0.18.
|
|
50
|
+
"unplugin-auto-import": "^0.17.5",
|
|
51
|
+
"unplugin-icons": "^0.18.5",
|
|
52
52
|
"unplugin-vue-components": "^0.26.0",
|
|
53
53
|
"vite-plugin-run": "^0.5.1",
|
|
54
|
-
"@hybridly/core": "0.
|
|
54
|
+
"@hybridly/core": "0.7.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@iconify/json": "^2.2.
|
|
58
|
-
"rollup": "^4.
|
|
59
|
-
"vite": "^5.
|
|
60
|
-
"vue": "^3.4.
|
|
57
|
+
"@iconify/json": "^2.2.191",
|
|
58
|
+
"rollup": "^4.13.0",
|
|
59
|
+
"vite": "^5.1.6",
|
|
60
|
+
"vue": "^3.4.21"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "unbuild",
|