@promoboxx/react-scripts-vite 0.2.5 → 0.2.7

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.
@@ -1,5 +1,6 @@
1
1
  export { pluginOptions, default as viteConfig } from './viteConfig.js';
2
2
  import '@vitejs/plugin-react';
3
+ import 'rollup';
3
4
  import 'vite';
4
5
  import 'vite-plugin-checker';
5
6
  import 'vite-plugin-environment';
package/dist/cjs/index.js CHANGED
@@ -28,12 +28,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  pluginOptions: () => import_viteConfig.pluginOptions,
34
34
  viteConfig: () => import_viteConfig.default
35
35
  });
36
- module.exports = __toCommonJS(src_exports);
36
+ module.exports = __toCommonJS(index_exports);
37
37
  var import_viteConfig = __toESM(require("./viteConfig"));
38
38
  // Annotate the CommonJS export names for ESM import in node:
39
39
  0 && (module.exports = {
@@ -0,0 +1,5 @@
1
+ import { GetManualChunk } from 'rollup';
2
+
3
+ declare const splitVendorManualChunks: GetManualChunk;
4
+
5
+ export = splitVendorManualChunks;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/splitVendorManualChunks.ts
21
+ var splitVendorManualChunks_exports = {};
22
+ __export(splitVendorManualChunks_exports, {
23
+ default: () => splitVendorManualChunks_default
24
+ });
25
+ module.exports = __toCommonJS(splitVendorManualChunks_exports);
26
+ var splitVendorManualChunks = (id) => {
27
+ if (id.includes("node_modules")) {
28
+ return "vendor";
29
+ }
30
+ };
31
+ var splitVendorManualChunks_default = splitVendorManualChunks;
@@ -1,4 +1,5 @@
1
1
  import react from '@vitejs/plugin-react';
2
+ import { ManualChunksOption } from 'rollup';
2
3
  import { UserConfigFn } from 'vite';
3
4
  import pluginChecker from 'vite-plugin-checker';
4
5
  import envCompatible from 'vite-plugin-environment';
@@ -13,9 +14,11 @@ interface ReactScriptsViteOptions {
13
14
  pwa?: false | Parameters<typeof VitePWA>[0];
14
15
  checker?: false | Parameters<typeof pluginChecker>[0];
15
16
  envPrefix?: string;
16
- splitVendorChunkPlugin?: false;
17
+ splitVendorChunkPlugin?: boolean | ManualChunksOption;
17
18
  }
18
19
  declare const pluginOptions: ReactScriptsViteOptions;
19
20
  declare const viteConfig: UserConfigFn;
20
21
 
21
- export { viteConfig as default, pluginOptions };
22
+ // @ts-ignore
23
+ export = viteConfig;
24
+ export { pluginOptions };
@@ -11,9 +11,9 @@ var __export = (target, all) => {
11
11
  };
12
12
  var __copyProps = (to, from, except, desc) => {
13
13
  if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ for (let key2 of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key2) && key2 !== except)
16
+ __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
17
17
  }
18
18
  return to;
19
19
  };
@@ -37,16 +37,19 @@ module.exports = __toCommonJS(viteConfig_exports);
37
37
  var import_fs = __toESM(require("fs"));
38
38
  var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
39
39
  var import_alias_hq = __toESM(require("alias-hq"));
40
- var import_vite = require("vite");
41
40
  var import_vite_plugin_checker = __toESM(require("vite-plugin-checker"));
42
41
  var import_vite_plugin_environment = __toESM(require("vite-plugin-environment"));
43
42
  var import_vite_plugin_pwa = require("vite-plugin-pwa");
44
43
  var import_vite_plugin_svgr = __toESM(require("vite-plugin-svgr"));
45
44
  var import_replaceEnvInHtml = __toESM(require("./replaceEnvInHtml"));
45
+ var import_splitVendorManualChunks = __toESM(require("./splitVendorManualChunks"));
46
+ var cert = process.env.SSL_CRT_FILE ? import_fs.default.readFileSync(process.env.SSL_CRT_FILE) : void 0;
47
+ var key = process.env.SSL_KEY_FILE ? import_fs.default.readFileSync(process.env.SSL_KEY_FILE) : void 0;
46
48
  var pluginOptions = {
47
49
  checker: {
48
50
  eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
49
- lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`
51
+ lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`,
52
+ useFlatConfig: import_fs.default.existsSync("eslint.config.js")
50
53
  },
51
54
  typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
52
55
  enableBuild: true,
@@ -83,11 +86,16 @@ var pluginOptions = {
83
86
  },
84
87
  // Finally, remove dimensions, and more importantly, set a viewBox if
85
88
  // it doesn't exist.
86
- "removeDimensions"
89
+ "removeDimensions",
90
+ // Since we're setting custom SVGR/SVGO options, we miss out on any
91
+ // defaults specified there.
92
+ // https://github.com/gregberge/svgr/blob/6b329ac8b9f045ef56ba0020ef4d90c2f3080287/packages/plugin-svgo/src/config.ts#L32-L38
93
+ "prefixIds"
87
94
  ]
