Skip to content

Commit 31281f4

Browse files
authored
Merge pull request #250 from Staffbase/chore/deps-consolidation-widget-sdk-3.18.0
chore(deps): consolidate dependabot updates, bump widget-sdk to 3.18.0 and absorb PR #251
2 parents f7d2c0a + 2bd7770 commit 31281f4

6 files changed

Lines changed: 263 additions & 268 deletions

File tree

samples/weather-forecast/.babelrc

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// babel.config.js (project-wide) instead of .babelrc (package-local).
2+
// The key difference: babel.config.js applies to ALL files including node_modules
3+
// that Jest is instructed to transform via transformIgnorePatterns.
4+
// .babelrc is scoped to the package it lives in and does NOT apply to
5+
// node_modules, so pure-ESM deps like @x0k/json-schema-merge (introduced by
6+
// @rjsf/utils v6) would not have their `export` syntax compiled to CJS.
7+
module.exports = {
8+
presets: [
9+
[
10+
'@babel/preset-env',
11+
{
12+
useBuiltIns: 'usage',
13+
corejs: 3,
14+
targets: '> 0.25%, not dead, not ie < 11',
15+
},
16+
],
17+
'@babel/preset-react',
18+
'@babel/preset-typescript',
19+
],
20+
plugins: [
21+
'@babel/plugin-syntax-dynamic-import',
22+
'@babel/plugin-proposal-class-properties',
23+
'@babel/plugin-proposal-object-rest-spread',
24+
],
25+
env: {
26+
test: {
27+
presets: [
28+
[
29+
'@babel/preset-env',
30+
{
31+
targets: { node: 'current' },
32+
modules: 'commonjs',
33+
},
34+
],
35+
'@babel/preset-react',
36+
'@babel/preset-typescript',
37+
],
38+
},
39+
},
40+
};

samples/weather-forecast/jest.config.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@ module.exports = {
44
moduleNameMapper: {
55
'icons/(.*)\.svg$': '<rootDir>/__mocks__/lazySvgMock.js',
66
'\\.svg$': '<rootDir>/__mocks__/fileMock.js',
7-
'^axios$': 'axios/dist/node/axios.cjs'
7+
'^axios$': 'axios/dist/node/axios.cjs',
8+
// Load the ESM lib/ build of rjsf v6 packages instead of the esbuild CJS dist.
9+
// The CJS dist uses __toESM(require(...), 1) (isNodeMode=1) which incorrectly
10+
// wraps @mui/material CJS-with-__esModule modules as { default: wholeObject },
11+
// causing "Element type is invalid: got object" in FieldTemplate.
12+
// The lib/ ESM files are Babel-transformed, which handles __esModule interop
13+
// correctly via _interopRequireDefault().default.
14+
'^@rjsf/mui$': '<rootDir>/node_modules/@rjsf/mui/lib/index.js',
15+
'^@rjsf/core$': '<rootDir>/node_modules/@rjsf/core/lib/index.js',
16+
'^@rjsf/utils$': '<rootDir>/node_modules/@rjsf/utils/lib/index.js',
17+
'^@rjsf/validator-ajv8$': '<rootDir>/node_modules/@rjsf/validator-ajv8/lib/index.js',
818
},
9-
testEnvironment: 'jsdom',
19+
testEnvironment: 'jsdom', testEnvironmentOptions: {
20+
customExportConditions: ['require', 'default'],
21+
}, transformIgnorePatterns: [
22+
// Transform @rjsf (lib/ ESM files), @x0k/json-schema-merge (pure ESM),
23+
// @mui/material (ESM subpath imports used by @rjsf/mui lib/), and lodash-es
24+
// (pure ESM used throughout @rjsf/utils and @rjsf/core lib/ files).
25+
'/node_modules/(?!(@x0k/json-schema-merge|@rjsf|@mui|lodash-es)/)',
26+
],
1027
};
28+

samples/weather-forecast/package.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"author": "",
1818
"license": "ISC",
1919
"dependencies": {
20-
"@staffbase/widget-sdk": "^3.17.0",
20+
"@staffbase/widget-sdk": "^3.18.0",
2121
"acorn": "^8.16.0",
22-
"axios": "^1.15.0",
22+
"axios": "^1.16.0",
2323
"date-fns": "^2.30.0",
2424
"dayjs": "1.11.20",
2525
"react": "^18.3.1",
@@ -33,25 +33,25 @@
3333
"@babel/plugin-proposal-class-properties": "^7.18.6",
3434
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
3535
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
36-
"@babel/preset-env": "^7.29.2",
36+
"@babel/preset-env": "^7.29.3",
3737
"@babel/preset-react": "^7.28.5",
3838
"@babel/preset-typescript": "^7.28.5",
3939
"@emotion/react": "^11.14.0",
4040
"@emotion/styled": "^11.14.1",
4141
"@mui/icons-material": "^6.5.0",
4242
"@mui/material": "^6.5.0",
43-
"@mui/system": "^7.3.7",
44-
"@rjsf/core": "5.24.13",
45-
"@rjsf/mui": "5.24.13",
46-
"@rjsf/utils": "5.24.13",
47-
"@rjsf/validator-ajv8": "5.24.13",
43+
"@mui/system": "^9.0.0",
44+
"@rjsf/core": "6.5.2",
45+
"@rjsf/mui": "6.5.2",
46+
"@rjsf/utils": "6.5.2",
47+
"@rjsf/validator-ajv8": "6.5.2",
4848
"@svgr/webpack": "8.1.0",
4949
"@testing-library/dom": "^10.4.1",
5050
"@testing-library/jest-dom": "^6.9.1",
5151
"@testing-library/react": "^16.3.2",
5252
"@types/jest": "^30.0.0",
5353
"@types/json-schema": "^7.0.15",
54-
"@types/node": "25.5.2",
54+
"@types/node": "25.6.0",
5555
"@types/react": "^18.3.24",
5656
"@types/react-dom": "^18.3.7",
5757
"@types/webpack": "5.28.5",
@@ -70,17 +70,19 @@
7070
"jest-json-schema": "^6.1.0",
7171
"js-base64": "3.7.8",
7272
"minimal-polyfills": "2.2.3",
73-
"prettier": "3.8.1",
73+
"prettier": "3.8.3",
7474
"ts-loader": "^9.5.7",
7575
"ts-node": "10.9.2",
76-
"typescript": "6.0.2",
77-
"webpack": "^5.104.1",
78-
"webpack-cli": "^6.0.1",
76+
"typescript": "6.0.3",
77+
"webpack": "^5.106.2",
78+
"webpack-cli": "^7.0.2",
7979
"webpack-dev-server": "^5.2.3",
8080
"webpack-merge": "^6.0.1"
8181
},
8282
"resolutions": {
83-
"webpack": "5.105.4",
83+
"webpack": "5.106.2",
84+
"fast-uri": "^3.1.2",
85+
"@babel/plugin-transform-modules-systemjs": "^7.29.4",
8486
"nth-check": ">=2.0.1",
8587
"flatted": "3.4.2",
8688
"minimatch": "3.1.4",

samples/weather-forecast/webpack.common.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ const config: webpack.Configuration = {
2020
},
2121
module: {
2222
rules: [
23+
{
24+
test: /\.m?js$/,
25+
resolve: {
26+
fullySpecified: false,
27+
},
28+
},
2329
{
2430
test: /\.tsx?$/,
2531
use: ["babel-loader"],

0 commit comments

Comments
 (0)