@promoboxx/react-scripts-vite 0.1.31-esm.3 → 0.1.31

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 CHANGED
@@ -1,6 +1,2 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="vite-plugin-svgr/client" />
3
- /// <reference types="vitest/globals" />
4
- /// <reference types="vite-plugin-pwa/vanillajs" />
5
- /// <reference types="vite-plugin-pwa/react" />
6
1
  #!/usr/bin/env node
2
+ export {};
package/dist/cli.js CHANGED
@@ -1,49 +1,47 @@
1
1
  #!/usr/bin/env node
2
- "use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
3
- // src/cli.ts
4
- var _child_process = require('child_process');
5
- function main(command2, args2) {
6
- switch (command2) {
7
- case "start":
8
- spawnAndExit("./node_modules/.bin/vite", args2, {
9
- NODE_ENV: "development"
10
- });
11
- break;
12
- case "test":
13
- spawnAndExit("./node_modules/.bin/vitest", args2, { NODE_ENV: "test" });
14
- break;
15
- case "build":
16
- spawnAndExit("./node_modules/.bin/vite", ["build", ...args2], {
17
- NODE_ENV: "production"
18
- });
19
- break;
20
- default:
21
- throw new Error(`Unknown command: ${command2}`);
22
- }
23
- }
24
- function spawnAndExit(command2, args2 = [], env) {
25
- const child = _child_process.spawn.call(void 0, command2, args2, {
26
- stdio: "inherit",
27
- env: {
28
- ...process.env,
29
- ...env
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const child_process_1 = require("child_process");
5
+ function main(command, args) {
6
+ switch (command) {
7
+ case 'start':
8
+ spawnAndExit('./node_modules/.bin/vite', args, {
9
+ NODE_ENV: 'development',
10
+ });
11
+ break;
12
+ case 'test':
13
+ spawnAndExit('./node_modules/.bin/vitest', args, { NODE_ENV: 'test' });
14
+ break;
15
+ case 'build':
16
+ spawnAndExit('./node_modules/.bin/vite', ['build', ...args], {
17
+ NODE_ENV: 'production',
18
+ });
19
+ break;
20
+ default:
21
+ throw new Error(`Unknown command: ${command}`);
30
22
  }
31
- // shell: true,
32
- });
33
- child.on("exit", (code) => {
34
- process.exit(_nullishCoalesce(code, () => ( void 0)));
35
- });
36
23
  }
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;
24
+ function spawnAndExit(command, args = [], env) {
25
+ const child = (0, child_process_1.spawn)(command, args, {
26
+ stdio: 'inherit',
27
+ env: {
28
+ ...process.env,
29
+ ...env,
30
+ },
31
+ // shell: true,
32
+ });
33
+ child.on('exit', (code) => {
34
+ process.exit(code ?? undefined);
35
+ });
36
+ }
37
+ const [
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, command, ...args] = process.argv;
49
46
  main(command, args);
47
+ //# sourceMappingURL=cli.js.map
package/dist/index.d.ts CHANGED
@@ -1,8 +1 @@
1
- export { pluginOptions, default as viteConfig } from './viteConfig.js';
2
- import '@vitejs/plugin-react';
3
- import 'vite';
4
- import 'vite-plugin-checker';
5
- import 'vite-plugin-environment';
6
- import 'vite-plugin-pwa';
7
- import 'vite-plugin-svgr';
8
- import 'vite-tsconfig-paths';
1
+ export { default as viteConfig, pluginOptions } from './viteConfig';
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
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;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.pluginOptions = exports.viteConfig = void 0;
7
+ var viteConfig_1 = require("./viteConfig");
8
+ Object.defineProperty(exports, "viteConfig", { enumerable: true, get: function () { return __importDefault(viteConfig_1).default; } });
9
+ Object.defineProperty(exports, "pluginOptions", { enumerable: true, get: function () { return viteConfig_1.pluginOptions; } });
10
+ //# sourceMappingURL=index.js.map
@@ -1,10 +1,8 @@
1
- import { Plugin } from 'vite';
2
-
1
+ import { type Plugin } from 'vite';
3
2
  /**
4
3
  * Replace env variables in index.html
5
4
  * @see https://github.com/vitejs/vite/issues/3105#issuecomment-939703781
6
5
  * @see https://vitejs.dev/guide/api-plugin.html#transformindexhtml
7
6
  */
8
7
  declare function replaceEnvInHtml(): Plugin<any>;
9
-
10
- export = replaceEnvInHtml;
8
+ export default replaceEnvInHtml;
@@ -1,8 +1,25 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkD3BNAB2Wjs = require('./chunk-D3BNAB2W.js');
4
-
5
-
6
- exports.default = _chunkD3BNAB2Wjs.replaceEnvInHtml_default;
7
-
8
- module.exports = exports.default;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Replace env variables in index.html
5
+ * @see https://github.com/vitejs/vite/issues/3105#issuecomment-939703781
6
+ * @see https://vitejs.dev/guide/api-plugin.html#transformindexhtml
7
+ */
8
+ function replaceEnvInHtml() {
9
+ let config = undefined;
10
+ const plugin = {
11
+ name: 'replace-env-in-html',
12
+ configResolved(resolvedConfig) {
13
+ config = resolvedConfig;
14
+ },
15
+ transformIndexHtml: {
16
+ order: 'pre',
17
+ handler(html) {
18
+ return html.replace(/%(.*?)%/g, (match, envVarName) => config?.env?.[envVarName] ?? match);
19
+ },
20
+ },
21
+ };
22
+ return plugin;
23
+ }
24
+ exports.default = replaceEnvInHtml;
25
+ //# sourceMappingURL=replaceEnvInHtml.js.map
@@ -1,21 +1,18 @@
1
1
  import react from '@vitejs/plugin-react';
2
- import { UserConfigFn } from 'vite';
2
+ import { type UserConfigFn } from 'vite';
3
3
  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
-
9
7
  interface ReactScriptsViteOptions {
10
8
  react?: false | Parameters<typeof react>[0];
11
9
  svgr?: false | Parameters<typeof svgr>[0];
10
+ aliasHq?: false;
12
11
  envCompatible?: false | Parameters<typeof envCompatible>[1];
13
- tsconfigPaths?: false | Parameters<typeof tsconfigPaths>[0];
14
12
  pwa?: false | Parameters<typeof VitePWA>[0];
15
13
  checker: false | Parameters<typeof pluginChecker>[0];
16
14
  envPrefix?: string;
17
15
  }
18
- declare const pluginOptions: ReactScriptsViteOptions;
16
+ export declare const pluginOptions: ReactScriptsViteOptions;
19
17
  declare const viteConfig: UserConfigFn;
20
-
21
- export { viteConfig as default, pluginOptions };
18
+ export default viteConfig;
@@ -1,9 +1,93 @@
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;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.pluginOptions = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const plugin_react_1 = __importDefault(require("@vitejs/plugin-react"));
9
+ const alias_hq_1 = __importDefault(require("alias-hq"));
10
+ const vite_plugin_checker_1 = __importDefault(require("vite-plugin-checker"));
11
+ const vite_plugin_environment_1 = __importDefault(require("vite-plugin-environment"));
12
+ const vite_plugin_pwa_1 = require("vite-plugin-pwa");
13
+ const vite_plugin_svgr_1 = __importDefault(require("vite-plugin-svgr"));
14
+ const replaceEnvInHtml_1 = __importDefault(require("./replaceEnvInHtml"));
15
+ exports.pluginOptions = {
16
+ checker: {
17
+ eslint: process.env.DISABLE_ESLINT_PLUGIN === 'true'
18
+ ? undefined
19
+ : {
20
+ lintCommand: `eslint --max-warnings=${process.env.CI === 'true' ? 0 : -1} "./src/**/*.{ts,tsx,js,jsx,mjs,cjs}"`,
21
+ },
22
+ typescript: process.env.TSC_COMPILE_ON_ERROR !== 'true',
23
+ enableBuild: true,
24
+ overlay: {
25
+ initialIsOpen: false,
26
+ },
27
+ },
28
+ react: {
29
+ jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === 'true' ? 'classic' : undefined,
30
+ },
31
+ };
32
+ const viteConfig = () => {
33
+ const ENV_PREFIX = exports.pluginOptions.envPrefix || 'REACT_APP_';
34
+ if (exports.pluginOptions.envCompatible !== false) {
35
+ exports.pluginOptions.envCompatible = {
36
+ prefix: ENV_PREFIX,
37
+ ...exports.pluginOptions.envCompatible,
38
+ };
39
+ }
40
+ return {
41
+ base: process.env.PUBLIC_URL,
42
+ envPrefix: ENV_PREFIX,
43
+ build: {
44
+ outDir: process.env.BUILD_PATH || 'build',
45
+ sourcemap: process.env.GENERATE_SOURCEMAP !== 'false',
46
+ assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT
47
+ ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT)
48
+ : 10000,
49
+ },
50
+ plugins: [
51
+ // Replace %ENVIRONMENT_VARIABLES% in .html files
52
+ (0, replaceEnvInHtml_1.default)(),
53
+ // React specific.
54
+ exports.pluginOptions.react === false ? null : (0, plugin_react_1.default)(exports.pluginOptions.react),
55
+ exports.pluginOptions.svgr === false ? null : (0, vite_plugin_svgr_1.default)(exports.pluginOptions.svgr),
56
+ // import.meta.env -> process.env
57
+ exports.pluginOptions.envCompatible === false
58
+ ? null
59
+ : (0, vite_plugin_environment_1.default)('all', exports.pluginOptions.envCompatible),
60
+ // PWA.
61
+ exports.pluginOptions.pwa === false ? null : (0, vite_plugin_pwa_1.VitePWA)(exports.pluginOptions.pwa),
62
+ // Check for issues.
63
+ process.env.NODE_ENV === 'test' || exports.pluginOptions.checker === false
64
+ ? null
65
+ : (0, vite_plugin_checker_1.default)(exports.pluginOptions.checker),
66
+ ],
67
+ server: {
68
+ open: true,
69
+ host: process.env.HOST || '0.0.0.0',
70
+ port: process.env.PORT ? Number(process.env.PORT) : 3000,
71
+ https: process.env.HTTPS === 'true'
72
+ ? {
73
+ cert: process.env.SSL_CRT_FILE
74
+ ? fs_1.default.readFileSync(process.env.SSL_CRT_FILE)
75
+ : undefined,
76
+ key: process.env.SSL_KEY_FILE
77
+ ? fs_1.default.readFileSync(process.env.SSL_KEY_FILE)
78
+ : undefined,
79
+ }
80
+ : undefined,
81
+ },
82
+ test: {
83
+ globals: true,
84
+ environment: 'jsdom',
85
+ setupFiles: './src/test/setup.ts',
86
+ },
87
+ resolve: {
88
+ alias: exports.pluginOptions.aliasHq === false ? {} : alias_hq_1.default.get('rollup'),
89
+ },
90
+ };
91
+ };
92
+ exports.default = viteConfig;
93
+ //# sourceMappingURL=viteConfig.js.map
package/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "@promoboxx/react-scripts-vite",
3
- "version": "0.1.31-esm.3",
3
+ "version": "0.1.31",
4
4
  "description": "",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.mjs",
5
+ "main": "dist/index.js",
7
6
  "keywords": [],
8
7
  "repository": {
9
8
  "url": "https://github.com/promoboxx/react-scripts-vite"
10
9
  },
11
10
  "bin": {
12
- "react-scripts-esm": "./dist/cli.mjs",
13
- "react-scripts-vite-esm": "./dist/cli.mjs",
14
11
  "react-scripts": "./dist/cli.js",
15
12
  "react-scripts-vite": "./dist/cli.js"
16
13
  },
@@ -18,23 +15,12 @@
18
15
  "license": "ISC",
19
16
  "devDependencies": {
20
17
  "@promoboxx/eslint-config": "^3.1.0",
21
- "concurrently": "^8.2.2",
22
18
  "prettier": "^3.1.0",
23
- "tsup": "^8.0.1",
24
19
  "typescript": "^5.3.2"
25
20
  },
26
- "exports": {
27
- ".": {
28
- "import": "./dist/index.mjs",
29
- "require": "./dist/index.js"
30
- },
31
- "./*": {
32
- "import": "./dist/*.mjs",
33
- "require": "./dist/*.js"
34
- }
35
- },
36
21
  "dependencies": {
37
22
  "@vitejs/plugin-react": "^4.2.0",
23
+ "alias-hq": "^6.2.3",
38
24
  "eslint": "^8.54.0",
39
25
  "jsdom": "^23.0.0",
40
26
  "vite": "^5.0.2",
@@ -42,10 +28,17 @@
42
28
  "vite-plugin-environment": "^1.1.3",
43
29
  "vite-plugin-pwa": "^0.17.2",
44
30
  "vite-plugin-svgr": "^4.2.0",
45
- "vite-tsconfig-paths": "^4.2.1",
46
31
  "vitest": "^0.34.6"
47
32
  },
48
33
  "files": [
49
- "dist/*"
34
+ "dist/cli.d.ts",
35
+ "dist/client.d.ts",
36
+ "dist/cli.js",
37
+ "dist/index.d.ts",
38
+ "dist/index.js",
39
+ "dist/replaceEnvInHtml.d.ts",
40
+ "dist/replaceEnvInHtml.js",
41
+ "dist/viteConfig.d.ts",
42
+ "dist/viteConfig.js"
50
43
  ]
51
44
  }
