@hybridly/vite 0.1.0-alpha.0 → 0.1.0-alpha.2
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 +82 -67
- package/dist/index.d.ts +14 -2
- package/dist/index.mjs +81 -68
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ const throttleDebounce = require('throttle-debounce');
|
|
|
12
12
|
const node_child_process = require('node:child_process');
|
|
13
13
|
const node_util = require('node:util');
|
|
14
14
|
const run = require('vite-plugin-run');
|
|
15
|
+
const utils = require('@hybridly/utils');
|
|
15
16
|
const autoimport = require('unplugin-auto-import/vite');
|
|
16
17
|
const vueComponents = require('unplugin-vue-components/vite');
|
|
17
18
|
const iconsResolver = require('unplugin-icons/resolver');
|
|
@@ -305,81 +306,90 @@ function getLaravelOptions(options, config) {
|
|
|
305
306
|
};
|
|
306
307
|
}
|
|
307
308
|
|
|
309
|
+
const HybridlyImports = {
|
|
310
|
+
"hybridly/vue": [
|
|
311
|
+
"useProperty",
|
|
312
|
+
"useTypedProperty",
|
|
313
|
+
"useProperties",
|
|
314
|
+
"useBackForward",
|
|
315
|
+
"useContext",
|
|
316
|
+
"useForm",
|
|
317
|
+
"useDialog",
|
|
318
|
+
"useHistoryState",
|
|
319
|
+
"usePaginator",
|
|
320
|
+
"defineLayout",
|
|
321
|
+
"defineLayoutProperties",
|
|
322
|
+
"registerHook"
|
|
323
|
+
],
|
|
324
|
+
"hybridly": [
|
|
325
|
+
"router",
|
|
326
|
+
"route",
|
|
327
|
+
"current",
|
|
328
|
+
"can"
|
|
329
|
+
]
|
|
330
|
+
};
|
|
308
331
|
function getAutoImportsOptions(options, config) {
|
|
309
332
|
if (options.autoImports === false) {
|
|
310
333
|
return;
|
|
311
334
|
}
|
|
335
|
+
return utils.merge(
|
|
336
|
+
{
|
|
337
|
+
vueTemplate: true,
|
|
338
|
+
dts: ".hybridly/auto-imports.d.ts",
|
|
339
|
+
dirs: [
|
|
340
|
+
`${config.root}/utils`,
|
|
341
|
+
`${config.root}/composables`
|
|
342
|
+
],
|
|
343
|
+
imports: [
|
|
344
|
+
"vue",
|
|
345
|
+
"vue/macros",
|
|
346
|
+
"@vueuse/core",
|
|
347
|
+
"@vueuse/head",
|
|
348
|
+
HybridlyImports
|
|
349
|
+
]
|
|
350
|
+
},
|
|
351
|
+
options.autoImports ?? {},
|
|
352
|
+
{ overwriteArray: false }
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function HybridlyResolver(linkName = "RouterLink") {
|
|
312
357
|
return {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
"vue",
|
|
322
|
-
"vue/macros",
|
|
323
|
-
"@vueuse/core",
|
|
324
|
-
"@vueuse/head",
|
|
325
|
-
{
|
|
326
|
-
"hybridly/vue": [
|
|
327
|
-
"useProperty",
|
|
328
|
-
"useTypedProperty",
|
|
329
|
-
"useProperties",
|
|
330
|
-
"useBackForward",
|
|
331
|
-
"useContext",
|
|
332
|
-
"useForm",
|
|
333
|
-
"useDialog",
|
|
334
|
-
"useHistoryState",
|
|
335
|
-
"usePaginator",
|
|
336
|
-
"defineLayout",
|
|
337
|
-
"defineLayoutProperties",
|
|
338
|
-
"registerHook"
|
|
339
|
-
],
|
|
340
|
-
"hybridly": [
|
|
341
|
-
"router",
|
|
342
|
-
"route",
|
|
343
|
-
"current",
|
|
344
|
-
"can"
|
|
345
|
-
]
|
|
358
|
+
type: "component",
|
|
359
|
+
resolve: (name) => {
|
|
360
|
+
if (name === linkName) {
|
|
361
|
+
return {
|
|
362
|
+
from: "hybridly/vue",
|
|
363
|
+
name: "RouterLink",
|
|
364
|
+
as: linkName
|
|
365
|
+
};
|
|
346
366
|
}
|
|
347
|
-
|
|
348
|
-
...options.autoImports
|
|
367
|
+
}
|
|
349
368
|
};
|
|
350
369
|
}
|
|
351
|
-
|
|
352
370
|
function getVueComponentsOptions(options, config) {
|
|
353
371
|
if (options.vueComponents === false) {
|
|
354
372
|
return {};
|
|
355
373
|
}
|
|
356
|
-
const linkName = options.vueComponents?.linkName ?? "RouterLink";
|
|
357
374
|
const hasIcons = options?.icons !== false;
|
|
358
375
|
const customCollections = Array.isArray(options.customIcons) ? options.customIcons : options.customIcons?.collections ?? [];
|
|
359
376
|
const customResolvers = options.customResolvers ? Array.isArray(options.customResolvers) ? options.customResolvers : [options.customResolvers] : [];
|
|
360
|
-
return
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
...customResolvers
|
|
381
|
-
]
|
|
382
|
-
};
|
|
377
|
+
return utils.merge(
|
|
378
|
+
{
|
|
379
|
+
globs: [
|
|
380
|
+
`${config.root}/components/**/*.vue`,
|
|
381
|
+
...config.domains ? [`${config.root}/${config.domains}/**/components/**/*.vue`] : []
|
|
382
|
+
],
|
|
383
|
+
dts: ".hybridly/components.d.ts",
|
|
384
|
+
resolvers: [
|
|
385
|
+
...hasIcons ? [iconsResolver__default({ customCollections })] : [],
|
|
386
|
+
HybridlyResolver(options.vueComponents?.linkName),
|
|
387
|
+
...customResolvers
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
options.vueComponents ?? {},
|
|
391
|
+
{ overwriteArray: false }
|
|
392
|
+
);
|
|
383
393
|
}
|
|
384
394
|
|
|
385
395
|
function getIconsOptions(options, config) {
|
|
@@ -403,15 +413,18 @@ function getVueOptions(options) {
|
|
|
403
413
|
if (options.vue === false) {
|
|
404
414
|
return;
|
|
405
415
|
}
|
|
406
|
-
return
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
416
|
+
return utils.merge(
|
|
417
|
+
{
|
|
418
|
+
template: {
|
|
419
|
+
transformAssetUrls: {
|
|
420
|
+
base: null,
|
|
421
|
+
includeAbsolute: false
|
|
422
|
+
}
|
|
411
423
|
}
|
|
412
424
|
},
|
|
413
|
-
|
|
414
|
-
|
|
425
|
+
options.vue ?? {},
|
|
426
|
+
{ overwriteArray: false }
|
|
427
|
+
);
|
|
415
428
|
}
|
|
416
429
|
|
|
417
430
|
function generateTsConfig(options, config) {
|
|
@@ -498,6 +511,8 @@ async function plugin(options = {}) {
|
|
|
498
511
|
];
|
|
499
512
|
}
|
|
500
513
|
|
|
514
|
+
exports.HybridlyImports = HybridlyImports;
|
|
515
|
+
exports.HybridlyResolver = HybridlyResolver;
|
|
501
516
|
exports["default"] = plugin;
|
|
502
517
|
exports.layout = layout;
|
|
503
518
|
exports.router = router;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ import vueComponents from 'unplugin-vue-components/vite';
|
|
|
9
9
|
import { ComponentResolver } from 'unplugin-vue-components/types';
|
|
10
10
|
|
|
11
11
|
type AutoImportOptions = Parameters<typeof autoimport>[0];
|
|
12
|
+
declare const HybridlyImports: {
|
|
13
|
+
'hybridly/vue': string[];
|
|
14
|
+
hybridly: string[];
|
|
15
|
+
};
|
|
12
16
|
|
|
13
17
|
type IconsOptions = Parameters<typeof icons>[0];
|
|
14
18
|
type CustomIconOptions = string[] | {
|
|
@@ -27,7 +31,15 @@ type VueComponentsOptions = Parameters<typeof vueComponents>[0] & {
|
|
|
27
31
|
linkName?: string;
|
|
28
32
|
};
|
|
29
33
|
type CustomResolvers = ComponentResolver | ComponentResolver[];
|
|
30
|
-
type CustomComponentsOptions = VueComponentsOptions
|
|
34
|
+
type CustomComponentsOptions = Omit<VueComponentsOptions, 'dirs'>;
|
|
35
|
+
declare function HybridlyResolver(linkName?: string): {
|
|
36
|
+
type: "component";
|
|
37
|
+
resolve: (name: string) => {
|
|
38
|
+
from: string;
|
|
39
|
+
name: string;
|
|
40
|
+
as: string;
|
|
41
|
+
} | undefined;
|
|
42
|
+
};
|
|
31
43
|
|
|
32
44
|
interface ViteOptions {
|
|
33
45
|
/** Options for the layout plugin. */
|
|
@@ -74,4 +86,4 @@ declare const _default: (options: ViteOptions, config: HybridlyConfig) => Plugin
|
|
|
74
86
|
|
|
75
87
|
declare function plugin(options?: ViteOptions): Promise<any[]>;
|
|
76
88
|
|
|
77
|
-
export { ViteOptions as Options, plugin as default, _default$1 as layout, _default as router };
|
|
89
|
+
export { HybridlyImports, HybridlyResolver, ViteOptions as Options, plugin as default, _default$1 as layout, _default as router };
|
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { debounce } from 'throttle-debounce';
|
|
|
8
8
|
import { exec } from 'node:child_process';
|
|
9
9
|
import { promisify } from 'node:util';
|
|
10
10
|
import run from 'vite-plugin-run';
|
|
11
|
+
import { merge } from '@hybridly/utils';
|
|
11
12
|
import autoimport from 'unplugin-auto-import/vite';
|
|
12
13
|
import vueComponents from 'unplugin-vue-components/vite';
|
|
13
14
|
import iconsResolver from 'unplugin-icons/resolver';
|
|
@@ -288,81 +289,90 @@ function getLaravelOptions(options, config) {
|
|
|
288
289
|
};
|
|
289
290
|
}
|
|
290
291
|
|
|
292
|
+
const HybridlyImports = {
|
|
293
|
+
"hybridly/vue": [
|
|
294
|
+
"useProperty",
|
|
295
|
+
"useTypedProperty",
|
|
296
|
+
"useProperties",
|
|
297
|
+
"useBackForward",
|
|
298
|
+
"useContext",
|
|
299
|
+
"useForm",
|
|
300
|
+
"useDialog",
|
|
301
|
+
"useHistoryState",
|
|
302
|
+
"usePaginator",
|
|
303
|
+
"defineLayout",
|
|
304
|
+
"defineLayoutProperties",
|
|
305
|
+
"registerHook"
|
|
306
|
+
],
|
|
307
|
+
"hybridly": [
|
|
308
|
+
"router",
|
|
309
|
+
"route",
|
|
310
|
+
"current",
|
|
311
|
+
"can"
|
|
312
|
+
]
|
|
313
|
+
};
|
|
291
314
|
function getAutoImportsOptions(options, config) {
|
|
292
315
|
if (options.autoImports === false) {
|
|
293
316
|
return;
|
|
294
317
|
}
|
|
318
|
+
return merge(
|
|
319
|
+
{
|
|
320
|
+
vueTemplate: true,
|
|
321
|
+
dts: ".hybridly/auto-imports.d.ts",
|
|
322
|
+
dirs: [
|
|
323
|
+
`${config.root}/utils`,
|
|
324
|
+
`${config.root}/composables`
|
|
325
|
+
],
|
|
326
|
+
imports: [
|
|
327
|
+
"vue",
|
|
328
|
+
"vue/macros",
|
|
329
|
+
"@vueuse/core",
|
|
330
|
+
"@vueuse/head",
|
|
331
|
+
HybridlyImports
|
|
332
|
+
]
|
|
333
|
+
},
|
|
334
|
+
options.autoImports ?? {},
|
|
335
|
+
{ overwriteArray: false }
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function HybridlyResolver(linkName = "RouterLink") {
|
|
295
340
|
return {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
"vue",
|
|
305
|
-
"vue/macros",
|
|
306
|
-
"@vueuse/core",
|
|
307
|
-
"@vueuse/head",
|
|
308
|
-
{
|
|
309
|
-
"hybridly/vue": [
|
|
310
|
-
"useProperty",
|
|
311
|
-
"useTypedProperty",
|
|
312
|
-
"useProperties",
|
|
313
|
-
"useBackForward",
|
|
314
|
-
"useContext",
|
|
315
|
-
"useForm",
|
|
316
|
-
"useDialog",
|
|
317
|
-
"useHistoryState",
|
|
318
|
-
"usePaginator",
|
|
319
|
-
"defineLayout",
|
|
320
|
-
"defineLayoutProperties",
|
|
321
|
-
"registerHook"
|
|
322
|
-
],
|
|
323
|
-
"hybridly": [
|
|
324
|
-
"router",
|
|
325
|
-
"route",
|
|
326
|
-
"current",
|
|
327
|
-
"can"
|
|
328
|
-
]
|
|
341
|
+
type: "component",
|
|
342
|
+
resolve: (name) => {
|
|
343
|
+
if (name === linkName) {
|
|
344
|
+
return {
|
|
345
|
+
from: "hybridly/vue",
|
|
346
|
+
name: "RouterLink",
|
|
347
|
+
as: linkName
|
|
348
|
+
};
|
|
329
349
|
}
|
|
330
|
-
|
|
331
|
-
...options.autoImports
|
|
350
|
+
}
|
|
332
351
|
};
|
|
333
352
|
}
|
|
334
|
-
|
|
335
353
|
function getVueComponentsOptions(options, config) {
|
|
336
354
|
if (options.vueComponents === false) {
|
|
337
355
|
return {};
|
|
338
356
|
}
|
|
339
|
-
const linkName = options.vueComponents?.linkName ?? "RouterLink";
|
|
340
357
|
const hasIcons = options?.icons !== false;
|
|
341
358
|
const customCollections = Array.isArray(options.customIcons) ? options.customIcons : options.customIcons?.collections ?? [];
|
|
342
359
|
const customResolvers = options.customResolvers ? Array.isArray(options.customResolvers) ? options.customResolvers : [options.customResolvers] : [];
|
|
343
|
-
return
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
...customResolvers
|
|
364
|
-
]
|
|
365
|
-
};
|
|
360
|
+
return merge(
|
|
361
|
+
{
|
|
362
|
+
globs: [
|
|
363
|
+
`${config.root}/components/**/*.vue`,
|
|
364
|
+
...config.domains ? [`${config.root}/${config.domains}/**/components/**/*.vue`] : []
|
|
365
|
+
],
|
|
366
|
+
dts: ".hybridly/components.d.ts",
|
|
367
|
+
resolvers: [
|
|
368
|
+
...hasIcons ? [iconsResolver({ customCollections })] : [],
|
|
369
|
+
HybridlyResolver(options.vueComponents?.linkName),
|
|
370
|
+
...customResolvers
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
options.vueComponents ?? {},
|
|
374
|
+
{ overwriteArray: false }
|
|
375
|
+
);
|
|
366
376
|
}
|
|
367
377
|
|
|
368
378
|
function getIconsOptions(options, config) {
|
|
@@ -386,15 +396,18 @@ function getVueOptions(options) {
|
|
|
386
396
|
if (options.vue === false) {
|
|
387
397
|
return;
|
|
388
398
|
}
|
|
389
|
-
return
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
399
|
+
return merge(
|
|
400
|
+
{
|
|
401
|
+
template: {
|
|
402
|
+
transformAssetUrls: {
|
|
403
|
+
base: null,
|
|
404
|
+
includeAbsolute: false
|
|
405
|
+
}
|
|
394
406
|
}
|
|
395
407
|
},
|
|
396
|
-
|
|
397
|
-
|
|
408
|
+
options.vue ?? {},
|
|
409
|
+
{ overwriteArray: false }
|
|
410
|
+
);
|
|
398
411
|
}
|
|
399
412
|
|
|
400
413
|
function generateTsConfig(options, config) {
|
|
@@ -481,4 +494,4 @@ async function plugin(options = {}) {
|
|
|
481
494
|
];
|
|
482
495
|
}
|
|
483
496
|
|
|
484
|
-
export { plugin as default, layout, router };
|
|
497
|
+
export { HybridlyImports, HybridlyResolver, plugin as default, layout, router };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridly/vite",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
4
|
"description": "Vite plugin for Hybridly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hybridly",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"vue": "^3.2.45"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@iconify/json": "^2.2.24",
|
|
43
42
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
44
43
|
"laravel-vite-plugin": "^0.7.4",
|
|
45
44
|
"throttle-debounce": "^5.0.0",
|
|
46
|
-
"unplugin-auto-import": "^0.
|
|
45
|
+
"unplugin-auto-import": "^0.15.0",
|
|
47
46
|
"unplugin-icons": "^0.15.3",
|
|
48
47
|
"unplugin-vue-components": "^0.24.0",
|
|
49
|
-
"vite-plugin-run": "^0.
|
|
50
|
-
"@hybridly/core": "0.1.0-alpha.
|
|
48
|
+
"vite-plugin-run": "^0.4.0",
|
|
49
|
+
"@hybridly/core": "0.1.0-alpha.2"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
|
-
"
|
|
54
|
-
"
|
|
52
|
+
"@iconify/json": "^2.2.24",
|
|
53
|
+
"rollup": "^3.17.3",
|
|
54
|
+
"vite": "^4.1.4",
|
|
55
55
|
"vue": "^3.2.47"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|