@hybridly/vite 0.4.5 → 0.5.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 CHANGED
@@ -231,9 +231,9 @@ const initialize = (options, config) => {
231
231
  }
232
232
  if (/.*\.vue$/.test(file)) {
233
233
  const updatedConfig = await loadConfiguration(options);
234
- const pagesOrLayoutsChanged = didPagesOrLayoutsChange(updatedConfig, config);
235
- if (pagesOrLayoutsChanged) {
236
- return await forceRestart("Page or layout changed");
234
+ const viewsOrLayoutsChanged = didViewsOrLayoutsChange(updatedConfig, config);
235
+ if (viewsOrLayoutsChanged) {
236
+ return await forceRestart("View or layout changed");
237
237
  }
238
238
  }
239
239
  }
@@ -259,7 +259,7 @@ const initialize = (options, config) => {
259
259
  }
260
260
  };
261
261
  };
262
- function didPagesOrLayoutsChange(updatedConfig, previousConfig) {
262
+ function didViewsOrLayoutsChange(updatedConfig, previousConfig) {
263
263
  if (!previousConfig) {
264
264
  return false;
265
265
  }
@@ -349,6 +349,8 @@ const HybridlyImports = {
349
349
  "useProperty",
350
350
  "setProperty",
351
351
  "useRefinements",
352
+ "useTable",
353
+ "useBulkSelect",
352
354
  "useProperties",
353
355
  "useBackForward",
354
356
  "useContext",
@@ -372,6 +374,18 @@ function getAutoImportsOptions(options, config) {
372
374
  return;
373
375
  }
374
376
  const presets = ["@vueuse/core", "@vueuse/head", "vue-i18n"];
377
+ const custom = {
378
+ "@unhead/vue": [
379
+ "useHead",
380
+ "useSeoMeta"
381
+ ],
382
+ "@innocenzi/utils": [
383
+ "match",
384
+ "invoke",
385
+ "batchInvoke",
386
+ "asyncInvoke"
387
+ ]
388
+ };
375
389
  return utils.merge(
376
390
  {
377
391
  vueTemplate: true,
@@ -385,6 +399,7 @@ function getAutoImportsOptions(options, config) {
385
399
  "vue",
386
400
  "vue/macros",
387
401
  ...presets.filter((pkg) => isPackageInstalled(pkg)),
402
+ ...Object.entries(custom).filter(([pkg]) => isPackageInstalled(pkg)).map(([pkg, imports]) => ({ [pkg]: imports })),
388
403
  HybridlyImports
389
404
  ]
390
405
  },
@@ -494,6 +509,34 @@ function getVueOptions(options) {
494
509
  );
495
510
  }
496
511
 
512
+ function killSwitch() {
513
+ let _enabled = false;
514
+ return {
515
+ name: "hybridly:build:kill-switch",
516
+ config: ({ mode }) => {
517
+ if (mode === "build") {
518
+ _enabled = true;
519
+ }
520
+ },
521
+ buildEnd: (error) => {
522
+ if (!_enabled) {
523
+ return;
524
+ }
525
+ if (error) {
526
+ console.error("Error when bundling");
527
+ console.error(error);
528
+ process.exit(1);
529
+ }
530
+ },
531
+ closeBundle: () => {
532
+ if (!_enabled) {
533
+ return;
534
+ }
535
+ process.exit(0);
536
+ }
537
+ };
538
+ }
539
+
497
540
  async function plugin(options = {}) {
498
541
  const config = await loadConfiguration(options);
499
542
  return [
@@ -505,19 +548,7 @@ async function plugin(options = {}) {
505
548
  options.autoImports !== false && autoimport__default(getAutoImportsOptions(options, config)),
506
549
  options.icons !== false && icons__default(getIconsOptions(options, config)),
507
550
  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
- }
551
+ options.killSwitch !== false && killSwitch()
521
552
  ];
522
553
  }
523
554
 
package/dist/index.mjs CHANGED
@@ -214,9 +214,9 @@ const initialize = (options, config) => {
214
214
  }
215
215
  if (/.*\.vue$/.test(file)) {
216
216
  const updatedConfig = await loadConfiguration(options);
217
- const pagesOrLayoutsChanged = didPagesOrLayoutsChange(updatedConfig, config);
218
- if (pagesOrLayoutsChanged) {
219
- return await forceRestart("Page or layout changed");
217
+ const viewsOrLayoutsChanged = didViewsOrLayoutsChange(updatedConfig, config);
218
+ if (viewsOrLayoutsChanged) {
219
+ return await forceRestart("View or layout changed");
220
220
  }
221
221
  }
222
222
  }
@@ -242,7 +242,7 @@ const initialize = (options, config) => {
242
242
  }
243
243
  };
244
244
  };
245
- function didPagesOrLayoutsChange(updatedConfig, previousConfig) {
245
+ function didViewsOrLayoutsChange(updatedConfig, previousConfig) {
246
246
  if (!previousConfig) {
247
247
  return false;
248
248
  }
@@ -332,6 +332,8 @@ const HybridlyImports = {
332
332
  "useProperty",
333
333
  "setProperty",
334
334
  "useRefinements",
335
+ "useTable",
336
+ "useBulkSelect",
335
337
  "useProperties",
336
338
  "useBackForward",
337
339
  "useContext",
@@ -355,6 +357,18 @@ function getAutoImportsOptions(options, config) {
355
357
  return;
356
358
  }
357
359
  const presets = ["@vueuse/core", "@vueuse/head", "vue-i18n"];
360
+ const custom = {
361
+ "@unhead/vue": [
362
+ "useHead",
363
+ "useSeoMeta"
364
+ ],
365
+ "@innocenzi/utils": [
366
+ "match",
367
+ "invoke",
368
+ "batchInvoke",
369
+ "asyncInvoke"
370
+ ]
371
+ };
358
372
  return merge(
359
373
  {
360
374
  vueTemplate: true,
@@ -368,6 +382,7 @@ function getAutoImportsOptions(options, config) {
368
382
  "vue",
369
383
  "vue/macros",
370
384
  ...presets.filter((pkg) => isPackageInstalled(pkg)),
385
+ ...Object.entries(custom).filter(([pkg]) => isPackageInstalled(pkg)).map(([pkg, imports]) => ({ [pkg]: imports })),
371
386
  HybridlyImports
372
387
  ]
373
388
  },
@@ -477,6 +492,34 @@ function getVueOptions(options) {
477
492
  );
478
493
  }
479
494
 
495
+ function killSwitch() {
496
+ let _enabled = false;
497
+ return {
498
+ name: "hybridly:build:kill-switch",
499
+ config: ({ mode }) => {
500
+ if (mode === "build") {
501
+ _enabled = true;
502
+ }
503
+ },
504
+ buildEnd: (error) => {
505
+ if (!_enabled) {
506
+ return;
507
+ }
508
+ if (error) {
509
+ console.error("Error when bundling");
510
+ console.error(error);
511
+ process.exit(1);
512
+ }
513
+ },
514
+ closeBundle: () => {
515
+ if (!_enabled) {
516
+ return;
517
+ }
518
+ process.exit(0);
519
+ }
520
+ };
521
+ }
522
+
480
523
  async function plugin(options = {}) {
481
524
  const config = await loadConfiguration(options);
482
525
  return [
@@ -488,19 +531,7 @@ async function plugin(options = {}) {
488
531
  options.autoImports !== false && autoimport(getAutoImportsOptions(options, config)),
489
532
  options.icons !== false && icons(getIconsOptions(options, config)),
490
533
  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
- }
534
+ options.killSwitch !== false && killSwitch()
504
535
  ];
505
536
  }
506
537
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hybridly/vite",
3
- "version": "0.4.5",
3
+ "version": "0.5.0",
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.0",
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.16.6",
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.4.5"
52
+ "@hybridly/core": "0.5.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@iconify/json": "^2.2.115",
56
- "rollup": "^3.29.1",
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
  },