@hybridly/vite 0.4.5 → 0.5.1
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 +54 -20
- package/dist/index.d.cts +10 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +54 -20
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -67,7 +67,8 @@ function generateTsConfig(options, config) {
|
|
|
67
67
|
types: [
|
|
68
68
|
"vite/client",
|
|
69
69
|
"hybridly/client",
|
|
70
|
-
...options.icons !== false ? ["unplugin-icons/types/vue"] : []
|
|
70
|
+
...options.icons !== false ? ["unplugin-icons/types/vue"] : [],
|
|
71
|
+
...options.tsconfig?.types ?? []
|
|
71
72
|
],
|
|
72
73
|
baseUrl: "..",
|
|
73
74
|
paths: {
|
|
@@ -93,12 +94,14 @@ function generateTsConfig(options, config) {
|
|
|
93
94
|
"./global-types.d.ts",
|
|
94
95
|
"./routes.d.ts",
|
|
95
96
|
"./components.d.ts",
|
|
96
|
-
"./auto-imports.d.ts"
|
|
97
|
+
"./auto-imports.d.ts",
|
|
98
|
+
...options.tsconfig?.include ?? []
|
|
97
99
|
],
|
|
98
100
|
exclude: [
|
|
99
101
|
"../public/**/*",
|
|
100
102
|
"../node_modules",
|
|
101
|
-
"../vendor"
|
|
103
|
+
"../vendor",
|
|
104
|
+
...options.tsconfig?.exclude ?? []
|
|
102
105
|
]
|
|
103
106
|
};
|
|
104
107
|
write(JSON.stringify(tsconfig, null, 2), "tsconfig.json");
|
|
@@ -231,9 +234,9 @@ const initialize = (options, config) => {
|
|
|
231
234
|
}
|
|
232
235
|
if (/.*\.vue$/.test(file)) {
|
|
233
236
|
const updatedConfig = await loadConfiguration(options);
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
236
|
-
return await forceRestart("
|
|
237
|
+
const viewsOrLayoutsChanged = didViewsOrLayoutsChange(updatedConfig, config);
|
|
238
|
+
if (viewsOrLayoutsChanged) {
|
|
239
|
+
return await forceRestart("View or layout changed");
|
|
237
240
|
}
|
|
238
241
|
}
|
|
239
242
|
}
|
|
@@ -259,7 +262,7 @@ const initialize = (options, config) => {
|
|
|
259
262
|
}
|
|
260
263
|
};
|
|
261
264
|
};
|
|
262
|
-
function
|
|
265
|
+
function didViewsOrLayoutsChange(updatedConfig, previousConfig) {
|
|
263
266
|
if (!previousConfig) {
|
|
264
267
|
return false;
|
|
265
268
|
}
|
|
@@ -349,6 +352,8 @@ const HybridlyImports = {
|
|
|
349
352
|
"useProperty",
|
|
350
353
|
"setProperty",
|
|
351
354
|
"useRefinements",
|
|
355
|
+
"useTable",
|
|
356
|
+
"useBulkSelect",
|
|
352
357
|
"useProperties",
|
|
353
358
|
"useBackForward",
|
|
354
359
|
"useContext",
|
|
@@ -372,6 +377,18 @@ function getAutoImportsOptions(options, config) {
|
|
|
372
377
|
return;
|
|
373
378
|
}
|
|
374
379
|
const presets = ["@vueuse/core", "@vueuse/head", "vue-i18n"];
|
|
380
|
+
const custom = {
|
|
381
|
+
"@unhead/vue": [
|
|
382
|
+
"useHead",
|
|
383
|
+
"useSeoMeta"
|
|
384
|
+
],
|
|
385
|
+
"@innocenzi/utils": [
|
|
386
|
+
"match",
|
|
387
|
+
"invoke",
|
|
388
|
+
"batchInvoke",
|
|
389
|
+
"asyncInvoke"
|
|
390
|
+
]
|
|
391
|
+
};
|
|
375
392
|
return utils.merge(
|
|
376
393
|
{
|
|
377
394
|
vueTemplate: true,
|
|
@@ -385,6 +402,7 @@ function getAutoImportsOptions(options, config) {
|
|
|
385
402
|
"vue",
|
|
386
403
|
"vue/macros",
|
|
387
404
|
...presets.filter((pkg) => isPackageInstalled(pkg)),
|
|
405
|
+
...Object.entries(custom).filter(([pkg]) => isPackageInstalled(pkg)).map(([pkg, imports]) => ({ [pkg]: imports })),
|
|
388
406
|
HybridlyImports
|
|
389
407
|
]
|
|
390
408
|
},
|
|
@@ -494,6 +512,34 @@ function getVueOptions(options) {
|
|
|
494
512
|
);
|
|
495
513
|
}
|
|
496
514
|
|
|
515
|
+
function killSwitch() {
|
|
516
|
+
let _enabled = false;
|
|
517
|
+
return {
|
|
518
|
+
name: "hybridly:build:kill-switch",
|
|
519
|
+
config: ({ mode }) => {
|
|
520
|
+
if (mode === "build") {
|
|
521
|
+
_enabled = true;
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
buildEnd: (error) => {
|
|
525
|
+
if (!_enabled) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
if (error) {
|
|
529
|
+
console.error("Error when bundling");
|
|
530
|
+
console.error(error);
|
|
531
|
+
process.exit(1);
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
closeBundle: () => {
|
|
535
|
+
if (!_enabled) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
process.exit(0);
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
|
|
497
543
|
async function plugin(options = {}) {
|
|
498
544
|
const config = await loadConfiguration(options);
|
|
499
545
|
return [
|
|
@@ -505,19 +551,7 @@ async function plugin(options = {}) {
|
|
|
505
551
|
options.autoImports !== false && autoimport__default(getAutoImportsOptions(options, config)),
|
|
506
552
|
options.icons !== false && icons__default(getIconsOptions(options, config)),
|
|
507
553
|
options.vue !== false && vue__default(getVueOptions(options)),
|
|
508
|
-
options.killSwitch !== false &&
|
|
509
|
-
// This plugin forces the process to exit, because it may
|
|
510
|
-
// hang in low-memory environments like CI or production
|
|
511
|
-
name: "hybridly:build:kill-switch",
|
|
512
|
-
buildEnd: (error) => {
|
|
513
|
-
if (error) {
|
|
514
|
-
console.error("Error when bundling");
|
|
515
|
-
console.error(error);
|
|
516
|
-
process.exit(1);
|
|
517
|
-
}
|
|
518
|
-
},
|
|
519
|
-
closeBundle: () => process.exit(0)
|
|
520
|
-
}
|
|
554
|
+
options.killSwitch !== false && killSwitch()
|
|
521
555
|
];
|
|
522
556
|
}
|
|
523
557
|
|
package/dist/index.d.cts
CHANGED
|
@@ -68,6 +68,8 @@ interface ViteOptions {
|
|
|
68
68
|
shims?: boolean;
|
|
69
69
|
/** Enables or disable the kill-switch. */
|
|
70
70
|
killSwitch?: boolean;
|
|
71
|
+
/** Extra `tsconfig.json` options. */
|
|
72
|
+
tsconfig?: TsConfigOptions;
|
|
71
73
|
}
|
|
72
74
|
interface LayoutOptions {
|
|
73
75
|
/** Custom RegExp for parsing the template string. */
|
|
@@ -75,6 +77,14 @@ interface LayoutOptions {
|
|
|
75
77
|
/** Name of the layout used when no argument is provided to `layout`. */
|
|
76
78
|
defaultLayoutName?: string;
|
|
77
79
|
}
|
|
80
|
+
interface TsConfigOptions {
|
|
81
|
+
/** Defines types to add to `tsconfig.json`. */
|
|
82
|
+
types?: string[];
|
|
83
|
+
/** Defines paths to include with `tsconfig.json`. */
|
|
84
|
+
include?: string[];
|
|
85
|
+
/** Defines paths to exclude with `tsconfig.json`. */
|
|
86
|
+
exclude?: string[];
|
|
87
|
+
}
|
|
78
88
|
|
|
79
89
|
declare const _default: (options: ViteOptions, config: DynamicConfiguration) => Plugin;
|
|
80
90
|
|
package/dist/index.d.mts
CHANGED
|
@@ -68,6 +68,8 @@ interface ViteOptions {
|
|
|
68
68
|
shims?: boolean;
|
|
69
69
|
/** Enables or disable the kill-switch. */
|
|
70
70
|
killSwitch?: boolean;
|
|
71
|
+
/** Extra `tsconfig.json` options. */
|
|
72
|
+
tsconfig?: TsConfigOptions;
|
|
71
73
|
}
|
|
72
74
|
interface LayoutOptions {
|
|
73
75
|
/** Custom RegExp for parsing the template string. */
|
|
@@ -75,6 +77,14 @@ interface LayoutOptions {
|
|
|
75
77
|
/** Name of the layout used when no argument is provided to `layout`. */
|
|
76
78
|
defaultLayoutName?: string;
|
|
77
79
|
}
|
|
80
|
+
interface TsConfigOptions {
|
|
81
|
+
/** Defines types to add to `tsconfig.json`. */
|
|
82
|
+
types?: string[];
|
|
83
|
+
/** Defines paths to include with `tsconfig.json`. */
|
|
84
|
+
include?: string[];
|
|
85
|
+
/** Defines paths to exclude with `tsconfig.json`. */
|
|
86
|
+
exclude?: string[];
|
|
87
|
+
}
|
|
78
88
|
|
|
79
89
|
declare const _default: (options: ViteOptions, config: DynamicConfiguration) => Plugin;
|
|
80
90
|
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ interface ViteOptions {
|
|
|
68
68
|
shims?: boolean;
|
|
69
69
|
/** Enables or disable the kill-switch. */
|
|
70
70
|
killSwitch?: boolean;
|
|
71
|
+
/** Extra `tsconfig.json` options. */
|
|
72
|
+
tsconfig?: TsConfigOptions;
|
|
71
73
|
}
|
|
72
74
|
interface LayoutOptions {
|
|
73
75
|
/** Custom RegExp for parsing the template string. */
|
|
@@ -75,6 +77,14 @@ interface LayoutOptions {
|
|
|
75
77
|
/** Name of the layout used when no argument is provided to `layout`. */
|
|
76
78
|
defaultLayoutName?: string;
|
|
77
79
|
}
|
|
80
|
+
interface TsConfigOptions {
|
|
81
|
+
/** Defines types to add to `tsconfig.json`. */
|
|
82
|
+
types?: string[];
|
|
83
|
+
/** Defines paths to include with `tsconfig.json`. */
|
|
84
|
+
include?: string[];
|
|
85
|
+
/** Defines paths to exclude with `tsconfig.json`. */
|
|
86
|
+
exclude?: string[];
|
|
87
|
+
}
|
|
78
88
|
|
|
79
89
|
declare const _default: (options: ViteOptions, config: DynamicConfiguration) => Plugin;
|
|
80
90
|
|
package/dist/index.mjs
CHANGED
|
@@ -50,7 +50,8 @@ function generateTsConfig(options, config) {
|
|
|
50
50
|
types: [
|
|
51
51
|
"vite/client",
|
|
52
52
|
"hybridly/client",
|
|
53
|
-
...options.icons !== false ? ["unplugin-icons/types/vue"] : []
|
|
53
|
+
...options.icons !== false ? ["unplugin-icons/types/vue"] : [],
|
|
54
|
+
...options.tsconfig?.types ?? []
|
|
54
55
|
],
|
|
55
56
|
baseUrl: "..",
|
|
56
57
|
paths: {
|
|
@@ -76,12 +77,14 @@ function generateTsConfig(options, config) {
|
|
|
76
77
|
"./global-types.d.ts",
|
|
77
78
|
"./routes.d.ts",
|
|
78
79
|
"./components.d.ts",
|
|
79
|
-
"./auto-imports.d.ts"
|
|
80
|
+
"./auto-imports.d.ts",
|
|
81
|
+
...options.tsconfig?.include ?? []
|
|
80
82
|
],
|
|
81
83
|
exclude: [
|
|
82
84
|
"../public/**/*",
|
|
83
85
|
"../node_modules",
|
|
84
|
-
"../vendor"
|
|
86
|
+
"../vendor",
|
|
87
|
+
...options.tsconfig?.exclude ?? []
|
|
85
88
|
]
|
|
86
89
|
};
|
|
87
90
|
write(JSON.stringify(tsconfig, null, 2), "tsconfig.json");
|
|
@@ -214,9 +217,9 @@ const initialize = (options, config) => {
|
|
|
214
217
|
}
|
|
215
218
|
if (/.*\.vue$/.test(file)) {
|
|
216
219
|
const updatedConfig = await loadConfiguration(options);
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
219
|
-
return await forceRestart("
|
|
220
|
+
const viewsOrLayoutsChanged = didViewsOrLayoutsChange(updatedConfig, config);
|
|
221
|
+
if (viewsOrLayoutsChanged) {
|
|
222
|
+
return await forceRestart("View or layout changed");
|
|
220
223
|
}
|
|
221
224
|
}
|
|
222
225
|
}
|
|
@@ -242,7 +245,7 @@ const initialize = (options, config) => {
|
|
|
242
245
|
}
|
|
243
246
|
};
|
|
244
247
|
};
|
|
245
|
-
function
|
|
248
|
+
function didViewsOrLayoutsChange(updatedConfig, previousConfig) {
|
|
246
249
|
if (!previousConfig) {
|
|
247
250
|
return false;
|
|
248
251
|
}
|
|
@@ -332,6 +335,8 @@ const HybridlyImports = {
|
|
|
332
335
|
"useProperty",
|
|
333
336
|
"setProperty",
|
|
334
337
|
"useRefinements",
|
|
338
|
+
"useTable",
|
|
339
|
+
"useBulkSelect",
|
|
335
340
|
"useProperties",
|
|
336
341
|
"useBackForward",
|
|
337
342
|
"useContext",
|
|
@@ -355,6 +360,18 @@ function getAutoImportsOptions(options, config) {
|
|
|
355
360
|
return;
|
|
356
361
|
}
|
|
357
362
|
const presets = ["@vueuse/core", "@vueuse/head", "vue-i18n"];
|
|
363
|
+
const custom = {
|
|
364
|
+
"@unhead/vue": [
|
|
365
|
+
"useHead",
|
|
366
|
+
"useSeoMeta"
|
|
367
|
+
],
|
|
368
|
+
"@innocenzi/utils": [
|
|
369
|
+
"match",
|
|
370
|
+
"invoke",
|
|
371
|
+
"batchInvoke",
|
|
372
|
+
"asyncInvoke"
|
|
373
|
+
]
|
|
374
|
+
};
|
|
358
375
|
return merge(
|
|
359
376
|
{
|
|
360
377
|
vueTemplate: true,
|
|
@@ -368,6 +385,7 @@ function getAutoImportsOptions(options, config) {
|
|
|
368
385
|
"vue",
|
|
369
386
|
"vue/macros",
|
|
370
387
|
...presets.filter((pkg) => isPackageInstalled(pkg)),
|
|
388
|
+
...Object.entries(custom).filter(([pkg]) => isPackageInstalled(pkg)).map(([pkg, imports]) => ({ [pkg]: imports })),
|
|
371
389
|
HybridlyImports
|
|
372
390
|
]
|
|
373
391
|
},
|
|
@@ -477,6 +495,34 @@ function getVueOptions(options) {
|
|
|
477
495
|
);
|
|
478
496
|
}
|
|
479
497
|
|
|
498
|
+
function killSwitch() {
|
|
499
|
+
let _enabled = false;
|
|
500
|
+
return {
|
|
501
|
+
name: "hybridly:build:kill-switch",
|
|
502
|
+
config: ({ mode }) => {
|
|
503
|
+
if (mode === "build") {
|
|
504
|
+
_enabled = true;
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
buildEnd: (error) => {
|
|
508
|
+
if (!_enabled) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (error) {
|
|
512
|
+
console.error("Error when bundling");
|
|
513
|
+
console.error(error);
|
|
514
|
+
process.exit(1);
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
closeBundle: () => {
|
|
518
|
+
if (!_enabled) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
process.exit(0);
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
480
526
|
async function plugin(options = {}) {
|
|
481
527
|
const config = await loadConfiguration(options);
|
|
482
528
|
return [
|
|
@@ -488,19 +534,7 @@ async function plugin(options = {}) {
|
|
|
488
534
|
options.autoImports !== false && autoimport(getAutoImportsOptions(options, config)),
|
|
489
535
|
options.icons !== false && icons(getIconsOptions(options, config)),
|
|
490
536
|
options.vue !== false && vue(getVueOptions(options)),
|
|
491
|
-
options.killSwitch !== false &&
|
|
492
|
-
// This plugin forces the process to exit, because it may
|
|
493
|
-
// hang in low-memory environments like CI or production
|
|
494
|
-
name: "hybridly:build:kill-switch",
|
|
495
|
-
buildEnd: (error) => {
|
|
496
|
-
if (error) {
|
|
497
|
-
console.error("Error when bundling");
|
|
498
|
-
console.error(error);
|
|
499
|
-
process.exit(1);
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
closeBundle: () => process.exit(0)
|
|
503
|
-
}
|
|
537
|
+
options.killSwitch !== false && killSwitch()
|
|
504
538
|
];
|
|
505
539
|
}
|
|
506
540
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridly/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Vite plugin for Hybridly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hybridly",
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@vitejs/plugin-vue": "^4.3.4",
|
|
44
44
|
"fast-glob": "^3.3.1",
|
|
45
|
-
"laravel-vite-plugin": "^0.8.
|
|
45
|
+
"laravel-vite-plugin": "^0.8.1",
|
|
46
46
|
"local-pkg": "^0.4.3",
|
|
47
47
|
"throttle-debounce": "^5.0.0",
|
|
48
48
|
"unplugin-auto-import": "^0.16.6",
|
|
49
|
-
"unplugin-icons": "^0.
|
|
49
|
+
"unplugin-icons": "^0.17.0",
|
|
50
50
|
"unplugin-vue-components": "^0.25.2",
|
|
51
51
|
"vite-plugin-run": "^0.5.1",
|
|
52
|
-
"@hybridly/core": "0.
|
|
52
|
+
"@hybridly/core": "0.5.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@iconify/json": "^2.2.
|
|
56
|
-
"rollup": "^3.29.
|
|
55
|
+
"@iconify/json": "^2.2.120",
|
|
56
|
+
"rollup": "^3.29.3",
|
|
57
57
|
"vite": "^4.4.9",
|
|
58
58
|
"vue": "^3.3.4"
|
|
59
59
|
},
|