@promoboxx/react-scripts-vite 0.2.9 → 0.2.10

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,6 +1,6 @@
1
- export { pluginOptions, default as viteConfig } from './viteConfig.js';
1
+ export { getDefaultPluginOptions, pluginOptions, default as viteConfig } from './viteConfig.js';
2
2
  import '@vitejs/plugin-react';
3
- import 'rollup';
3
+ import 'rolldown';
4
4
  import 'vite';
5
5
  import 'vite-plugin-checker';
6
6
  import 'vite-plugin-environment';
package/dist/cjs/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ getDefaultPluginOptions: () => import_viteConfig.getDefaultPluginOptions,
33
34
  pluginOptions: () => import_viteConfig.pluginOptions,
34
35
  viteConfig: () => import_viteConfig.default
35
36
  });
@@ -37,6 +38,7 @@ module.exports = __toCommonJS(index_exports);
37
38
  var import_viteConfig = __toESM(require("./viteConfig"));
38
39
  // Annotate the CommonJS export names for ESM import in node:
39
40
  0 && (module.exports = {
41
+ getDefaultPluginOptions,
40
42
  pluginOptions,
41
43
  viteConfig
42
44
  });
@@ -1,5 +1,5 @@
1
- import { GetManualChunk } from 'rollup';
1
+ import { CodeSplittingNameFunction } from 'rolldown';
2
2
 
3
- declare const splitVendorManualChunks: GetManualChunk;
3
+ declare const splitVendorManualChunks: CodeSplittingNameFunction;
4
4
 
5
5
  export = splitVendorManualChunks;
@@ -1,5 +1,5 @@
1
1
  import react from '@vitejs/plugin-react';
2
- import { ManualChunksOption } from 'rollup';
2
+ import { CodeSplittingNameFunction } from 'rolldown';
3
3
  import { UserConfigFnPromise } from 'vite';
4
4
  import pluginChecker from 'vite-plugin-checker';
5
5
  import envCompatible from 'vite-plugin-environment';
@@ -9,16 +9,16 @@ import svgr from 'vite-plugin-svgr';
9
9
  interface ReactScriptsViteOptions {
10
10
  react?: false | Parameters<typeof react>[0];
11
11
  svgr?: false | Parameters<typeof svgr>[0];
12
- aliasHq?: false;
13
12
  envCompatible?: false | Parameters<typeof envCompatible>[1];
14
13
  pwa?: false | Parameters<typeof VitePWA>[0];
15
14
  checker?: false | Parameters<typeof pluginChecker>[0];
16
15
  envPrefix?: string;
17
- splitVendorChunkPlugin?: boolean | ManualChunksOption;
16
+ splitVendorChunkPlugin?: boolean | CodeSplittingNameFunction;
18
17
  }
19
18
  declare const pluginOptions: ReactScriptsViteOptions;
19
+ declare function getDefaultPluginOptions(): ReactScriptsViteOptions;
20
20
  declare const viteConfig: UserConfigFnPromise;
21
21
 
22
22
  // @ts-ignore
23
23
  export = viteConfig;
24
- export { pluginOptions };
24
+ export { getDefaultPluginOptions, pluginOptions };
@@ -31,12 +31,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var viteConfig_exports = {};
32
32
  __export(viteConfig_exports, {
33
33
  default: () => viteConfig_default,
34
+ getDefaultPluginOptions: () => getDefaultPluginOptions,
34
35
  pluginOptions: () => pluginOptions
35
36
  });
36
37
  module.exports = __toCommonJS(viteConfig_exports);
37
38
  var import_fs = __toESM(require("fs"));
38
39
  var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
39
- var import_alias_hq = __toESM(require("alias-hq"));
40
40
  var import_vite_plugin_checker = __toESM(require("vite-plugin-checker"));
41
41
  var import_vite_plugin_environment = __toESM(require("vite-plugin-environment"));
42
42
  var import_vite_plugin_pwa = require("vite-plugin-pwa");