@@ -1,25 +0,0 @@
1
- // 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) => config?.env?.[envVarName] ?? match
15
- );
16
- }
17
- }
18
- };
19
- return plugin;
20
- }
21
- var replaceEnvInHtml_default = replaceEnvInHtml;
22
-
23
- export {
24
- replaceEnvInHtml_default
25
- };
@@ -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;
@@ -1,80 +0,0 @@
1
- import {
2
- replaceEnvInHtml_default
3
- } from "./chunk-7C4MM7WS.mjs";
4
-
5
- // src/viteConfig.ts
6
- import fs from "fs";
7
- import react from "@vitejs/plugin-react";
8
- import pluginChecker from "vite-plugin-checker";
9
- import envCompatible from "vite-plugin-environment";
10
- import { VitePWA } from "vite-plugin-pwa";
11
- import svgr from "vite-plugin-svgr";
12
- import tsconfigPaths from "vite-tsconfig-paths";
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
- replaceEnvInHtml_default(),
47
- // React specific.
48
- pluginOptions.react === false ? null : react(pluginOptions.react),
49
- pluginOptions.svgr === false ? null : svgr(pluginOptions.svgr),
50
- // import.meta.env -> process.env
51
- pluginOptions.envCompatible === false ? null : envCompatible("all", pluginOptions.envCompatible),
52
- // Support TypeScript paths.
53
- pluginOptions.tsconfigPaths === false ? null : tsconfigPaths(pluginOptions.tsconfigPaths),
54
- // PWA.
55
- pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
56
- // Check for issues.
57
- process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(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 ? fs.readFileSync(process.env.SSL_CRT_FILE) : void 0,
65
- key: process.env.SSL_KEY_FILE ? fs.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
- export {
78
- pluginOptions,
79
- viteConfig_default
80
- };
@@ -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/cli.d.mts DELETED
@@ -1,6 +0,0 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="vite-plugin-svgr/client" />
3
- /// <reference types="vitest/globals" />
4
- /// <reference types="vite-plugin-pwa/vanillajs" />
5
- /// <reference types="vite-plugin-pwa/react" />
6
- #!/usr/bin/env node
package/dist/cli.mjs DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/cli.ts
4
- import { spawn } from "child_process";
5
- function main(command2, args2) {
6
- switch (command2) {
7
- case "start":
8
- spawnAndExit("./node_modules/.bin/vite", args2, {
9
- NODE_ENV: "development"
10
- });
11
- break;
12
- case "test":
13
- spawnAndExit("./node_modules/.bin/vitest", args2, { NODE_ENV: "test" });
14
- break;
15
- case "build":
16
- spawnAndExit("./node_modules/.bin/vite", ["build", ...args2], {
17
- NODE_ENV: "production"
18
- });
19
- break;
20
- default:
21
- throw new Error(`Unknown command: ${command2}`);
22
- }
23
- }
24
- function spawnAndExit(command2, args2 = [], env) {
25
- const child = spawn(command2, args2, {
26
- stdio: "inherit",
27
- env: {
28
- ...process.env,
29
- ...env
30
- }
31
- // shell: true,
32
- });
33
- child.on("exit", (code) => {
34
- process.exit(code ?? void 0);
35
- });
36
- }
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;
49
- main(command, args);
@@ -1,2 +0,0 @@
1
-
2
- export { }
@@ -1,2 +0,0 @@
1
-
2
- export { }
package/dist/client.d.js DELETED
@@ -1 +0,0 @@
1
- "use strict";
package/dist/client.d.mjs DELETED
File without changes
package/dist/index.d.mts DELETED
@@ -1,8 +0,0 @@
1
- export { pluginOptions, default as viteConfig } from './viteConfig.mjs';
2
- import '@vitejs/plugin-react';
3
- import 'vite';
4
- import 'vite-plugin-checker';
5
- import 'vite-plugin-environment';
6
- import 'vite-plugin-pwa';
7
- import 'vite-plugin-svgr';
8
- import 'vite-tsconfig-paths';
package/dist/index.mjs DELETED
@@ -1,9 +0,0 @@
1
- import {
2
- pluginOptions,
3
- viteConfig_default
4
- } from "./chunk-GBKAEIOC.mjs";
5
- import "./chunk-7C4MM7WS.mjs";
6
- export {
7
- pluginOptions,
8
- viteConfig_default as viteConfig
9
- };
@@ -1,10 +0,0 @@
1
- import { Plugin } from 'vite';
2
-
3
- /**
4
- * Replace env variables in index.html
5
- * @see https://github.com/vitejs/vite/issues/3105#issuecomment-939703781
6
- * @see https://vitejs.dev/guide/api-plugin.html#transformindexhtml
7
- */
8
- declare function replaceEnvInHtml(): Plugin<any>;
9
-
10
- export { replaceEnvInHtml as default };
@@ -1,6 +0,0 @@
1
- import {
2
- replaceEnvInHtml_default
3
- } from "./chunk-7C4MM7WS.mjs";
4
- export {
5
- replaceEnvInHtml_default as default
6
- };
@@ -1,21 +0,0 @@
1
- import react from '@vitejs/plugin-react';
2
- import { UserConfigFn } from 'vite';
3
- import pluginChecker from 'vite-plugin-checker';
4
- import envCompatible from 'vite-plugin-environment';
5
- import { VitePWA } from 'vite-plugin-pwa';
6
- import svgr from 'vite-plugin-svgr';
7
- import tsconfigPaths from 'vite-tsconfig-paths';
8
-
9
- interface ReactScriptsViteOptions {
10
- react?: false | Parameters<typeof react>[0];
11
- svgr?: false | Parameters<typeof svgr>[0];
12
- envCompatible?: false | Parameters<typeof envCompatible>[1];
13
- tsconfigPaths?: false | Parameters<typeof tsconfigPaths>[0];
14
- pwa?: false | Parameters<typeof VitePWA>[0];
15
- checker: false | Parameters<typeof pluginChecker>[0];
16
- envPrefix?: string;
17
- }
18
- declare const pluginOptions: ReactScriptsViteOptions;
19
- declare const viteConfig: UserConfigFn;
20
-
21
- export { viteConfig as default, pluginOptions };
@@ -1,9 +0,0 @@
1
- import {
2
- pluginOptions,
3
- viteConfig_default
4
- } from "./chunk-GBKAEIOC.mjs";
5
- import "./chunk-7C4MM7WS.mjs";
6
- export {
7
- viteConfig_default as default,
8
- pluginOptions
9
- };