88
95
  }
89
96
  }
90
- }
97
+ },
98
+ splitVendorChunkPlugin: true
91
99
  };
92
100
  var viteConfig = () => {
93
101
  const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
@@ -103,7 +111,12 @@ var viteConfig = () => {
103
111
  build: {
104
112
  outDir: process.env.BUILD_PATH || "build",
105
113
  sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
106
- assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4
114
+ assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4,
115
+ rollupOptions: {
116
+ output: {
117
+ manualChunks: pluginOptions.splitVendorChunkPlugin === false ? void 0 : pluginOptions.splitVendorChunkPlugin === true ? import_splitVendorManualChunks.default : pluginOptions.splitVendorChunkPlugin
118
+ }
119
+ }
107
120
  },
108
121
  plugins: [
109
122
  // Replace %ENVIRONMENT_VARIABLES% in .html files
@@ -116,16 +129,21 @@ var viteConfig = () => {
116
129
  // PWA.
117
130
  pluginOptions.pwa === false ? null : (0, import_vite_plugin_pwa.VitePWA)(pluginOptions.pwa),
118
131
  // Check for issues.
119
- process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker || {}),
120
- pluginOptions.splitVendorChunkPlugin === false ? null : (0, import_vite.splitVendorChunkPlugin)()
132
+ process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker || {})
121
133
  ],
122
134
  server: {
123
135
  open: true,
124
136
  host: process.env.HOST || "0.0.0.0",
125
137
  port: process.env.PORT ? Number(process.env.PORT) : 3e3,
126
138
  https: process.env.HTTPS === "true" ? {
127
- cert: process.env.SSL_CRT_FILE ? import_fs.default.readFileSync(process.env.SSL_CRT_FILE) : void 0,
128
- key: process.env.SSL_KEY_FILE ? import_fs.default.readFileSync(process.env.SSL_KEY_FILE) : void 0
139
+ cert,
140
+ key
141
+ } : void 0
142
+ },
143
+ preview: {
144
+ https: process.env.HTTPS === "true" ? {
145
+ cert,
146
+ key
129
147
  } : void 0
130
148
  },
131
149
  test: {
@@ -1,5 +1,6 @@
1
1
  export { pluginOptions, default as viteConfig } from './viteConfig.mjs';
2
2
  import '@vitejs/plugin-react';
3
+ import 'rollup';
3
4
  import 'vite';
4
5
  import 'vite-plugin-checker';
5
6
  import 'vite-plugin-environment';
@@ -0,0 +1,5 @@
1
+ import { GetManualChunk } from 'rollup';
2
+
3
+ declare const splitVendorManualChunks: GetManualChunk;
4
+
5
+ export { splitVendorManualChunks as default };
@@ -0,0 +1,10 @@
1
+ // src/splitVendorManualChunks.ts
2
+ var splitVendorManualChunks = (id) => {
3
+ if (id.includes("node_modules")) {
4
+ return "vendor";
5
+ }
6
+ };
7
+ var splitVendorManualChunks_default = splitVendorManualChunks;
8
+ export {
9
+ splitVendorManualChunks_default as default
10
+ };
@@ -1,4 +1,5 @@
1
1
  import react from '@vitejs/plugin-react';
2
+ import { ManualChunksOption } from 'rollup';
2
3
  import { UserConfigFn } from 'vite';
3
4
  import pluginChecker from 'vite-plugin-checker';
4
5
  import envCompatible from 'vite-plugin-environment';
@@ -13,7 +14,7 @@ interface ReactScriptsViteOptions {
13
14
  pwa?: false | Parameters<typeof VitePWA>[0];
14
15
  checker?: false | Parameters<typeof pluginChecker>[0];
15
16
  envPrefix?: string;
16
- splitVendorChunkPlugin?: false;
17
+ splitVendorChunkPlugin?: boolean | ManualChunksOption;
17
18
  }
18
19
  declare const pluginOptions: ReactScriptsViteOptions;
19
20
  declare const viteConfig: UserConfigFn;
@@ -2,16 +2,19 @@
2
2
  import fs from "fs";
3
3
  import react from "@vitejs/plugin-react";
4
4
  import aliasHq from "alias-hq";
5
- import { splitVendorChunkPlugin } from "vite";
6
5
  import pluginChecker from "vite-plugin-checker";
7
6
  import envCompatible from "vite-plugin-environment";
8
7
  import { VitePWA } from "vite-plugin-pwa";
9
8
  import svgr from "vite-plugin-svgr";
10
9
  import replaceEnvInHtml from "./replaceEnvInHtml.mjs";
10
+ import splitVendorManualChunks from "./splitVendorManualChunks.mjs";
11
+ var cert = process.env.SSL_CRT_FILE ? fs.readFileSync(process.env.SSL_CRT_FILE) : void 0;
12
+ var key = process.env.SSL_KEY_FILE ? fs.readFileSync(process.env.SSL_KEY_FILE) : void 0;
11
13
  var pluginOptions = {
12
14
  checker: {
13
15
  eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
14
- lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`
16
+ lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`,
17
+ useFlatConfig: fs.existsSync("eslint.config.js")
15
18
  },
16
19
  typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
17
20
  enableBuild: true,
@@ -48,11 +51,16 @@ var pluginOptions = {
48
51
  },
49
52
  // Finally, remove dimensions, and more importantly, set a viewBox if
50
53
  // it doesn't exist.
51
- "removeDimensions"
54
+ "removeDimensions",
55
+ // Since we're setting custom SVGR/SVGO options, we miss out on any
56
+ // defaults specified there.
57
+ // https://github.com/gregberge/svgr/blob/6b329ac8b9f045ef56ba0020ef4d90c2f3080287/packages/plugin-svgo/src/config.ts#L32-L38
58
+ "prefixIds"
52
59
  ]
53
60
  }
54
61
  }