@@ -44,18 +44,11 @@ var import_vite_plugin_svgr = __toESM(require("vite-plugin-svgr"));
44
44
  var import_replaceEnvInHtml = __toESM(require("./replaceEnvInHtml"));
45
45
  var import_splitVendorManualChunks = __toESM(require("./splitVendorManualChunks"));
46
46
  var pluginOptions = {};
47
- function setPluginOptions(_env) {
48
- if (!pluginOptions.envPrefix) {
49
- pluginOptions.envPrefix = "REACT_APP_";
50
- }
51
- if (pluginOptions.envCompatible !== false) {
52
- pluginOptions.envCompatible = {
53
- prefix: pluginOptions.envPrefix,
54
- ...pluginOptions.envCompatible
55
- };
56
- }
57
- if (pluginOptions.checker !== false) {
58
- pluginOptions.checker = {
47
+ function getDefaultPluginOptions() {
48
+ const defaultPluginOptions = {
49
+ envPrefix: "REACT_APP_",
50
+ envCompatible: {},
51
+ checker: {
59
52
  eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
60
53
  lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`,
61
54
  useFlatConfig: import_fs.default.existsSync("eslint.config.js")
@@ -65,15 +58,11 @@ function setPluginOptions(_env) {
65
58
  overlay: {
66
59
  initialIsOpen: false
67
60
  }
68
- };
69
- }
70
- if (pluginOptions.react !== false) {
71
- pluginOptions.react = {
61
+ },
62
+ react: {
72
63
  jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
73
- };
74
- }
75
- if (pluginOptions.svgr !== false) {
76
- pluginOptions.svgr = {
64
+ },
65
+ svgr: {
77
66
  svgrOptions: {
78
67
  titleProp: true,
79
68
  descProp: true,
@@ -107,10 +96,23 @@ function setPluginOptions(_env) {
107
96
  ]
108
97
  }
109
98
  }
110
- };
99
+ },
100
+ splitVendorChunkPlugin: true
101
+ };
102
+ return defaultPluginOptions;
103
+ }
104
+ function commitPluginOptions(_env) {
105
+ const defaultPluginOptions = getDefaultPluginOptions();
106
+ function unsafe_isValidKey(a) {
107
+ return typeof a === "string";
111
108
  }
112
- if (pluginOptions.splitVendorChunkPlugin !== false) {
113
- pluginOptions.splitVendorChunkPlugin = true;
109
+ for (const [key, value] of Object.entries(defaultPluginOptions)) {
110
+ if (!unsafe_isValidKey(key)) {
111
+ continue;
112
+ }
113
+ if (pluginOptions[key] === void 0) {
114
+ pluginOptions[key] = value;
115
+ }
114
116
  }
115
117
  }
116
118
  function getSetupTestFiles() {
@@ -135,7 +137,7 @@ var viteConfig = async (env) => {
135
137
  cert,
136
138
  key
137
139
  } : void 0;
138
- setPluginOptions(env);
140
+ commitPluginOptions(env);
139
141
  return {
140
142
  base: process.env.PUBLIC_URL,
141
143
  envPrefix: pluginOptions.envPrefix,
@@ -143,9 +145,11 @@ var viteConfig = async (env) => {
143
145
  outDir: process.env.BUILD_PATH || "build",
144
146
  sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
145
147
  assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4,
146
- rollupOptions: {
148
+ rolldownOptions: {
147
149
  output: {
148
- manualChunks: pluginOptions.splitVendorChunkPlugin === false ? void 0 : pluginOptions.splitVendorChunkPlugin === true ? import_splitVendorManualChunks.default : pluginOptions.splitVendorChunkPlugin
150
+ codeSplitting: {
151
+ groups: pluginOptions.splitVendorChunkPlugin === false || pluginOptions.splitVendorChunkPlugin === void 0 ? void 0 : pluginOptions.splitVendorChunkPlugin === true ? [{ name: import_splitVendorManualChunks.default }] : [{ name: pluginOptions.splitVendorChunkPlugin }]
152
+ }
149
153
  }
150
154
  }
151
155
  },
@@ -156,9 +160,12 @@ var viteConfig = async (env) => {
156
160
  pluginOptions.react === false ? null : (0, import_plugin_react.default)(pluginOptions.react),
157
161
  pluginOptions.svgr === false ? null : (0, import_vite_plugin_svgr.default)(pluginOptions.svgr),
158
162
  // import.meta.env -> process.env
159
- pluginOptions.envCompatible === false ? null : (0, import_vite_plugin_environment.default)("all", pluginOptions.envCompatible),
163
+ pluginOptions.envCompatible === false ? null : (0, import_vite_plugin_environment.default)("all", {
164
+ prefix: pluginOptions.envPrefix,
165
+ ...pluginOptions.envCompatible
166
+ }),
160
167
  // PWA.
161
- process.env.NODE_ENV === "test" || pluginOptions.pwa === false ? null : (0, import_vite_plugin_pwa.VitePWA)(pluginOptions.pwa),
168
+ pluginOptions.pwa === false ? null : (0, import_vite_plugin_pwa.VitePWA)(pluginOptions.pwa),
162
169
  // Check for issues.
163
170
  process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker || {})
164
171
  ],
@@ -181,12 +188,13 @@ var viteConfig = async (env) => {
181
188
  reporters: "verbose"
182
189
  },
183
190
  resolve: {
184
- alias: pluginOptions.aliasHq === false ? {} : import_alias_hq.default.get("rollup")
191
+ tsconfigPaths: true
185
192
  }
186
193
  };
187
194
  };
188
195
  var viteConfig_default = viteConfig;
189
196
  // Annotate the CommonJS export names for ESM import in node:
190
197
  0 && (module.exports = {
198
+ getDefaultPluginOptions,
191
199
  pluginOptions
192
200
  });
@@ -1,6 +1,6 @@
1
- export { pluginOptions, default as viteConfig } from './viteConfig.mjs';
1
+ export { getDefaultPluginOptions, pluginOptions, default as viteConfig } from './viteConfig.mjs';
2
2
  import '@vitejs/plugin-react';
3
- import 'rollup';
3
+ import 'rolldown';
4
4
  import 'vite';
5
5
  import 'vite-plugin-checker';
6
6
  import 'vite-plugin-environment';
@@ -1,6 +1,11 @@
1
1
  // src/index.ts
2
- import { default as default2, pluginOptions } from "./viteConfig.mjs";
2
+ import {
3
+ default as default2,
4
+ pluginOptions,
5
+ getDefaultPluginOptions
6
+ } from "./viteConfig.mjs";
3
7
  export {
8
+ getDefaultPluginOptions,
4
9
  pluginOptions,
5
10
  default2 as viteConfig
6
11
  };
@@ -1,5 +1,5 @@
1
- import { GetManualChunk } from 'rollup';
1
+ import { CodeSplittingNameFunction } from 'rolldown';
2
2
 
3
- declare const splitVendorManualChunks: GetManualChunk;
3
+ declare const splitVendorManualChunks: CodeSplittingNameFunction;
4
4
 
5
5
  export { splitVendorManualChunks as default };
@@ -1,5 +1,5 @@
1
1
  import react from '@vitejs/plugin-react';
2
- import { ManualChunksOption } from 'rollup';
2
+ import { CodeSplittingNameFunction } from 'rolldown';
3
3
  import { UserConfigFnPromise } from 'vite';
4
4
  import pluginChecker from 'vite-plugin-checker';
5
5
  import envCompatible from 'vite-plugin-environment';
@@ -9,14 +9,14 @@ import svgr from 'vite-plugin-svgr';
9
9
  interface ReactScriptsViteOptions {
10
10
  react?: false | Parameters<typeof react>[0];
11
11
  svgr?: false | Parameters<typeof svgr>[0];
12
- aliasHq?: false;
13
12
  envCompatible?: false | Parameters<typeof envCompatible>[1];
14
13
  pwa?: false | Parameters<typeof VitePWA>[0];
15
14
  checker?: false | Parameters<typeof pluginChecker>[0];
16
15
  envPrefix?: string;
17
- splitVendorChunkPlugin?: boolean | ManualChunksOption;
16
+ splitVendorChunkPlugin?: boolean | CodeSplittingNameFunction;
18
17
  }
19
18
  declare const pluginOptions: ReactScriptsViteOptions;
19
+ declare function getDefaultPluginOptions(): ReactScriptsViteOptions;
20
20
  declare const viteConfig: UserConfigFnPromise;
21
21
 
22
- export { viteConfig as default, pluginOptions };
22
+ export { viteConfig as default, getDefaultPluginOptions, pluginOptions };
@@ -1,7 +1,6 @@
1
1
  // src/viteConfig.ts
2
2
  import fs from "fs";
3
3
  import react from "@vitejs/plugin-react";
4
- import aliasHq from "alias-hq";
5
4
  import pluginChecker from "vite-plugin-checker";
6
5
  import envCompatible from "vite-plugin-environment";
7
6
  import { VitePWA } from "vite-plugin-pwa";
@@ -9,18 +8,11 @@ import svgr from "vite-plugin-svgr";
9
8
  import replaceEnvInHtml from "./replaceEnvInHtml.mjs";
10
9
  import splitVendorManualChunks from "./splitVendorManualChunks.mjs";
11
10
  var pluginOptions = {};
12
- function setPluginOptions(_env) {
13
- if (!pluginOptions.envPrefix) {
14
- pluginOptions.envPrefix = "REACT_APP_";
15
- }
16
- if (pluginOptions.envCompatible !== false) {
17
- pluginOptions.envCompatible = {
18
- prefix: pluginOptions.envPrefix,
19
- ...pluginOptions.envCompatible
20
- };
21
- }
22
- if (pluginOptions.checker !== false) {
23
- pluginOptions.checker = {
11
+ function getDefaultPluginOptions() {
12
+ const defaultPluginOptions = {
13
+ envPrefix: "REACT_APP_",
14
+ envCompatible: {},
15
+ checker: {
24
16
  eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
25
17
  lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`,
26
18
  useFlatConfig: fs.existsSync("eslint.config.js")
@@ -30,15 +22,11 @@ function setPluginOptions(_env) {
30
22
  overlay: {
31
23
  initialIsOpen: false
32
24
  }
33
- };
34
- }
35
- if (pluginOptions.react !== false) {
36
- pluginOptions.react = {
25
+ },
26
+ react: {
37
27
  jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
38
- };
39
- }
40
- if (pluginOptions.svgr !== false) {
41
- pluginOptions.svgr = {
28
+ },
29
+ svgr: {
42
30
  svgrOptions: {
43
31
  titleProp: true,
44
32
  descProp: true,
@@ -72,10 +60,23 @@ function setPluginOptions(_env) {
72
60
  ]
73
61
  }
74
62
  }
75
- };
63
+ },
64
+ splitVendorChunkPlugin: true
65
+ };
66
+ return defaultPluginOptions;
67
+ }
68
+ function commitPluginOptions(_env) {
69
+ const defaultPluginOptions = getDefaultPluginOptions();
70
+ function unsafe_isValidKey(a) {
71
+ return typeof a === "string";
76
72
  }
77
- if (pluginOptions.splitVendorChunkPlugin !== false) {
78
- pluginOptions.splitVendorChunkPlugin = true;
73
+ for (const [key, value] of Object.entries(defaultPluginOptions)) {
74
+ if (!unsafe_isValidKey(key)) {
75
+ continue;
76
+ }
77
+ if (pluginOptions[key] === void 0) {
78
+ pluginOptions[key] = value;
79
+ }
79
80
  }
80
81
  }
81
82
  function getSetupTestFiles() {
@@ -100,7 +101,7 @@ var viteConfig = async (env) => {
100
101
  cert,
101
102
  key
102
103
  } : void 0;
103
- setPluginOptions(env);
104
+ commitPluginOptions(env);
104
105
  return {
105
106
  base: process.env.PUBLIC_URL,
106
107
  envPrefix: pluginOptions.envPrefix,
@@ -108,9 +109,11 @@ var viteConfig = async (env) => {
108
109
  outDir: process.env.BUILD_PATH || "build",
109
110
  sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
110
111
  assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4,
111
- rollupOptions: {
112
+ rolldownOptions: {
112
113
  output: {
113
- manualChunks: pluginOptions.splitVendorChunkPlugin === false ? void 0 : pluginOptions.splitVendorChunkPlugin === true ? splitVendorManualChunks : pluginOptions.splitVendorChunkPlugin
114
+ codeSplitting: {
115
+ groups: pluginOptions.splitVendorChunkPlugin === false || pluginOptions.splitVendorChunkPlugin === void 0 ? void 0 : pluginOptions.splitVendorChunkPlugin === true ? [{ name: splitVendorManualChunks }] : [{ name: pluginOptions.splitVendorChunkPlugin }]
116
+ }
114
117
  }
115
118
  }
116
119
  },
@@ -121,9 +124,12 @@ var viteConfig = async (env) => {
121
124
  pluginOptions.react === false ? null : react(pluginOptions.react),
122
125
  pluginOptions.svgr === false ? null : svgr(pluginOptions.svgr),
123
126
  // import.meta.env -> process.env
124
- pluginOptions.envCompatible === false ? null : envCompatible("all", pluginOptions.envCompatible),
127
+ pluginOptions.envCompatible === false ? null : envCompatible("all", {
128
+ prefix: pluginOptions.envPrefix,
129
+ ...pluginOptions.envCompatible
130
+ }),
125
131
  // PWA.
126
- process.env.NODE_ENV === "test" || pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
132
+ pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
127
133
  // Check for issues.
128
134
  process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(pluginOptions.checker || {})
129
135
  ],
@@ -146,12 +152,13 @@ var viteConfig = async (env) => {
146
152
  reporters: "verbose"
147
153
  },
148
154
  resolve: {
149
- alias: pluginOptions.aliasHq === false ? {} : aliasHq.get("rollup")
155
+ tsconfigPaths: true
150
156
  }
151
157
  };
152
158
  };
153
159
  var viteConfig_default = viteConfig;
154
160
  export {
155
161
  viteConfig_default as default,
162
+ getDefaultPluginOptions,
156
163
  pluginOptions
157
164
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promoboxx/react-scripts-vite",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
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": "^4.0.3",
21
- "@types/node": "^25.0.10",
20
+ "@promoboxx/eslint-config": "^4.0.4",
21
+ "@types/node": "^25.9.1",
22
22
  "concurrently": "^9.2.0",
23
- "prettier": "^3.8.1",
23
+ "prettier": "^3.8.3",
24
24
  "tsup": "^8.5.1",
25
- "typescript": "^5.9.3"
25
+ "typescript": "^6.0.3"
26
26
  },
27
27
  "exports": {
28
28
  ".": {
@@ -37,16 +37,15 @@
37
37
  "dependencies": {
38
38
  "@svgr/plugin-jsx": "^8.1.0",
39
39
  "@svgr/plugin-svgo": "^8.1.0",
40
- "@vitejs/plugin-react": "^5.1.2",
41
- "alias-hq": "^6.2.4",
40
+ "@vitejs/plugin-react": "^6.0.2",
42
41
  "eslint": "^9.39.2",
43
- "jsdom": "^27.4.0",
44
- "vite": "^7.3.1",
45
- "vite-plugin-checker": "^0.12.0",
42
+ "jsdom": "^29.1.1",
43
+ "vite": "^8.0.14",
44
+ "vite-plugin-checker": "^0.13.0",
46
45
  "vite-plugin-environment": "^1.1.3",
47
- "vite-plugin-pwa": "^1.2.0",
48
- "vite-plugin-svgr": "^4.5.0",
49
- "vitest": "^4.0.18"
46
+ "vite-plugin-pwa": "^1.3.0",
47
+ "vite-plugin-svgr": "^5.2.0",
48
+ "vitest": "^4.1.7"
50
49
  },
51
50
  "files": [
52
51
  "dist"