@promoboxx/react-scripts-vite 0.2.1 → 0.2.2
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/cjs/muteWarnings.d.ts +12 -0
- package/dist/cjs/muteWarnings.js +70 -0
- package/dist/cjs/viteConfig.d.ts +2 -1
- package/dist/cjs/viteConfig.js +5 -2
- package/dist/esm/muteWarnings.d.mts +12 -0
- package/dist/esm/muteWarnings.mjs +48 -0
- package/dist/esm/viteConfig.d.mts +2 -1
- package/dist/esm/viteConfig.mjs +5 -2
- package/package.json +8 -9
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mutes Rollup warnings.
|
|
5
|
+
* https://github.com/vitejs/vite/issues/15012#issuecomment-1825035992
|
|
6
|
+
*/
|
|
7
|
+
declare const muteWarnings: (options: {
|
|
8
|
+
warningsToIgnore: string[][];
|
|
9
|
+
debugWarnings?: boolean;
|
|
10
|
+
}) => Plugin;
|
|
11
|
+
|
|
12
|
+
export = muteWarnings;
|
|
@@ -0,0 +1,70 @@
|
|
|
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/muteWarnings.ts
|
|
21
|
+
var muteWarnings_exports = {};
|
|
22
|
+
__export(muteWarnings_exports, {
|
|
23
|
+
default: () => muteWarnings_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(muteWarnings_exports);
|
|
26
|
+
var muteWarnings = (options) => {
|
|
27
|
+
const mutedMessages = /* @__PURE__ */ new Set();
|
|
28
|
+
return {
|
|
29
|
+
name: "mute-warnings",
|
|
30
|
+
enforce: "pre",
|
|
31
|
+
config: (userConfig) => ({
|
|
32
|
+
build: {
|
|
33
|
+
rollupOptions: {
|
|
34
|
+
onwarn(warning, defaultHandler) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
if (warning.code) {
|
|
37
|
+
if (options.debugWarnings) {
|
|
38
|
+
console.warn(`${warning.code} - ${warning.message}`);
|
|
39
|
+
}
|
|
40
|
+
const muted = options.warningsToIgnore.find(
|
|
41
|
+
([code, message]) => code === warning.code && warning.message.includes(message)
|
|
42
|
+
);
|
|
43
|
+
if (muted) {
|
|
44
|
+
mutedMessages.add(muted.join());
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if ((_b = (_a = userConfig.build) == null ? void 0 : _a.rollupOptions) == null ? void 0 : _b.onwarn) {
|
|
49
|
+
userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
|
|
50
|
+
} else {
|
|
51
|
+
defaultHandler(warning);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
closeBundle() {
|
|
58
|
+
const diff = options.warningsToIgnore.filter(
|
|
59
|
+
(x) => !mutedMessages.has(x.join())
|
|
60
|
+
);
|
|
61
|
+
if (diff.length > 0) {
|
|
62
|
+
this.warn(
|
|
63
|
+
"Some of your muted warnings never appeared during the build process:"
|
|
64
|
+
);
|
|
65
|
+
diff.forEach((m) => this.warn(`- ${m.join(": ")}`));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
var muteWarnings_default = muteWarnings;
|
package/dist/cjs/viteConfig.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ interface ReactScriptsViteOptions {
|
|
|
11
11
|
aliasHq?: false;
|
|
12
12
|
envCompatible?: false | Parameters<typeof envCompatible>[1];
|
|
13
13
|
pwa?: false | Parameters<typeof VitePWA>[0];
|
|
14
|
-
checker
|
|
14
|
+
checker?: false | Parameters<typeof pluginChecker>[0];
|
|
15
15
|
envPrefix?: string;
|
|
16
|
+
splitVendorChunkPlugin?: false;
|
|
16
17
|
}
|
|
17
18
|
declare const pluginOptions: ReactScriptsViteOptions;
|
|
18
19
|
declare const viteConfig: UserConfigFn;
|
package/dist/cjs/viteConfig.js
CHANGED
|
@@ -37,6 +37,7 @@ 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");
|
|
40
41
|
var import_vite_plugin_checker = __toESM(require("vite-plugin-checker"));
|
|
41
42
|
var import_vite_plugin_environment = __toESM(require("vite-plugin-environment"));
|
|
42
43
|
var import_vite_plugin_pwa = require("vite-plugin-pwa");
|
|
@@ -84,7 +85,8 @@ var viteConfig = () => {
|
|
|
84
85
|
// PWA.
|
|
85
86
|
pluginOptions.pwa === false ? null : (0, import_vite_plugin_pwa.VitePWA)(pluginOptions.pwa),
|
|
86
87
|
// Check for issues.
|
|
87
|
-
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker)
|
|
88
|
+
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker || {}),
|
|
89
|
+
pluginOptions.splitVendorChunkPlugin === false ? null : (0, import_vite.splitVendorChunkPlugin)()
|
|
88
90
|
],
|
|
89
91
|
server: {
|
|
90
92
|
open: true,
|
|
@@ -98,7 +100,8 @@ var viteConfig = () => {
|
|
|
98
100
|
test: {
|
|
99
101
|
globals: true,
|
|
100
102
|
environment: "jsdom",
|
|
101
|
-
setupFiles: "./src/test/setup.ts"
|
|
103
|
+
setupFiles: "./src/test/setup.ts",
|
|
104
|
+
reporters: "verbose"
|
|
102
105
|
},
|
|
103
106
|
resolve: {
|
|
104
107
|
alias: pluginOptions.aliasHq === false ? {} : import_alias_hq.default.get("rollup")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mutes Rollup warnings.
|
|
5
|
+
* https://github.com/vitejs/vite/issues/15012#issuecomment-1825035992
|
|
6
|
+
*/
|
|
7
|
+
declare const muteWarnings: (options: {
|
|
8
|
+
warningsToIgnore: string[][];
|
|
9
|
+
debugWarnings?: boolean;
|
|
10
|
+
}) => Plugin;
|
|
11
|
+
|
|
12
|
+
export { muteWarnings as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/muteWarnings.ts
|
|
2
|
+
var muteWarnings = (options) => {
|
|
3
|
+
const mutedMessages = /* @__PURE__ */ new Set();
|
|
4
|
+
return {
|
|
5
|
+
name: "mute-warnings",
|
|
6
|
+
enforce: "pre",
|
|
7
|
+
config: (userConfig) => ({
|
|
8
|
+
build: {
|
|
9
|
+
rollupOptions: {
|
|
10
|
+
onwarn(warning, defaultHandler) {
|
|
11
|
+
if (warning.code) {
|
|
12
|
+
if (options.debugWarnings) {
|
|
13
|
+
console.warn(`${warning.code} - ${warning.message}`);
|
|
14
|
+
}
|
|
15
|
+
const muted = options.warningsToIgnore.find(
|
|
16
|
+
([code, message]) => code === warning.code && warning.message.includes(message)
|
|
17
|
+
);
|
|
18
|
+
if (muted) {
|
|
19
|
+
mutedMessages.add(muted.join());
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (userConfig.build?.rollupOptions?.onwarn) {
|
|
24
|
+
userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
|
|
25
|
+
} else {
|
|
26
|
+
defaultHandler(warning);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
closeBundle() {
|
|
33
|
+
const diff = options.warningsToIgnore.filter(
|
|
34
|
+
(x) => !mutedMessages.has(x.join())
|
|
35
|
+
);
|
|
36
|
+
if (diff.length > 0) {
|
|
37
|
+
this.warn(
|
|
38
|
+
"Some of your muted warnings never appeared during the build process:"
|
|
39
|
+
);
|
|
40
|
+
diff.forEach((m) => this.warn(`- ${m.join(": ")}`));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
var muteWarnings_default = muteWarnings;
|
|
46
|
+
export {
|
|
47
|
+
muteWarnings_default as default
|
|
48
|
+
};
|
|
@@ -11,8 +11,9 @@ interface ReactScriptsViteOptions {
|
|
|
11
11
|
aliasHq?: false;
|
|
12
12
|
envCompatible?: false | Parameters<typeof envCompatible>[1];
|
|
13
13
|
pwa?: false | Parameters<typeof VitePWA>[0];
|
|
14
|
-
checker
|
|
14
|
+
checker?: false | Parameters<typeof pluginChecker>[0];
|
|
15
15
|
envPrefix?: string;
|
|
16
|
+
splitVendorChunkPlugin?: false;
|
|
16
17
|
}
|
|
17
18
|
declare const pluginOptions: ReactScriptsViteOptions;
|
|
18
19
|
declare const viteConfig: UserConfigFn;
|
package/dist/esm/viteConfig.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
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";
|
|
5
6
|
import pluginChecker from "vite-plugin-checker";
|
|
6
7
|
import envCompatible from "vite-plugin-environment";
|
|
7
8
|
import { VitePWA } from "vite-plugin-pwa";
|
|
@@ -49,7 +50,8 @@ var viteConfig = () => {
|
|
|
49
50
|
// PWA.
|
|
50
51
|
pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
|
|
51
52
|
// Check for issues.
|
|
52
|
-
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(pluginOptions.checker)
|
|
53
|
+
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(pluginOptions.checker || {}),
|
|
54
|
+
pluginOptions.splitVendorChunkPlugin === false ? null : splitVendorChunkPlugin()
|
|
53
55
|
],
|
|
54
56
|
server: {
|
|
55
57
|
open: true,
|
|
@@ -63,7 +65,8 @@ var viteConfig = () => {
|
|
|
63
65
|
test: {
|
|
64
66
|
globals: true,
|
|
65
67
|
environment: "jsdom",
|
|
66
|
-
setupFiles: "./src/test/setup.ts"
|
|
68
|
+
setupFiles: "./src/test/setup.ts",
|
|
69
|
+
reporters: "verbose"
|
|
67
70
|
},
|
|
68
71
|
resolve: {
|
|
69
72
|
alias: pluginOptions.aliasHq === false ? {} : aliasHq.get("rollup")
|
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.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -20,10 +20,9 @@
|
|
|
20
20
|
"@promoboxx/eslint-config": "^3.2.0",
|
|
21
21
|
"@types/node": "^20.10.4",
|
|
22
22
|
"concurrently": "^8.2.2",
|
|
23
|
-
"
|
|
24
|
-
"prettier": "^3.1.0",
|
|
23
|
+
"prettier": "^3.1.1",
|
|
25
24
|
"tsup": "^8.0.1",
|
|
26
|
-
"typescript": "^5.3.
|
|
25
|
+
"typescript": "^5.3.3"
|
|
27
26
|
},
|
|
28
27
|
"exports": {
|
|
29
28
|
".": {
|
|
@@ -36,16 +35,16 @@
|
|
|
36
35
|
}
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"@vitejs/plugin-react": "^4.2.
|
|
38
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
40
39
|
"alias-hq": "^6.2.3",
|
|
41
40
|
"eslint": "^8.55.0",
|
|
42
|
-
"jsdom": "^23.0.
|
|
43
|
-
"vite": "^5.0.
|
|
41
|
+
"jsdom": "^23.0.1",
|
|
42
|
+
"vite": "^5.0.9",
|
|
44
43
|
"vite-plugin-checker": "^0.6.2",
|
|
45
44
|
"vite-plugin-environment": "^1.1.3",
|
|
46
|
-
"vite-plugin-pwa": "^0.17.
|
|
45
|
+
"vite-plugin-pwa": "^0.17.4",
|
|
47
46
|
"vite-plugin-svgr": "^4.2.0",
|
|
48
|
-
"vitest": "^0.
|
|
47
|
+
"vitest": "^1.0.4"
|
|
49
48
|
},
|
|
50
49
|
"files": [
|
|
51
50
|
"dist"
|