55
- }
62
+ },
63
+ splitVendorChunkPlugin: true
56
64
  };
57
65
  var viteConfig = () => {
58
66
  const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
@@ -68,7 +76,12 @@ var viteConfig = () => {
68
76
  build: {
69
77
  outDir: process.env.BUILD_PATH || "build",
70
78
  sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
71
- assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4
79
+ assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4,
80
+ rollupOptions: {
81
+ output: {
82
+ manualChunks: pluginOptions.splitVendorChunkPlugin === false ? void 0 : pluginOptions.splitVendorChunkPlugin === true ? splitVendorManualChunks : pluginOptions.splitVendorChunkPlugin
83
+ }
84
+ }
72
85
  },
73
86
  plugins: [
74
87
  // Replace %ENVIRONMENT_VARIABLES% in .html files
@@ -81,16 +94,21 @@ var viteConfig = () => {
81
94
  // PWA.
82
95
  pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
83
96
  // Check for issues.
84
- process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(pluginOptions.checker || {}),
85
- pluginOptions.splitVendorChunkPlugin === false ? null : splitVendorChunkPlugin()
97
+ process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(pluginOptions.checker || {})
86
98
  ],
87
99
  server: {
88
100
  open: true,
89
101
  host: process.env.HOST || "0.0.0.0",
90
102
  port: process.env.PORT ? Number(process.env.PORT) : 3e3,
91
103
  https: process.env.HTTPS === "true" ? {
92
- cert: process.env.SSL_CRT_FILE ? fs.readFileSync(process.env.SSL_CRT_FILE) : void 0,
93
- key: process.env.SSL_KEY_FILE ? fs.readFileSync(process.env.SSL_KEY_FILE) : void 0
104
+ cert,
105
+ key
106
+ } : void 0
107
+ },
108
+ preview: {
109
+ https: process.env.HTTPS === "true" ? {
110
+ cert,
111
+ key
94
112
  } : void 0
95
113
  },
96
114
  test: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promoboxx/react-scripts-vite",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -17,12 +17,12 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "devDependencies": {
20
- "@promoboxx/eslint-config": "^3.2.0",
21
- "@types/node": "^20.10.4",
22
- "concurrently": "^8.2.2",
23
- "prettier": "^3.1.1",
24
- "tsup": "^8.0.1",
25
- "typescript": "^5.3.3"
20
+ "@promoboxx/eslint-config": "^4.0.2",
21
+ "@types/node": "^22.15.32",
22
+ "concurrently": "^9.2.0",
23
+ "prettier": "^3.6.2",
24
+ "tsup": "^8.0.2",
25
+ "typescript": "^5.9.2"
26
26
  },
27
27
  "exports": {
28
28
  ".": {
@@ -37,16 +37,16 @@
37
37
  "dependencies": {
38
38
  "@svgr/plugin-jsx": "^8.1.0",
39
39
  "@svgr/plugin-svgo": "^8.1.0",
40
- "@vitejs/plugin-react": "^4.2.1",
41
- "alias-hq": "^6.2.3",
42
- "eslint": "^8.55.0",
43
- "jsdom": "^23.0.1",
44
- "vite": "^5.0.9",
45
- "vite-plugin-checker": "^0.6.2",
40
+ "@vitejs/plugin-react": "^5.0.4",
41
+ "alias-hq": "^6.2.4",
42
+ "eslint": "^9.38.0",
43
+ "jsdom": "^27.0.1",
44
+ "vite": "^7.1.12",
45
+ "vite-plugin-checker": "^0.11.0",
46
46
  "vite-plugin-environment": "^1.1.3",
47
- "vite-plugin-pwa": "^0.17.4",
48
- "vite-plugin-svgr": "^4.2.0",
49
- "vitest": "^1.0.4"
47
+ "vite-plugin-pwa": "^1.1.0",
48
+ "vite-plugin-svgr": "^4.5.0",
49
+ "vitest": "^4.0.2"
50
50
  },
51
51
  "files": [
52
52
  "dist"