@promoboxx/react-scripts-vite 0.2.7 → 0.2.9
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/README.md +0 -1
- package/dist/cjs/cli.d.ts +1 -0
- package/dist/cjs/cli.js +5 -15
- package/dist/cjs/viteConfig.d.ts +2 -2
- package/dist/cjs/viteConfig.js +101 -73
- package/dist/esm/cli.d.mts +1 -0
- package/dist/esm/cli.mjs +6 -15
- package/dist/esm/viteConfig.d.mts +2 -2
- package/dist/esm/viteConfig.mjs +98 -70
- package/package.json +13 -13
package/README.md
CHANGED
package/dist/cjs/cli.d.ts
CHANGED
package/dist/cjs/cli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
// src/cli.ts
|
|
@@ -5,15 +6,15 @@ var import_child_process = require("child_process");
|
|
|
5
6
|
function main(command2, args2) {
|
|
6
7
|
switch (command2) {
|
|
7
8
|
case "start":
|
|
8
|
-
spawnAndExit("
|
|
9
|
+
spawnAndExit("vite", args2, {
|
|
9
10
|
NODE_ENV: "development"
|
|
10
11
|
});
|
|
11
12
|
break;
|
|
12
13
|
case "test":
|
|
13
|
-
spawnAndExit("
|
|
14
|
+
spawnAndExit("vitest", args2, { NODE_ENV: "test" });
|
|
14
15
|
break;
|
|
15
16
|
case "build":
|
|
16
|
-
spawnAndExit("
|
|
17
|
+
spawnAndExit("vite", ["build", ...args2], {
|
|
17
18
|
NODE_ENV: "production"
|
|
18
19
|
});
|
|
19
20
|
break;
|
|
@@ -34,16 +35,5 @@ function spawnAndExit(command2, args2 = [], env) {
|
|
|
34
35
|
process.exit(code != null ? code : void 0);
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
var [
|
|
38
|
-
// We should probably change our eslint config to ignore unused variables that
|
|
39
|
-
// start with an underscore. TypeScript ignores them, Rust ignores, them, it's
|
|
40
|
-
// been a convention for almost two decades.
|
|
41
|
-
// https://stackoverflow.com/a/77067927
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- see above
|
|
43
|
-
_interpreter,
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- see above
|
|
45
|
-
_thisFile,
|
|
46
|
-
command,
|
|
47
|
-
...args
|
|
48
|
-
] = process.argv;
|
|
38
|
+
var [_interpreter, _thisFile, command, ...args] = process.argv;
|
|
49
39
|
main(command, args);
|
package/dist/cjs/viteConfig.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react';
|
|
2
2
|
import { ManualChunksOption } from 'rollup';
|
|
3
|
-
import {
|
|
3
|
+
import { UserConfigFnPromise } from 'vite';
|
|
4
4
|
import pluginChecker from 'vite-plugin-checker';
|
|
5
5
|
import envCompatible from 'vite-plugin-environment';
|
|
6
6
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
@@ -17,7 +17,7 @@ interface ReactScriptsViteOptions {
|
|
|
17
17
|
splitVendorChunkPlugin?: boolean | ManualChunksOption;
|
|
18
18
|
}
|
|
19
19
|
declare const pluginOptions: ReactScriptsViteOptions;
|
|
20
|
-
declare const viteConfig:
|
|
20
|
+
declare const viteConfig: UserConfigFnPromise;
|
|
21
21
|
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
export = viteConfig;
|
package/dist/cjs/viteConfig.js
CHANGED
|
@@ -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
|
|
15
|
-
if (!__hasOwnProp.call(to,
|
|
16
|
-
__defProp(to,
|
|
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 });
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
@@ -43,71 +43,102 @@ var import_vite_plugin_pwa = require("vite-plugin-pwa");
|
|
|
43
43
|
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
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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")
|
|
53
|
-
},
|
|
54
|
-
typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
|
|
55
|
-
enableBuild: true,
|
|
56
|
-
overlay: {
|
|
57
|
-
initialIsOpen: false
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
react: {
|
|
61
|
-
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
|
|
62
|
-
},
|
|
63
|
-
svgr: {
|
|
64
|
-
svgrOptions: {
|
|
65
|
-
titleProp: true,
|
|
66
|
-
descProp: true,
|
|
67
|
-
ref: true,
|
|
68
|
-
memo: true,
|
|
69
|
-
// It's not obvious, but these plugins are needed to just be able to pass
|
|
70
|
-
// options to svgo, and they're not really documented in svgr.
|
|
71
|
-
// https://github.com/pd4d10/vite-plugin-svgr/blob/57873c10f9be1484517b90e2dfbe2e23fa62a183/README.md?plain=1#L66-L78
|
|
72
|
-
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
|
|
73
|
-
svgo: true,
|
|
74
|
-
// Stop svgr from touching dimensions / viewBox / the svgo config.
|
|
75
|
-
dimensions: false,
|
|
76
|
-
svgoConfig: {
|
|
77
|
-
plugins: [
|
|
78
|
-
{
|
|
79
|
-
name: "preset-default",
|
|
80
|
-
params: {
|
|
81
|
-
overrides: {
|
|
82
|
-
// Don't remove viewBox if it exists in the svg.
|
|
83
|
-
removeViewBox: false
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
// Finally, remove dimensions, and more importantly, set a viewBox if
|
|
88
|
-
// it doesn't exist.
|
|
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"
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
splitVendorChunkPlugin: true
|
|
99
|
-
};
|
|
100
|
-
var viteConfig = () => {
|
|
101
|
-
const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
|
|
46
|
+
var pluginOptions = {};
|
|
47
|
+
function setPluginOptions(_env) {
|
|
48
|
+
if (!pluginOptions.envPrefix) {
|
|
49
|
+
pluginOptions.envPrefix = "REACT_APP_";
|
|
50
|
+
}
|
|
102
51
|
if (pluginOptions.envCompatible !== false) {
|
|
103
52
|
pluginOptions.envCompatible = {
|
|
104
|
-
prefix:
|
|
53
|
+
prefix: pluginOptions.envPrefix,
|
|
105
54
|
...pluginOptions.envCompatible
|
|
106
55
|
};
|
|
107
56
|
}
|
|
57
|
+
if (pluginOptions.checker !== false) {
|
|
58
|
+
pluginOptions.checker = {
|
|
59
|
+
eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
|
|
60
|
+
lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`,
|
|
61
|
+
useFlatConfig: import_fs.default.existsSync("eslint.config.js")
|
|
62
|
+
},
|
|
63
|
+
typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
|
|
64
|
+
enableBuild: true,
|
|
65
|
+
overlay: {
|
|
66
|
+
initialIsOpen: false
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (pluginOptions.react !== false) {
|
|
71
|
+
pluginOptions.react = {
|
|
72
|
+
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (pluginOptions.svgr !== false) {
|
|
76
|
+
pluginOptions.svgr = {
|
|
77
|
+
svgrOptions: {
|
|
78
|
+
titleProp: true,
|
|
79
|
+
descProp: true,
|
|
80
|
+
ref: true,
|
|
81
|
+
memo: true,
|
|
82
|
+
// It's not obvious, but these plugins are needed to just be able to pass
|
|
83
|
+
// options to svgo, and they're not really documented in svgr.
|
|
84
|
+
// https://github.com/pd4d10/vite-plugin-svgr/blob/57873c10f9be1484517b90e2dfbe2e23fa62a183/README.md?plain=1#L66-L78
|
|
85
|
+
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
|
|
86
|
+
svgo: true,
|
|
87
|
+
// Stop svgr from touching dimensions / viewBox / the svgo config.
|
|
88
|
+
dimensions: false,
|
|
89
|
+
svgoConfig: {
|
|
90
|
+
plugins: [
|
|
91
|
+
{
|
|
92
|
+
name: "preset-default",
|
|
93
|
+
params: {
|
|
94
|
+
overrides: {
|
|
95
|
+
// Don't remove viewBox if it exists in the svg.
|
|
96
|
+
removeViewBox: false
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
// Finally, remove dimensions, and more importantly, set a viewBox if
|
|
101
|
+
// it doesn't exist.
|
|
102
|
+
"removeDimensions",
|
|
103
|
+
// Since we're setting custom SVGR/SVGO options, we miss out on any
|
|
104
|
+
// defaults specified there.
|
|
105
|
+
// https://github.com/gregberge/svgr/blob/6b329ac8b9f045ef56ba0020ef4d90c2f3080287/packages/plugin-svgo/src/config.ts#L32-L38
|
|
106
|
+
"prefixIds"
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (pluginOptions.splitVendorChunkPlugin !== false) {
|
|
113
|
+
pluginOptions.splitVendorChunkPlugin = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function getSetupTestFiles() {
|
|
117
|
+
const candidates = [
|
|
118
|
+
"./src/setupTests.ts",
|
|
119
|
+
"./src/setupTests.js",
|
|
120
|
+
"./src/test/setup.ts",
|
|
121
|
+
"./src/test/setup.js"
|
|
122
|
+
];
|
|
123
|
+
for (const candidate of candidates) {
|
|
124
|
+
if (import_fs.default.existsSync(candidate)) {
|
|
125
|
+
return candidate;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
var viteConfig = async (env) => {
|
|
130
|
+
const cert = process.env.SSL_CRT_FILE ? import_fs.default.readFileSync(process.env.SSL_CRT_FILE) : void 0;
|
|
131
|
+
const key = process.env.SSL_KEY_FILE ? import_fs.default.readFileSync(process.env.SSL_KEY_FILE) : void 0;
|
|
132
|
+
const host = process.env.HOST || "0.0.0.0";
|
|
133
|
+
const port = process.env.PORT ? Number(process.env.PORT) : 3e3;
|
|
134
|
+
const httpsServerOptions = process.env.HTTPS === "true" ? {
|
|
135
|
+
cert,
|
|
136
|
+
key
|
|
137
|
+
} : void 0;
|
|
138
|
+
setPluginOptions(env);
|
|
108
139
|
return {
|
|
109
140
|
base: process.env.PUBLIC_URL,
|
|
110
|
-
envPrefix:
|
|
141
|
+
envPrefix: pluginOptions.envPrefix,
|
|
111
142
|
build: {
|
|
112
143
|
outDir: process.env.BUILD_PATH || "build",
|
|
113
144
|
sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
|
|
@@ -127,29 +158,26 @@ var viteConfig = () => {
|
|
|
127
158
|
// import.meta.env -> process.env
|
|
128
159
|
pluginOptions.envCompatible === false ? null : (0, import_vite_plugin_environment.default)("all", pluginOptions.envCompatible),
|
|
129
160
|
// PWA.
|
|
130
|
-
pluginOptions.pwa === false ? null : (0, import_vite_plugin_pwa.VitePWA)(pluginOptions.pwa),
|
|
161
|
+
process.env.NODE_ENV === "test" || pluginOptions.pwa === false ? null : (0, import_vite_plugin_pwa.VitePWA)(pluginOptions.pwa),
|
|
131
162
|
// Check for issues.
|
|
132
163
|
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker || {})
|
|
133
164
|
],
|
|
134
165
|
server: {
|
|
135
166
|
open: true,
|
|
136
|
-
host
|
|
137
|
-
port
|
|
138
|
-
https:
|
|
139
|
-
cert,
|
|
140
|
-
key
|
|
141
|
-
} : void 0
|
|
167
|
+
host,
|
|
168
|
+
port,
|
|
169
|
+
https: httpsServerOptions
|
|
142
170
|
},
|
|
143
171
|
preview: {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
172
|
+
open: true,
|
|
173
|
+
host,
|
|
174
|
+
port,
|
|
175
|
+
https: httpsServerOptions
|
|
148
176
|
},
|
|
149
177
|
test: {
|
|
150
178
|
globals: true,
|
|
151
179
|
environment: "jsdom",
|
|
152
|
-
setupFiles:
|
|
180
|
+
setupFiles: getSetupTestFiles(),
|
|
153
181
|
reporters: "verbose"
|
|
154
182
|
},
|
|
155
183
|
resolve: {
|
package/dist/esm/cli.d.mts
CHANGED
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
1
3
|
// src/cli.ts
|
|
2
4
|
import { spawn } from "child_process";
|
|
3
5
|
function main(command2, args2) {
|
|
4
6
|
switch (command2) {
|
|
5
7
|
case "start":
|
|
6
|
-
spawnAndExit("
|
|
8
|
+
spawnAndExit("vite", args2, {
|
|
7
9
|
NODE_ENV: "development"
|
|
8
10
|
});
|
|
9
11
|
break;
|
|
10
12
|
case "test":
|
|
11
|
-
spawnAndExit("
|
|
13
|
+
spawnAndExit("vitest", args2, { NODE_ENV: "test" });
|
|
12
14
|
break;
|
|
13
15
|
case "build":
|
|
14
|
-
spawnAndExit("
|
|
16
|
+
spawnAndExit("vite", ["build", ...args2], {
|
|
15
17
|
NODE_ENV: "production"
|
|
16
18
|
});
|
|
17
19
|
break;
|
|
@@ -32,16 +34,5 @@ function spawnAndExit(command2, args2 = [], env) {
|
|
|
32
34
|
process.exit(code ?? void 0);
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
|
-
var [
|
|
36
|
-
// We should probably change our eslint config to ignore unused variables that
|
|
37
|
-
// start with an underscore. TypeScript ignores them, Rust ignores, them, it's
|
|
38
|
-
// been a convention for almost two decades.
|
|
39
|
-
// https://stackoverflow.com/a/77067927
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- see above
|
|
41
|
-
_interpreter,
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- see above
|
|
43
|
-
_thisFile,
|
|
44
|
-
command,
|
|
45
|
-
...args
|
|
46
|
-
] = process.argv;
|
|
37
|
+
var [_interpreter, _thisFile, command, ...args] = process.argv;
|
|
47
38
|
main(command, args);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react';
|
|
2
2
|
import { ManualChunksOption } from 'rollup';
|
|
3
|
-
import {
|
|
3
|
+
import { UserConfigFnPromise } from 'vite';
|
|
4
4
|
import pluginChecker from 'vite-plugin-checker';
|
|
5
5
|
import envCompatible from 'vite-plugin-environment';
|
|
6
6
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
@@ -17,6 +17,6 @@ interface ReactScriptsViteOptions {
|
|
|
17
17
|
splitVendorChunkPlugin?: boolean | ManualChunksOption;
|
|
18
18
|
}
|
|
19
19
|
declare const pluginOptions: ReactScriptsViteOptions;
|
|
20
|
-
declare const viteConfig:
|
|
20
|
+
declare const viteConfig: UserConfigFnPromise;
|
|
21
21
|
|
|
22
22
|
export { viteConfig as default, pluginOptions };
|
package/dist/esm/viteConfig.mjs
CHANGED
|
@@ -8,71 +8,102 @@ import { VitePWA } from "vite-plugin-pwa";
|
|
|
8
8
|
import svgr from "vite-plugin-svgr";
|
|
9
9
|
import replaceEnvInHtml from "./replaceEnvInHtml.mjs";
|
|
10
10
|
import splitVendorManualChunks from "./splitVendorManualChunks.mjs";
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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")
|
|
18
|
-
},
|
|
19
|
-
typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
|
|
20
|
-
enableBuild: true,
|
|
21
|
-
overlay: {
|
|
22
|
-
initialIsOpen: false
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
react: {
|
|
26
|
-
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
|
|
27
|
-
},
|
|
28
|
-
svgr: {
|
|
29
|
-
svgrOptions: {
|
|
30
|
-
titleProp: true,
|
|
31
|
-
descProp: true,
|
|
32
|
-
ref: true,
|
|
33
|
-
memo: true,
|
|
34
|
-
// It's not obvious, but these plugins are needed to just be able to pass
|
|
35
|
-
// options to svgo, and they're not really documented in svgr.
|
|
36
|
-
// https://github.com/pd4d10/vite-plugin-svgr/blob/57873c10f9be1484517b90e2dfbe2e23fa62a183/README.md?plain=1#L66-L78
|
|
37
|
-
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
|
|
38
|
-
svgo: true,
|
|
39
|
-
// Stop svgr from touching dimensions / viewBox / the svgo config.
|
|
40
|
-
dimensions: false,
|
|
41
|
-
svgoConfig: {
|
|
42
|
-
plugins: [
|
|
43
|
-
{
|
|
44
|
-
name: "preset-default",
|
|
45
|
-
params: {
|
|
46
|
-
overrides: {
|
|
47
|
-
// Don't remove viewBox if it exists in the svg.
|
|
48
|
-
removeViewBox: false
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
// Finally, remove dimensions, and more importantly, set a viewBox if
|
|
53
|
-
// it doesn't exist.
|
|
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"
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
splitVendorChunkPlugin: true
|
|
64
|
-
};
|
|
65
|
-
var viteConfig = () => {
|
|
66
|
-
const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
|
|
11
|
+
var pluginOptions = {};
|
|
12
|
+
function setPluginOptions(_env) {
|
|
13
|
+
if (!pluginOptions.envPrefix) {
|
|
14
|
+
pluginOptions.envPrefix = "REACT_APP_";
|
|
15
|
+
}
|
|
67
16
|
if (pluginOptions.envCompatible !== false) {
|
|
68
17
|
pluginOptions.envCompatible = {
|
|
69
|
-
prefix:
|
|
18
|
+
prefix: pluginOptions.envPrefix,
|
|
70
19
|
...pluginOptions.envCompatible
|
|
71
20
|
};
|
|
72
21
|
}
|
|
22
|
+
if (pluginOptions.checker !== false) {
|
|
23
|
+
pluginOptions.checker = {
|
|
24
|
+
eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
|
|
25
|
+
lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`,
|
|
26
|
+
useFlatConfig: fs.existsSync("eslint.config.js")
|
|
27
|
+
},
|
|
28
|
+
typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
|
|
29
|
+
enableBuild: true,
|
|
30
|
+
overlay: {
|
|
31
|
+
initialIsOpen: false
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (pluginOptions.react !== false) {
|
|
36
|
+
pluginOptions.react = {
|
|
37
|
+
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (pluginOptions.svgr !== false) {
|
|
41
|
+
pluginOptions.svgr = {
|
|
42
|
+
svgrOptions: {
|
|
43
|
+
titleProp: true,
|
|
44
|
+
descProp: true,
|
|
45
|
+
ref: true,
|
|
46
|
+
memo: true,
|
|
47
|
+
// It's not obvious, but these plugins are needed to just be able to pass
|
|
48
|
+
// options to svgo, and they're not really documented in svgr.
|
|
49
|
+
// https://github.com/pd4d10/vite-plugin-svgr/blob/57873c10f9be1484517b90e2dfbe2e23fa62a183/README.md?plain=1#L66-L78
|
|
50
|
+
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
|
|
51
|
+
svgo: true,
|
|
52
|
+
// Stop svgr from touching dimensions / viewBox / the svgo config.
|
|
53
|
+
dimensions: false,
|
|
54
|
+
svgoConfig: {
|
|
55
|
+
plugins: [
|
|
56
|
+
{
|
|
57
|
+
name: "preset-default",
|
|
58
|
+
params: {
|
|
59
|
+
overrides: {
|
|
60
|
+
// Don't remove viewBox if it exists in the svg.
|
|
61
|
+
removeViewBox: false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
// Finally, remove dimensions, and more importantly, set a viewBox if
|
|
66
|
+
// it doesn't exist.
|
|
67
|
+
"removeDimensions",
|
|
68
|
+
// Since we're setting custom SVGR/SVGO options, we miss out on any
|
|
69
|
+
// defaults specified there.
|
|
70
|
+
// https://github.com/gregberge/svgr/blob/6b329ac8b9f045ef56ba0020ef4d90c2f3080287/packages/plugin-svgo/src/config.ts#L32-L38
|
|
71
|
+
"prefixIds"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (pluginOptions.splitVendorChunkPlugin !== false) {
|
|
78
|
+
pluginOptions.splitVendorChunkPlugin = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function getSetupTestFiles() {
|
|
82
|
+
const candidates = [
|
|
83
|
+
"./src/setupTests.ts",
|
|
84
|
+
"./src/setupTests.js",
|
|
85
|
+
"./src/test/setup.ts",
|
|
86
|
+
"./src/test/setup.js"
|
|
87
|
+
];
|
|
88
|
+
for (const candidate of candidates) {
|
|
89
|
+
if (fs.existsSync(candidate)) {
|
|
90
|
+
return candidate;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
var viteConfig = async (env) => {
|
|
95
|
+
const cert = process.env.SSL_CRT_FILE ? fs.readFileSync(process.env.SSL_CRT_FILE) : void 0;
|
|
96
|
+
const key = process.env.SSL_KEY_FILE ? fs.readFileSync(process.env.SSL_KEY_FILE) : void 0;
|
|
97
|
+
const host = process.env.HOST || "0.0.0.0";
|
|
98
|
+
const port = process.env.PORT ? Number(process.env.PORT) : 3e3;
|
|
99
|
+
const httpsServerOptions = process.env.HTTPS === "true" ? {
|
|
100
|
+
cert,
|
|
101
|
+
key
|
|
102
|
+
} : void 0;
|
|
103
|
+
setPluginOptions(env);
|
|
73
104
|
return {
|
|
74
105
|
base: process.env.PUBLIC_URL,
|
|
75
|
-
envPrefix:
|
|
106
|
+
envPrefix: pluginOptions.envPrefix,
|
|
76
107
|
build: {
|
|
77
108
|
outDir: process.env.BUILD_PATH || "build",
|
|
78
109
|
sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
|
|
@@ -92,29 +123,26 @@ var viteConfig = () => {
|
|
|
92
123
|
// import.meta.env -> process.env
|
|
93
124
|
pluginOptions.envCompatible === false ? null : envCompatible("all", pluginOptions.envCompatible),
|
|
94
125
|
// PWA.
|
|
95
|
-
pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
|
|
126
|
+
process.env.NODE_ENV === "test" || pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
|
|
96
127
|
// Check for issues.
|
|
97
128
|
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(pluginOptions.checker || {})
|
|
98
129
|
],
|
|
99
130
|
server: {
|
|
100
131
|
open: true,
|
|
101
|
-
host
|
|
102
|
-
port
|
|
103
|
-
https:
|
|
104
|
-
cert,
|
|
105
|
-
key
|
|
106
|
-
} : void 0
|
|
132
|
+
host,
|
|
133
|
+
port,
|
|
134
|
+
https: httpsServerOptions
|
|
107
135
|
},
|
|
108
136
|
preview: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
137
|
+
open: true,
|
|
138
|
+
host,
|
|
139
|
+
port,
|
|
140
|
+
https: httpsServerOptions
|
|
113
141
|
},
|
|
114
142
|
test: {
|
|
115
143
|
globals: true,
|
|
116
144
|
environment: "jsdom",
|
|
117
|
-
setupFiles:
|
|
145
|
+
setupFiles: getSetupTestFiles(),
|
|
118
146
|
reporters: "verbose"
|
|
119
147
|
},
|
|
120
148
|
resolve: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promoboxx/react-scripts-vite",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
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.
|
|
21
|
-
"@types/node": "^
|
|
20
|
+
"@promoboxx/eslint-config": "^4.0.3",
|
|
21
|
+
"@types/node": "^25.0.10",
|
|
22
22
|
"concurrently": "^9.2.0",
|
|
23
|
-
"prettier": "^3.
|
|
24
|
-
"tsup": "^8.
|
|
25
|
-
"typescript": "^5.9.
|
|
23
|
+
"prettier": "^3.8.1",
|
|
24
|
+
"tsup": "^8.5.1",
|
|
25
|
+
"typescript": "^5.9.3"
|
|
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": "^5.
|
|
40
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
41
41
|
"alias-hq": "^6.2.4",
|
|
42
|
-
"eslint": "^9.
|
|
43
|
-
"jsdom": "^27.0
|
|
44
|
-
"vite": "^7.1
|
|
45
|
-
"vite-plugin-checker": "^0.
|
|
42
|
+
"eslint": "^9.39.2",
|
|
43
|
+
"jsdom": "^27.4.0",
|
|
44
|
+
"vite": "^7.3.1",
|
|
45
|
+
"vite-plugin-checker": "^0.12.0",
|
|
46
46
|
"vite-plugin-environment": "^1.1.3",
|
|
47
|
-
"vite-plugin-pwa": "^1.
|
|
47
|
+
"vite-plugin-pwa": "^1.2.0",
|
|
48
48
|
"vite-plugin-svgr": "^4.5.0",
|
|
49
|
-
"vitest": "^4.0.
|
|
49
|
+
"vitest": "^4.0.18"
|
|
50
50
|
},
|
|
51
51
|
"files": [
|
|
52
52
|
"dist"
|