Skip to content

Commit 028a8ac

Browse files
- Removed the indexBrowser implementation since the typechecking handles it much more simply
1 parent 674c20e commit 028a8ac

File tree

4 files changed

+4
-158
lines changed

4 files changed

+4
-158
lines changed

packages/playground/vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default defineConfig({
2424
'@rjsf/semantic-ui': path.resolve(__dirname, '../semantic-ui/src'),
2525
'@rjsf/shadcn': path.resolve(__dirname, '../shadcn/src'),
2626
// We want to pick up the browser version of the utils
27-
'@rjsf/utils': path.resolve(__dirname, '../utils/src/indexBrowser'),
27+
'@rjsf/utils': path.resolve(__dirname, '../utils/src'),
2828
'@rjsf/validator-ajv8': path.resolve(__dirname, '../validator-ajv8/src'),
2929
'@rjsf/daisyui': path.resolve(__dirname, '../daisyui/src'),
3030
},

packages/utils/package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"main": "dist/index.js",
55
"module": "lib/index.js",
66
"typings": "lib/index.d.ts",
7-
"browser": "dist/indexBrowser.js",
87
"type": "module",
98
"description": "Utility functions for @rjsf/core",
109
"exports": {
@@ -46,13 +45,10 @@
4645
"scripts": {
4746
"compileReplacer": "tsc -p tsconfig.replacer.json && move-file lodashReplacer.js lodashReplacer.cjs",
4847
"build:ts": "npm run compileReplacer && rimraf ./lib && tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
49-
"build:esm-browser": "esbuild ./src/indexBrowser.ts --bundle --outfile=dist/utils-browser.esm.js --sourcemap --packages=external --format=esm",
50-
"build:cjs-browser": "esbuild ./src/indexBrowser.ts --bundle --outfile=dist/indexBrowser.js --sourcemap --packages=external --format=cjs",
51-
"build:umd-browser": "rollup dist/utils-browser.esm.js --format=umd --file=dist/utils-browser.umd.js --name=@rjsf/utils",
5248
"build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --sourcemap --packages=external --format=cjs",
5349
"build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/utils.esm.js --sourcemap --packages=external --format=esm",
5450
"build:umd": "rollup dist/utils.esm.js --format=umd --file=dist/utils.umd.js --name=@rjsf/utils",
55-
"build": "npm run build:ts && npm run build:cjs && npm run build:cjs-browser && npm run build:esm && npm run build:esm-browser && npm run build:umd && npm run build:umd-browser",
51+
"build": "npm run build:ts && npm run build:cjs && npm run build:esm && npm run build:umd",
5652
"cs-check": "prettier -l \"{src,test}/**/*.ts?(x)\"",
5753
"cs-format": "prettier \"{src,test}/**/*.ts?(x)\" --write",
5854
"lint": "eslint src test",

packages/utils/src/getTestIds.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ import get from 'lodash/get';
33

44
import { TestIdShape } from './types';
55

6-
/** Returns an empty object for use on the browser since we'll never use test ids there.
7-
*/
8-
export function getTestIdsBrowser(): TestIdShape {
9-
return {};
10-
}
11-
126
/** Returns an object of test IDs that can only be used in test mode. If the function is called in a test environment
137
* (`NODE_ENV === 'test'`, this is set by jest) then a Proxy object will be returned. If a key within the returned
148
* object is accessed, if the value already exists the object will return that value, otherwise it will create that key
@@ -27,8 +21,8 @@ export function getTestIdsBrowser(): TestIdShape {
2721
export default function getTestIds(): TestIdShape {
2822
// For some reason, even though process.env contains the value of `test` for NODE_ENV, accessing it directly returns
2923
// 'development'. Using `get()` does, in fact, return test so sticking with it
30-
if (typeof process !== 'undefined' && get(process, 'env.NODE_ENV') !== 'test') {
31-
return getTestIdsBrowser();
24+
if (typeof process === 'undefined' || get(process, 'env.NODE_ENV') !== 'test') {
25+
return {};
3226
}
3327

3428
const ids = new Map();

packages/utils/src/indexBrowser.ts

-144
This file was deleted.

0 commit comments

Comments
 (0)