Skip to content

Commit 5eca35d

Browse files
Move polyfill resolution from webpack to package.json (#7395)
* refactor: use browser field to alias node builtins * chore: use @types/iarna__toml * fix: update minimatch dependency * fix: add polyfills for Buffer and global * chore: update lockfile --------- Co-authored-by: Martin Jagodic <jagodicmartin1@gmail.com>
1 parent 3e126b3 commit 5eca35d

File tree

14 files changed

+755
-669
lines changed

14 files changed

+755
-669
lines changed

package-lock.json

Lines changed: 705 additions & 656 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/decap-cms-backend-azure/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
},
2222
"dependencies": {
2323
"js-base64": "^3.0.0",
24+
"path-browserify": "^1.0.1",
2425
"semaphore": "^1.1.0"
2526
},
2627
"peerDependencies": {
@@ -33,5 +34,8 @@
3334
"lodash": "^4.17.11",
3435
"prop-types": "^15.7.2",
3536
"react": "^19.1.0"
37+
},
38+
"browser": {
39+
"path": "path-browserify"
3640
}
3741
}

packages/decap-cms-backend-bitbucket/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"dependencies": {
2222
"common-tags": "^1.8.0",
2323
"js-base64": "^3.0.0",
24+
"minimatch": "^7.0.0",
25+
"path-browserify": "^1.0.1",
2426
"semaphore": "^1.1.0",
2527
"what-the-diff": "^0.6.0"
2628
},
@@ -34,5 +36,8 @@
3436
"lodash": "^4.17.11",
3537
"prop-types": "^15.7.2",
3638
"react": "^19.1.0"
39+
},
40+
"browser": {
41+
"path": "path-browserify"
3742
}
3843
}

packages/decap-cms-backend-git-gateway/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"gotrue-js": "^0.9.24",
2424
"ini": "^2.0.0",
2525
"jwt-decode": "^3.0.0",
26-
"minimatch": "^3.0.4"
26+
"minimatch": "^7.0.0"
2727
},
2828
"peerDependencies": {
2929
"@emotion/react": "^11.11.1",
@@ -37,8 +37,5 @@
3737
"lodash": "^4.17.11",
3838
"prop-types": "^15.7.2",
3939
"react": "^19.1.0"
40-
},
41-
"devDependencies": {
42-
"@types/minimatch": "^5.1.2"
4340
}
4441
}

packages/decap-cms-backend-github/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"graphql": "^15.0.0",
2929
"graphql-tag": "^2.10.1",
3030
"js-base64": "^3.0.0",
31+
"path-browserify": "^1.0.1",
3132
"semaphore": "^1.1.0"
3233
},
3334
"peerDependencies": {
@@ -39,5 +40,8 @@
3940
"lodash": "^4.17.11",
4041
"prop-types": "^15.7.2",
4142
"react": "^19.1.0"
43+
},
44+
"browser": {
45+
"path": "path-browserify"
4246
}
4347
}

packages/decap-cms-backend-gitlab/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"apollo-link-context": "^1.0.18",
2525
"apollo-link-http": "^1.5.15",
2626
"js-base64": "^3.0.0",
27+
"path-browserify": "^1.0.1",
2728
"semaphore": "^1.1.0"
2829
},
2930
"peerDependencies": {
@@ -36,5 +37,8 @@
3637
"lodash": "^4.17.11",
3738
"prop-types": "^15.7.2",
3839
"react": "^19.1.0"
40+
},
41+
"browser": {
42+
"path": "path-browserify"
3943
}
4044
}

packages/decap-cms-backend-test/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
"build": "cross-env NODE_ENV=production webpack",
1818
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\""
1919
},
20+
"dependencies": {
21+
"path-browserify": "^1.0.1"
22+
},
2023
"peerDependencies": {
2124
"@emotion/react": "^11.11.1",
2225
"@emotion/styled": "^11.11.0",
@@ -26,5 +29,8 @@
2629
"prop-types": "^15.7.2",
2730
"react": "^19.1.0",
2831
"uuid": "^8.3.2"
32+
},
33+
"browser": {
34+
"path": "path-browserify"
2935
}
3036
}

packages/decap-cms-core/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@iarna/toml": "2.2.5",
2828
"@reduxjs/toolkit": "^1.9.1",
2929
"@vercel/stega": "^0.1.2",
30+
"buffer": "^6.0.3",
3031
"clean-stack": "^5.2.0",
3132
"copy-text-to-clipboard": "^3.0.0",
3233
"dayjs": "^1.11.10",
@@ -40,6 +41,7 @@
4041
"js-base64": "^3.0.0",
4142
"jwt-decode": "^3.0.0",
4243
"node-polyglot": "^2.3.0",
44+
"path-browserify": "^1.0.1",
4345
"prop-types": "^15.7.2",
4446
"react": "^19.1.0",
4547
"react-dnd": "^14.0.0",
@@ -90,8 +92,12 @@
9092
},
9193
"devDependencies": {
9294
"@types/history": "^4.7.8",
95+
"@types/iarna__toml": "^2.0.5",
9396
"@types/redux-mock-store": "^1.0.2",
9497
"@types/url-join": "^4.0.0",
9598
"redux-mock-store": "^1.5.3"
99+
},
100+
"browser": {
101+
"path": "path-browserify"
96102
}
97103
}

packages/decap-cms-core/src/bootstrap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import './lib/polyfill';
12
import React from 'react';
23
import { createRoot } from 'react-dom/client';
34
import { Provider, connect } from 'react-redux';

packages/decap-cms-core/src/formats/toml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import toml from '@iarna/toml';
1+
import parseToml from '@iarna/toml/parse-string';
22
import tomlify from 'tomlify-j0.4';
33
import dayjs from 'dayjs';
44

@@ -24,7 +24,7 @@ function outputReplacer(_key: string, value: unknown) {
2424

2525
export default {
2626
fromFile(content: string) {
27-
return toml.parse(content);
27+
return parseToml(content);
2828
},
2929

3030
toFile(data: object, sortedKeys: string[] = []) {

0 commit comments

Comments
 (0)