@hybridly/vite 0.4.4 → 0.4.5

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
@@ -7,7 +7,6 @@ const path = require('node:path');
7
7
  const fs = require('node:fs');
8
8
  const makeDebugger = require('debug');
9
9
  const localPkg = require('local-pkg');
10
- const node_util = require('node:util');
11
10
  const node_child_process = require('node:child_process');
12
11
  const run = require('vite-plugin-run');
13
12
  const utils = require('@hybridly/utils');
@@ -68,7 +67,7 @@ function generateTsConfig(options, config) {
68
67
  types: [
69
68
  "vite/client",
70
69
  "hybridly/client",
71
- ...options.icons !== false && isPackageInstalled("unplugin-icons") ? ["unplugin-icons/types/vue"] : []
70
+ ...options.icons !== false ? ["unplugin-icons/types/vue"] : []
72
71
  ],
73
72
  baseUrl: "..",
74
73
  paths: {
@@ -166,12 +165,11 @@ function write(data, filename) {
166
165
  });
167
166
  }
168
167
 
169
- const shell = node_util.promisify(node_child_process.exec);
170
168
  async function loadConfiguration(options) {
171
169
  try {
172
170
  const php = options.php ?? process.env.PHP_EXECUTABLE_PATH ?? "php";
173
- const { stdout } = await shell(`${php} artisan hybridly:config`);
174
- return JSON.parse(stdout);
171
+ const stdout = node_child_process.execSync(`${php} artisan hybridly:config`);
172
+ return JSON.parse(stdout.toString("utf-8"));
175
173
  } catch (e) {
176
174
  console.error("Could not load configuration from [php artisan].");
177
175
  throw e;
@@ -506,7 +504,20 @@ async function plugin(options = {}) {
506
504
  options.vueComponents !== false && vueComponents__default(getVueComponentsOptions(options, config)),
507
505
  options.autoImports !== false && autoimport__default(getAutoImportsOptions(options, config)),
508
506
  options.icons !== false && icons__default(getIconsOptions(options, config)),
509
- options.vue !== false && vue__default(getVueOptions(options))
507
+ 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
+ }
510
521
  ];
511
522
  }
512
523
 
package/dist/index.d.cts CHANGED
@@ -66,6 +66,8 @@ interface ViteOptions {
66
66
  overrideResolvers?: CustomResolvers;
67
67
  /** Whether to write shims. */
68
68
  shims?: boolean;
69
+ /** Enables or disable the kill-switch. */
70
+ killSwitch?: boolean;
69
71
  }
70
72
  interface LayoutOptions {
71
73
  /** Custom RegExp for parsing the template string. */
package/dist/index.d.mts CHANGED
@@ -66,6 +66,8 @@ interface ViteOptions {
66
66
  overrideResolvers?: CustomResolvers;
67
67
  /** Whether to write shims. */
68
68
  shims?: boolean;
69
+ /** Enables or disable the kill-switch. */
70
+ killSwitch?: boolean;
69
71
  }
70
72
  interface LayoutOptions {
71
73
  /** Custom RegExp for parsing the template string. */
package/dist/index.d.ts CHANGED
@@ -66,6 +66,8 @@ interface ViteOptions {
66
66
  overrideResolvers?: CustomResolvers;
67
67
  /** Whether to write shims. */
68
68
  shims?: boolean;
69
+ /** Enables or disable the kill-switch. */
70
+ killSwitch?: boolean;
69
71
  }
70
72
  interface LayoutOptions {
71
73
  /** Custom RegExp for parsing the template string. */
package/dist/index.mjs CHANGED
@@ -3,8 +3,7 @@ import path from 'node:path';
3
3
  import fs from 'node:fs';
4
4
  import makeDebugger from 'debug';
5
5
  import { isPackageExists } from 'local-pkg';
6
- import { promisify } from 'node:util';
7
- import { exec } from 'node:child_process';
6
+ import { execSync } from 'node:child_process';
8
7
  import run from 'vite-plugin-run';
9
8
  import { merge } from '@hybridly/utils';
10
9
  import autoimport from 'unplugin-auto-import/vite';
@@ -51,7 +50,7 @@ function generateTsConfig(options, config) {
51
50
  types: [
52
51
  "vite/client",
53
52
  "hybridly/client",
54
- ...options.icons !== false && isPackageInstalled("unplugin-icons") ? ["unplugin-icons/types/vue"] : []
53
+ ...options.icons !== false ? ["unplugin-icons/types/vue"] : []
55
54
  ],
56
55
  baseUrl: "..",
57
56
  paths: {
@@ -149,12 +148,11 @@ function write(data, filename) {
149
148
  });
150
149
  }
151
150
 
152
- const shell = promisify(exec);
153
151
  async function loadConfiguration(options) {
154
152
  try {
155
153
  const php = options.php ?? process.env.PHP_EXECUTABLE_PATH ?? "php";
156
- const { stdout } = await shell(`${php} artisan hybridly:config`);
157
- return JSON.parse(stdout);
154
+ const stdout = execSync(`${php} artisan hybridly:config`);
155
+ return JSON.parse(stdout.toString("utf-8"));
158
156
  } catch (e) {
159
157
  console.error("Could not load configuration from [php artisan].");
160
158
  throw e;
@@ -489,7 +487,20 @@ async function plugin(options = {}) {
489
487
  options.vueComponents !== false && vueComponents(getVueComponentsOptions(options, config)),
490
488
  options.autoImports !== false && autoimport(getAutoImportsOptions(options, config)),
491
489
  options.icons !== false && icons(getIconsOptions(options, config)),
492
- options.vue !== false && vue(getVueOptions(options))
490
+ 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
+ }
493
504
  ];
494
505
  }
495
506
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hybridly/vite",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Vite plugin for Hybridly",
5
5
  "keywords": [
6
6
  "hybridly",
@@ -40,20 +40,20 @@
40
40
  "vue": "^3.2.45"
41
41
  },
42
42
  "dependencies": {
43
- "@vitejs/plugin-vue": "^4.3.3",
43
+ "@vitejs/plugin-vue": "^4.3.4",
44
44
  "fast-glob": "^3.3.1",
45
45
  "laravel-vite-plugin": "^0.8.0",
46
46
  "local-pkg": "^0.4.3",
47
47
  "throttle-debounce": "^5.0.0",
48
48
  "unplugin-auto-import": "^0.16.6",
49
49
  "unplugin-icons": "^0.16.6",
50
- "unplugin-vue-components": "^0.25.1",
51
- "vite-plugin-run": "^0.4.1",
52
- "@hybridly/core": "0.4.4"
50
+ "unplugin-vue-components": "^0.25.2",
51
+ "vite-plugin-run": "^0.5.1",
52
+ "@hybridly/core": "0.4.5"
53
53
  },
54
54
  "devDependencies": {
55
- "@iconify/json": "^2.2.107",
56
- "rollup": "^3.28.1",
55
+ "@iconify/json": "^2.2.115",
56
+ "rollup": "^3.29.1",
57
57
  "vite": "^4.4.9",
58
58
  "vue": "^3.3.4"
59
59
  },