@promoboxx/react-scripts-vite 0.1.31-esm.3 → 0.1.31-esm.5
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.d.ts → cjs/cli.d.ts} +0 -1
- package/dist/{cli.js → cjs/cli.js} +5 -7
- package/dist/{index.d.ts → cjs/index.d.ts} +0 -1
- package/dist/cjs/index.js +40 -0
- package/dist/cjs/replaceEnvInHtml.js +46 -0
- package/dist/{viteConfig.d.ts → cjs/viteConfig.d.ts} +1 -2
- package/dist/cjs/viteConfig.js +110 -0
- package/dist/{cli.d.mts → esm/cli.d.mts} +0 -1
- package/dist/{cli.mjs → esm/cli.mjs} +1 -4
- package/dist/{index.d.mts → esm/index.d.mts} +0 -1
- package/dist/esm/index.mjs +5 -0
- package/dist/{replaceEnvInHtml.d.ts → esm/replaceEnvInHtml.d.mts} +1 -1
- package/dist/{chunk-7C4MM7WS.mjs → esm/replaceEnvInHtml.mjs} +1 -3
- package/dist/{viteConfig.d.mts → esm/viteConfig.d.mts} +1 -2
- package/dist/{chunk-GBKAEIOC.mjs → esm/viteConfig.mjs} +10 -14
- package/package.json +12 -12
- package/dist/chunk-D3BNAB2W.js +0 -25
- package/dist/chunk-MXTCNWUY.js +0 -80
- package/dist/client.d.d.mts +0 -2
- package/dist/client.d.d.ts +0 -2
- package/dist/client.d.js +0 -1
- package/dist/client.d.mjs +0 -0
- package/dist/index.js +0 -9
- package/dist/index.mjs +0 -9
- package/dist/replaceEnvInHtml.js +0 -8
- package/dist/replaceEnvInHtml.mjs +0 -6
- package/dist/viteConfig.js +0 -9
- package/dist/viteConfig.mjs +0 -9
- /package/dist/{replaceEnvInHtml.d.mts → cjs/replaceEnvInHtml.d.ts} +0 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// src/cli.ts
|
|
4
|
-
var _child_process = require('child_process');
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_child_process = require("child_process");
|
|
5
3
|
function main(command2, args2) {
|
|
6
4
|
switch (command2) {
|
|
7
5
|
case "start":
|
|
@@ -22,7 +20,7 @@ function main(command2, args2) {
|
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
function spawnAndExit(command2, args2 = [], env) {
|
|
25
|
-
const child =
|
|
23
|
+
const child = (0, import_child_process.spawn)(command2, args2, {
|
|
26
24
|
stdio: "inherit",
|
|
27
25
|
env: {
|
|
28
26
|
...process.env,
|
|
@@ -31,10 +29,10 @@ function spawnAndExit(command2, args2 = [], env) {
|
|
|
31
29
|
// shell: true,
|
|
32
30
|
});
|
|
33
31
|
child.on("exit", (code) => {
|
|
34
|
-
process.exit(
|
|
32
|
+
process.exit(code != null ? code : void 0);
|
|
35
33
|
});
|
|
36
34
|
}
|
|
37
|
-
|
|
35
|
+
const [
|
|
38
36
|
// We should probably change our eslint config to ignore unused variables that
|
|
39
37
|
// start with an underscore. TypeScript ignores them, Rust ignores, them, it's
|
|
40
38
|
// been a convention for almost two decades.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
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 });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
pluginOptions: () => import_viteConfig.pluginOptions,
|
|
32
|
+
viteConfig: () => import_viteConfig.default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
var import_viteConfig = __toESM(require("./viteConfig"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
pluginOptions,
|
|
39
|
+
viteConfig
|
|
40
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
var replaceEnvInHtml_exports = {};
|
|
20
|
+
__export(replaceEnvInHtml_exports, {
|
|
21
|
+
default: () => replaceEnvInHtml_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(replaceEnvInHtml_exports);
|
|
24
|
+
function replaceEnvInHtml() {
|
|
25
|
+
let config = void 0;
|
|
26
|
+
const plugin = {
|
|
27
|
+
name: "replace-env-in-html",
|
|
28
|
+
configResolved(resolvedConfig) {
|
|
29
|
+
config = resolvedConfig;
|
|
30
|
+
},
|
|
31
|
+
transformIndexHtml: {
|
|
32
|
+
order: "pre",
|
|
33
|
+
handler(html) {
|
|
34
|
+
return html.replace(
|
|
35
|
+
/%(.*?)%/g,
|
|
36
|
+
(match, envVarName) => {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
return (_b = (_a = config == null ? void 0 : config.env) == null ? void 0 : _a[envVarName]) != null ? _b : match;
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return plugin;
|
|
45
|
+
}
|
|
46
|
+
var replaceEnvInHtml_default = replaceEnvInHtml;
|
|
@@ -4,13 +4,12 @@ import pluginChecker from 'vite-plugin-checker';
|
|
|
4
4
|
import envCompatible from 'vite-plugin-environment';
|
|
5
5
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
6
6
|
import svgr from 'vite-plugin-svgr';
|
|
7
|
-
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
8
7
|
|
|
9
8
|
interface ReactScriptsViteOptions {
|
|
10
9
|
react?: false | Parameters<typeof react>[0];
|
|
11
10
|
svgr?: false | Parameters<typeof svgr>[0];
|
|
11
|
+
aliasHq?: false;
|
|
12
12
|
envCompatible?: false | Parameters<typeof envCompatible>[1];
|
|
13
|
-
tsconfigPaths?: false | Parameters<typeof tsconfigPaths>[0];
|
|
14
13
|
pwa?: false | Parameters<typeof VitePWA>[0];
|
|
15
14
|
checker: false | Parameters<typeof pluginChecker>[0];
|
|
16
15
|
envPrefix?: string;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
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 });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var viteConfig_exports = {};
|
|
30
|
+
__export(viteConfig_exports, {
|
|
31
|
+
default: () => viteConfig_default,
|
|
32
|
+
pluginOptions: () => pluginOptions
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(viteConfig_exports);
|
|
35
|
+
var import_fs = __toESM(require("fs"));
|
|
36
|
+
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
37
|
+
var import_alias_hq = __toESM(require("alias-hq"));
|
|
38
|
+
var import_vite_plugin_checker = __toESM(require("vite-plugin-checker"));
|
|
39
|
+
var import_vite_plugin_environment = __toESM(require("vite-plugin-environment"));
|
|
40
|
+
var import_vite_plugin_pwa = require("vite-plugin-pwa");
|
|
41
|
+
var import_vite_plugin_svgr = __toESM(require("vite-plugin-svgr"));
|
|
42
|
+
var import_replaceEnvInHtml = __toESM(require("./replaceEnvInHtml"));
|
|
43
|
+
const pluginOptions = {
|
|
44
|
+
checker: {
|
|
45
|
+
eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
|
|
46
|
+
lintCommand: `eslint --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{ts,tsx,js,jsx,mjs,cjs}"`
|
|
47
|
+
},
|
|
48
|
+
typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
|
|
49
|
+
enableBuild: true,
|
|
50
|
+
overlay: {
|
|
51
|
+
initialIsOpen: false
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
react: {
|
|
55
|
+
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const viteConfig = () => {
|
|
59
|
+
const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
|
|
60
|
+
if (pluginOptions.envCompatible !== false) {
|
|
61
|
+
pluginOptions.envCompatible = {
|
|
62
|
+
prefix: ENV_PREFIX,
|
|
63
|
+
...pluginOptions.envCompatible
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
base: process.env.PUBLIC_URL,
|
|
68
|
+
envPrefix: ENV_PREFIX,
|
|
69
|
+
build: {
|
|
70
|
+
outDir: process.env.BUILD_PATH || "build",
|
|
71
|
+
sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
|
|
72
|
+
assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4
|
|
73
|
+
},
|
|
74
|
+
plugins: [
|
|
75
|
+
// Replace %ENVIRONMENT_VARIABLES% in .html files
|
|
76
|
+
(0, import_replaceEnvInHtml.default)(),
|
|
77
|
+
// React specific.
|
|
78
|
+
pluginOptions.react === false ? null : (0, import_plugin_react.default)(pluginOptions.react),
|
|
79
|
+
pluginOptions.svgr === false ? null : (0, import_vite_plugin_svgr.default)(pluginOptions.svgr),
|
|
80
|
+
// import.meta.env -> process.env
|
|
81
|
+
pluginOptions.envCompatible === false ? null : (0, import_vite_plugin_environment.default)("all", pluginOptions.envCompatible),
|
|
82
|
+
// PWA.
|
|
83
|
+
pluginOptions.pwa === false ? null : (0, import_vite_plugin_pwa.VitePWA)(pluginOptions.pwa),
|
|
84
|
+
// Check for issues.
|
|
85
|
+
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker)
|
|
86
|
+
],
|
|
87
|
+
server: {
|
|
88
|
+
open: true,
|
|
89
|
+
host: process.env.HOST || "0.0.0.0",
|
|
90
|
+
port: process.env.PORT ? Number(process.env.PORT) : 3e3,
|
|
91
|
+
https: process.env.HTTPS === "true" ? {
|
|
92
|
+
cert: process.env.SSL_CRT_FILE ? import_fs.default.readFileSync(process.env.SSL_CRT_FILE) : void 0,
|
|
93
|
+
key: process.env.SSL_KEY_FILE ? import_fs.default.readFileSync(process.env.SSL_KEY_FILE) : void 0
|
|
94
|
+
} : void 0
|
|
95
|
+
},
|
|
96
|
+
test: {
|
|
97
|
+
globals: true,
|
|
98
|
+
environment: "jsdom",
|
|
99
|
+
setupFiles: "./src/test/setup.ts"
|
|
100
|
+
},
|
|
101
|
+
resolve: {
|
|
102
|
+
alias: pluginOptions.aliasHq === false ? {} : import_alias_hq.default.get("rollup")
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
var viteConfig_default = viteConfig;
|
|
107
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
108
|
+
0 && (module.exports = {
|
|
109
|
+
pluginOptions
|
|
110
|
+
});
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/cli.ts
|
|
4
1
|
import { spawn } from "child_process";
|
|
5
2
|
function main(command2, args2) {
|
|
6
3
|
switch (command2) {
|
|
@@ -34,7 +31,7 @@ function spawnAndExit(command2, args2 = [], env) {
|
|
|
34
31
|
process.exit(code ?? void 0);
|
|
35
32
|
});
|
|
36
33
|
}
|
|
37
|
-
|
|
34
|
+
const [
|
|
38
35
|
// We should probably change our eslint config to ignore unused variables that
|
|
39
36
|
// start with an underscore. TypeScript ignores them, Rust ignores, them, it's
|
|
40
37
|
// been a convention for almost two decades.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// src/replaceEnvInHtml.ts
|
|
2
1
|
function replaceEnvInHtml() {
|
|
3
2
|
let config = void 0;
|
|
4
3
|
const plugin = {
|
|
@@ -19,7 +18,6 @@ function replaceEnvInHtml() {
|
|
|
19
18
|
return plugin;
|
|
20
19
|
}
|
|
21
20
|
var replaceEnvInHtml_default = replaceEnvInHtml;
|
|
22
|
-
|
|
23
21
|
export {
|
|
24
|
-
replaceEnvInHtml_default
|
|
22
|
+
replaceEnvInHtml_default as default
|
|
25
23
|
};
|
|
@@ -4,13 +4,12 @@ import pluginChecker from 'vite-plugin-checker';
|
|
|
4
4
|
import envCompatible from 'vite-plugin-environment';
|
|
5
5
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
6
6
|
import svgr from 'vite-plugin-svgr';
|
|
7
|
-
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
8
7
|
|
|
9
8
|
interface ReactScriptsViteOptions {
|
|
10
9
|
react?: false | Parameters<typeof react>[0];
|
|
11
10
|
svgr?: false | Parameters<typeof svgr>[0];
|
|
11
|
+
aliasHq?: false;
|
|
12
12
|
envCompatible?: false | Parameters<typeof envCompatible>[1];
|
|
13
|
-
tsconfigPaths?: false | Parameters<typeof tsconfigPaths>[0];
|
|
14
13
|
pwa?: false | Parameters<typeof VitePWA>[0];
|
|
15
14
|
checker: false | Parameters<typeof pluginChecker>[0];
|
|
16
15
|
envPrefix?: string;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
replaceEnvInHtml_default
|
|
3
|
-
} from "./chunk-7C4MM7WS.mjs";
|
|
4
|
-
|
|
5
|
-
// src/viteConfig.ts
|
|
6
1
|
import fs from "fs";
|
|
7
2
|
import react from "@vitejs/plugin-react";
|
|
3
|
+
import aliasHq from "alias-hq";
|
|
8
4
|
import pluginChecker from "vite-plugin-checker";
|
|
9
5
|
import envCompatible from "vite-plugin-environment";
|
|
10
6
|
import { VitePWA } from "vite-plugin-pwa";
|
|
11
7
|
import svgr from "vite-plugin-svgr";
|
|
12
|
-
import
|
|
13
|
-
|
|
8
|
+
import replaceEnvInHtml from "./replaceEnvInHtml";
|
|
9
|
+
const pluginOptions = {
|
|
14
10
|
checker: {
|
|
15
11
|
eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
|
|
16
12
|
lintCommand: `eslint --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{ts,tsx,js,jsx,mjs,cjs}"`
|
|
@@ -25,7 +21,7 @@ var pluginOptions = {
|
|
|
25
21
|
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
|
|
26
22
|
}
|
|
27
23
|
};
|
|
28
|
-
|
|
24
|
+
const viteConfig = () => {
|
|
29
25
|
const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
|
|
30
26
|
if (pluginOptions.envCompatible !== false) {
|
|
31
27
|
pluginOptions.envCompatible = {
|
|
@@ -43,14 +39,12 @@ var viteConfig = () => {
|
|
|
43
39
|
},
|
|
44
40
|
plugins: [
|
|
45
41
|
// Replace %ENVIRONMENT_VARIABLES% in .html files
|
|
46
|
-
|
|
42
|
+
replaceEnvInHtml(),
|
|
47
43
|
// React specific.
|
|
48
44
|
pluginOptions.react === false ? null : react(pluginOptions.react),
|
|
49
45
|
pluginOptions.svgr === false ? null : svgr(pluginOptions.svgr),
|
|
50
46
|
// import.meta.env -> process.env
|
|
51
47
|
pluginOptions.envCompatible === false ? null : envCompatible("all", pluginOptions.envCompatible),
|
|
52
|
-
// Support TypeScript paths.
|
|
53
|
-
pluginOptions.tsconfigPaths === false ? null : tsconfigPaths(pluginOptions.tsconfigPaths),
|
|
54
48
|
// PWA.
|
|
55
49
|
pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
|
|
56
50
|
// Check for issues.
|
|
@@ -69,12 +63,14 @@ var viteConfig = () => {
|
|
|
69
63
|
globals: true,
|
|
70
64
|
environment: "jsdom",
|
|
71
65
|
setupFiles: "./src/test/setup.ts"
|
|
66
|
+
},
|
|
67
|
+
resolve: {
|
|
68
|
+
alias: pluginOptions.aliasHq === false ? {} : aliasHq.get("rollup")
|
|
72
69
|
}
|
|
73
70
|
};
|
|
74
71
|
};
|
|
75
72
|
var viteConfig_default = viteConfig;
|
|
76
|
-
|
|
77
73
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
viteConfig_default as default,
|
|
75
|
+
pluginOptions
|
|
80
76
|
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promoboxx/react-scripts-vite",
|
|
3
|
-
"version": "0.1.31-esm.
|
|
3
|
+
"version": "0.1.31-esm.5",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"module": "./dist/index.mjs",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.mjs",
|
|
7
7
|
"keywords": [],
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/promoboxx/react-scripts-vite"
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
|
-
"react-scripts-esm": "./dist/cli.mjs",
|
|
13
|
-
"react-scripts-vite-esm": "./dist/cli.mjs",
|
|
14
|
-
"react-scripts": "./dist/cli.js",
|
|
15
|
-
"react-scripts-vite": "./dist/cli.js"
|
|
12
|
+
"react-scripts-esm": "./dist/esm/cli.mjs",
|
|
13
|
+
"react-scripts-vite-esm": "./dist/esm/cli.mjs",
|
|
14
|
+
"react-scripts": "./dist/cjs/cli.js",
|
|
15
|
+
"react-scripts-vite": "./dist/cjs/cli.js"
|
|
16
16
|
},
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
@@ -25,16 +25,17 @@
|
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
-
"import": "./dist/index.mjs",
|
|
29
|
-
"require": "./dist/index.js"
|
|
28
|
+
"import": "./dist/esm/index.mjs",
|
|
29
|
+
"require": "./dist/cjs/index.js"
|
|
30
30
|
},
|
|
31
31
|
"./*": {
|
|
32
|
-
"import": "./dist/*.mjs",
|
|
33
|
-
"require": "./dist/*.js"
|
|
32
|
+
"import": "./dist/esm/*.mjs",
|
|
33
|
+
"require": "./dist/cjs/*.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@vitejs/plugin-react": "^4.2.0",
|
|
38
|
+
"alias-hq": "^6.2.3",
|
|
38
39
|
"eslint": "^8.54.0",
|
|
39
40
|
"jsdom": "^23.0.0",
|
|
40
41
|
"vite": "^5.0.2",
|
|
@@ -42,7 +43,6 @@
|
|
|
42
43
|
"vite-plugin-environment": "^1.1.3",
|
|
43
44
|
"vite-plugin-pwa": "^0.17.2",
|
|
44
45
|
"vite-plugin-svgr": "^4.2.0",
|
|
45
|
-
"vite-tsconfig-paths": "^4.2.1",
|
|
46
46
|
"vitest": "^0.34.6"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
package/dist/chunk-D3BNAB2W.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/replaceEnvInHtml.ts
|
|
2
|
-
function replaceEnvInHtml() {
|
|
3
|
-
let config = void 0;
|
|
4
|
-
const plugin = {
|
|
5
|
-
name: "replace-env-in-html",
|
|
6
|
-
configResolved(resolvedConfig) {
|
|
7
|
-
config = resolvedConfig;
|
|
8
|
-
},
|
|
9
|
-
transformIndexHtml: {
|
|
10
|
-
order: "pre",
|
|
11
|
-
handler(html) {
|
|
12
|
-
return html.replace(
|
|
13
|
-
/%(.*?)%/g,
|
|
14
|
-
(match, envVarName) => _nullishCoalesce(_optionalChain([config, 'optionalAccess', _ => _.env, 'optionalAccess', _2 => _2[envVarName]]), () => ( match))
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
return plugin;
|
|
20
|
-
}
|
|
21
|
-
var replaceEnvInHtml_default = replaceEnvInHtml;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
exports.replaceEnvInHtml_default = replaceEnvInHtml_default;
|
package/dist/chunk-MXTCNWUY.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
-
|
|
3
|
-
var _chunkD3BNAB2Wjs = require('./chunk-D3BNAB2W.js');
|
|
4
|
-
|
|
5
|
-
// src/viteConfig.ts
|
|
6
|
-
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
7
|
-
var _pluginreact = require('@vitejs/plugin-react'); var _pluginreact2 = _interopRequireDefault(_pluginreact);
|
|
8
|
-
var _vitepluginchecker = require('vite-plugin-checker'); var _vitepluginchecker2 = _interopRequireDefault(_vitepluginchecker);
|
|
9
|
-
var _vitepluginenvironment = require('vite-plugin-environment'); var _vitepluginenvironment2 = _interopRequireDefault(_vitepluginenvironment);
|
|
10
|
-
var _vitepluginpwa = require('vite-plugin-pwa');
|
|
11
|
-
var _vitepluginsvgr = require('vite-plugin-svgr'); var _vitepluginsvgr2 = _interopRequireDefault(_vitepluginsvgr);
|
|
12
|
-
var _vitetsconfigpaths = require('vite-tsconfig-paths'); var _vitetsconfigpaths2 = _interopRequireDefault(_vitetsconfigpaths);
|
|
13
|
-
var pluginOptions = {
|
|
14
|
-
checker: {
|
|
15
|
-
eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
|
|
16
|
-
lintCommand: `eslint --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{ts,tsx,js,jsx,mjs,cjs}"`
|
|
17
|
-
},
|
|
18
|
-
typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
|
|
19
|
-
enableBuild: true,
|
|
20
|
-
overlay: {
|
|
21
|
-
initialIsOpen: false
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
react: {
|
|
25
|
-
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === "true" ? "classic" : void 0
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var viteConfig = () => {
|
|
29
|
-
const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
|
|
30
|
-
if (pluginOptions.envCompatible !== false) {
|
|
31
|
-
pluginOptions.envCompatible = {
|
|
32
|
-
prefix: ENV_PREFIX,
|
|
33
|
-
...pluginOptions.envCompatible
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
base: process.env.PUBLIC_URL,
|
|
38
|
-
envPrefix: ENV_PREFIX,
|
|
39
|
-
build: {
|
|
40
|
-
outDir: process.env.BUILD_PATH || "build",
|
|
41
|
-
sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
|
|
42
|
-
assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4
|
|
43
|
-
},
|
|
44
|
-
plugins: [
|
|
45
|
-
// Replace %ENVIRONMENT_VARIABLES% in .html files
|
|
46
|
-
_chunkD3BNAB2Wjs.replaceEnvInHtml_default.call(void 0, ),
|
|
47
|
-
// React specific.
|
|
48
|
-
pluginOptions.react === false ? null : _pluginreact2.default.call(void 0, pluginOptions.react),
|
|
49
|
-
pluginOptions.svgr === false ? null : _vitepluginsvgr2.default.call(void 0, pluginOptions.svgr),
|
|
50
|
-
// import.meta.env -> process.env
|
|
51
|
-
pluginOptions.envCompatible === false ? null : _vitepluginenvironment2.default.call(void 0, "all", pluginOptions.envCompatible),
|
|
52
|
-
// Support TypeScript paths.
|
|
53
|
-
pluginOptions.tsconfigPaths === false ? null : _vitetsconfigpaths2.default.call(void 0, pluginOptions.tsconfigPaths),
|
|
54
|
-
// PWA.
|
|
55
|
-
pluginOptions.pwa === false ? null : _vitepluginpwa.VitePWA.call(void 0, pluginOptions.pwa),
|
|
56
|
-
// Check for issues.
|
|
57
|
-
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : _vitepluginchecker2.default.call(void 0, pluginOptions.checker)
|
|
58
|
-
],
|
|
59
|
-
server: {
|
|
60
|
-
open: true,
|
|
61
|
-
host: process.env.HOST || "0.0.0.0",
|
|
62
|
-
port: process.env.PORT ? Number(process.env.PORT) : 3e3,
|
|
63
|
-
https: process.env.HTTPS === "true" ? {
|
|
64
|
-
cert: process.env.SSL_CRT_FILE ? _fs2.default.readFileSync(process.env.SSL_CRT_FILE) : void 0,
|
|
65
|
-
key: process.env.SSL_KEY_FILE ? _fs2.default.readFileSync(process.env.SSL_KEY_FILE) : void 0
|
|
66
|
-
} : void 0
|
|
67
|
-
},
|
|
68
|
-
test: {
|
|
69
|
-
globals: true,
|
|
70
|
-
environment: "jsdom",
|
|
71
|
-
setupFiles: "./src/test/setup.ts"
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
var viteConfig_default = viteConfig;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
exports.pluginOptions = pluginOptions; exports.viteConfig_default = viteConfig_default;
|
package/dist/client.d.d.mts
DELETED
package/dist/client.d.d.ts
DELETED
package/dist/client.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/client.d.mjs
DELETED
|
File without changes
|
package/dist/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkMXTCNWUYjs = require('./chunk-MXTCNWUY.js');
|
|
5
|
-
require('./chunk-D3BNAB2W.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.pluginOptions = _chunkMXTCNWUYjs.pluginOptions; exports.viteConfig = _chunkMXTCNWUYjs.viteConfig_default;
|
package/dist/index.mjs
DELETED
package/dist/replaceEnvInHtml.js
DELETED
package/dist/viteConfig.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkMXTCNWUYjs = require('./chunk-MXTCNWUY.js');
|
|
5
|
-
require('./chunk-D3BNAB2W.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.default = _chunkMXTCNWUYjs.viteConfig_default; exports.pluginOptions = _chunkMXTCNWUYjs.pluginOptions;
|
package/dist/viteConfig.mjs
DELETED
|
File without changes
|