@promoboxx/react-scripts-vite 0.1.27 → 0.1.28

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/cli.js CHANGED
@@ -1,27 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
15
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
16
- if (ar || !(i in from)) {
17
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
18
- ar[i] = from[i];
19
- }
20
- }
21
- return to.concat(ar || Array.prototype.slice.call(from));
22
- };
23
3
  Object.defineProperty(exports, "__esModule", { value: true });
24
- var child_process_1 = require("child_process");
4
+ const child_process_1 = require("child_process");
25
5
  function main(command, args) {
26
6
  switch (command) {
27
7
  case 'start':
@@ -33,29 +13,31 @@ function main(command, args) {
33
13
  spawnAndExit('./node_modules/.bin/vitest', args, { NODE_ENV: 'test' });
34
14
  break;
35
15
  case 'build':
36
- spawnAndExit('./node_modules/.bin/vite', __spreadArray(['build'], args, true), {
16
+ spawnAndExit('./node_modules/.bin/vite', ['build', ...args], {
37
17
  NODE_ENV: 'production',
38
18
  });
39
19
  break;
40
20
  default:
41
- throw new Error("Unknown command: ".concat(command));
21
+ throw new Error(`Unknown command: ${command}`);
42
22
  }
43
23
  }
44
- function spawnAndExit(command, args, env) {
45
- if (args === void 0) { args = []; }
46
- var child = (0, child_process_1.spawn)(command, args, {
24
+ function spawnAndExit(command, args = [], env) {
25
+ const child = (0, child_process_1.spawn)(command, args, {
47
26
  stdio: 'inherit',
48
- env: __assign(__assign({}, process.env), env),
27
+ env: {
28
+ ...process.env,
29
+ ...env,
30
+ },
49
31
  // shell: true,
50
32
  });
51
- child.on('exit', function (code) {
52
- process.exit(code !== null && code !== void 0 ? code : undefined);
33
+ child.on('exit', (code) => {
34
+ process.exit(code ?? undefined);
53
35
  });
54
36
  }
55
- var _a = process.argv,
37
+ const [
56
38
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
57
- _interpreter = _a[0],
39
+ _interpreter,
58
40
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
59
- _thisFile = _a[1], command = _a[2], args = _a.slice(3);
41
+ _thisFile, command, ...args] = process.argv;
60
42
  main(command, args);
61
43
  //# sourceMappingURL=cli.js.map
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  * @see https://vitejs.dev/guide/api-plugin.html#transformindexhtml
7
7
  */
8
8
  function replaceEnvInHtml() {
9
- var config = undefined;
10
- var plugin = {
9
+ let config = undefined;
10
+ const plugin = {
11
11
  name: 'replace-env-in-html',
12
- configResolved: function (resolvedConfig) {
12
+ configResolved(resolvedConfig) {
13
13
  config = resolvedConfig;
14
14
  },
15
15
  transformIndexHtml: {
16
16
  enforce: 'pre',
17
- transform: function (html) {
18
- return html.replace(/%(.*?)%/g, function (match, envVarName) { var _a, _b; return (_b = (_a = config === null || config === void 0 ? void 0 : config.env) === null || _a === void 0 ? void 0 : _a[envVarName]) !== null && _b !== void 0 ? _b : match; });
17
+ transform(html) {
18
+ return html.replace(/%(.*?)%/g, (match, envVarName) => config?.env?.[envVarName] ?? match);
19
19
  },
20
20
  },
21
21
  };
@@ -1,34 +1,23 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
5
  Object.defineProperty(exports, "__esModule", { value: true });
17
6
  exports.pluginOptions = void 0;
18
- var fs_1 = __importDefault(require("fs"));
19
- var plugin_react_1 = __importDefault(require("@vitejs/plugin-react"));
20
- var vite_plugin_checker_1 = __importDefault(require("vite-plugin-checker"));
21
- var vite_plugin_env_compatible_1 = __importDefault(require("vite-plugin-env-compatible"));
22
- var vite_plugin_pwa_1 = require("vite-plugin-pwa");
23
- var vite_plugin_svgr_1 = __importDefault(require("vite-plugin-svgr"));
24
- var vite_tsconfig_paths_1 = __importDefault(require("vite-tsconfig-paths"));
25
- var replaceEnvInHtml_1 = __importDefault(require("./replaceEnvInHtml"));
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const plugin_react_1 = __importDefault(require("@vitejs/plugin-react"));
9
+ const vite_plugin_checker_1 = __importDefault(require("vite-plugin-checker"));
10
+ const vite_plugin_env_compatible_1 = __importDefault(require("vite-plugin-env-compatible"));
11
+ const vite_plugin_pwa_1 = require("vite-plugin-pwa");
12
+ const vite_plugin_svgr_1 = __importDefault(require("vite-plugin-svgr"));
13
+ const vite_tsconfig_paths_1 = __importDefault(require("vite-tsconfig-paths"));
14
+ const replaceEnvInHtml_1 = __importDefault(require("./replaceEnvInHtml"));
26
15
  exports.pluginOptions = {
27
16
  checker: {
28
17
  eslint: process.env.DISABLE_ESLINT_PLUGIN === 'true'
29
18
  ? undefined
30
19
  : {
31
- lintCommand: "eslint --max-warnings=".concat(process.env.CI === 'true' ? 0 : -1, " \"./src/**/*.{ts,tsx,js,jsx,mjs,cjs}\""),
20
+ lintCommand: `eslint --max-warnings=${process.env.CI === 'true' ? 0 : -1} "./src/**/*.{ts,tsx,js,jsx,mjs,cjs}"`,
32
21
  },
33
22
  typescript: process.env.TSC_COMPILE_ON_ERROR !== 'true',
34
23
  enableBuild: true,
@@ -38,10 +27,13 @@ exports.pluginOptions = {
38
27
  jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === 'true' ? 'classic' : undefined,
39
28
  },
40
29
  };
41
- var viteConfig = function () {
42
- var ENV_PREFIX = exports.pluginOptions.envPrefix || 'REACT_APP_';
30
+ const viteConfig = () => {
31
+ const ENV_PREFIX = exports.pluginOptions.envPrefix || 'REACT_APP_';
43
32
  if (exports.pluginOptions.envCompatible !== false) {
44
- exports.pluginOptions.envCompatible = __assign({ prefix: ENV_PREFIX }, exports.pluginOptions.envCompatible);
33
+ exports.pluginOptions.envCompatible = {
34
+ prefix: ENV_PREFIX,
35
+ ...exports.pluginOptions.envCompatible,
36
+ };
45
37
  }
46
38
  return {
47
39
  base: process.env.PUBLIC_URL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promoboxx/react-scripts-vite",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [],
@@ -15,20 +15,20 @@
15
15
  "license": "ISC",
16
16
  "devDependencies": {
17
17
  "@promoboxx/eslint-config": "^2.5.0",
18
- "prettier": "^2.7.1",
19
- "typescript": "^4.8.3"
18
+ "prettier": "^2.8.8",
19
+ "typescript": "^5.1.6"
20
20
  },
21
21
  "dependencies": {
22
- "@vitejs/plugin-react": "^2.1.0",
22
+ "@vitejs/plugin-react": "^3.1.0",
23
23
  "eslint": "^7.32.0",
24
- "jsdom": "^20.0.0",
25
- "vite": "^3.1.0",
26
- "vite-plugin-checker": "^0.4.9",
24
+ "jsdom": "^22.1.0",
25
+ "vite": "^4.3.9",
26
+ "vite-plugin-checker": "^0.6.1",
27
27
  "vite-plugin-env-compatible": "^1.1.1",
28
- "vite-plugin-pwa": "^0.12.7",
29
- "vite-plugin-svgr": "^2.2.1",
30
- "vite-tsconfig-paths": "^3.5.0",
31
- "vitest": "^0.23.2"
28
+ "vite-plugin-pwa": "^0.16.4",
29
+ "vite-plugin-svgr": "^3.2.0",
30
+ "vite-tsconfig-paths": "^4.2.0",
31
+ "vitest": "^0.32.2"
32
32
  },
33
33
  "files": [
34
34
  "dist/cli.d.ts",