@abyss-project/commons-front-core 17.0.0 → 17.2.0

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/catalog/captures-plan.ts +116 -103
  3. package/catalog/catalog-entries.ts +148 -140
  4. package/catalog/pages/DeliveryHistory.tsx +66 -0
  5. package/catalog/pages/DeliverySubscriptions.tsx +110 -0
  6. package/catalog/pages/ScheduledTasks.tsx +117 -0
  7. package/catalog/pages/index.ts +165 -159
  8. package/catalog/specs/captures.spec.ts +145 -91
  9. package/catalog/specs/write-capture-index.ts +81 -76
  10. package/dist/{CookieConsentSettings-CTAyLGkm.js → CookieConsentSettings-DHpcYTa2.js} +1 -1
  11. package/dist/{Surface-76bwVL_Z.js → Surface-BUxzLLhb.js} +500 -90
  12. package/dist/{Tabs-D2bdAWGo.js → Tabs-D7TDtprO.js} +99 -99
  13. package/dist/components/business/Deliveries/DeliveryHistory.component.d.ts +8 -0
  14. package/dist/components/business/Deliveries/DeliveryHistory.component.spec.d.ts +1 -0
  15. package/dist/components/business/Deliveries/DeliverySubscriptionForm.d.ts +23 -0
  16. package/dist/components/business/Deliveries/DeliverySubscriptions.component.d.ts +9 -0
  17. package/dist/components/business/Deliveries/DeliverySubscriptions.component.spec.d.ts +1 -0
  18. package/dist/components/business/Deliveries/ScheduledTaskForm.d.ts +21 -0
  19. package/dist/components/business/Deliveries/ScheduledTasks.component.d.ts +9 -0
  20. package/dist/components/business/Deliveries/ScheduledTasks.component.spec.d.ts +1 -0
  21. package/dist/components/business/Deliveries/deliveries.logic.d.ts +35 -0
  22. package/dist/components/business/Deliveries/deliveries.logic.spec.d.ts +1 -0
  23. package/dist/components/business/Deliveries/deliveries.types.d.ts +65 -0
  24. package/dist/components/business/Deliveries/test-support/deliveries.fixtures.d.ts +19 -0
  25. package/dist/components/business/Deliveries/test-support/row-menu.d.ts +4 -0
  26. package/dist/components/business/Deliveries/use-paged-list.hook.d.ts +25 -0
  27. package/dist/components/business/index.d.ts +4 -0
  28. package/dist/cookie-consent.js +2 -2
  29. package/dist/design-system-toasts.spec.d.ts +1 -0
  30. package/dist/{design-theme-B1PgRGnU.js → design-theme-Bc2sMuUP.js} +7098 -7010
  31. package/dist/{editors-NTlXfUf3.js → editors-CGj-vsZu.js} +2264 -2243
  32. package/dist/editors.js +1 -1
  33. package/dist/hooks/use-rich-intl.hook.d.ts +432 -18
  34. package/dist/{index-D-75Bwy8.js → index-5lpeThh7.js} +2 -2
  35. package/dist/{index-BEm81V4i.js → index-853Jaoqw.js} +3 -3
  36. package/dist/{index-BH6GeV66.js → index-B4PJ4K6l.js} +2 -2
  37. package/dist/{index-DDsn4UyZ.js → index-BISOeVc7.js} +2 -2
  38. package/dist/{index-Bt3EOSkY.js → index-BS3QPrVM.js} +4 -4
  39. package/dist/{index-DmtNuZcU.js → index-BVsU-XEb.js} +2 -2
  40. package/dist/{index-VntY82At.js → index-Bxpp4VC9.js} +2 -2
  41. package/dist/{index-DloK9ass.js → index-CNfYiPB9.js} +2 -2
  42. package/dist/{index-BIQNTPCh.js → index-CONaN903.js} +2 -2
  43. package/dist/{index-C-pVBVRm.js → index-CTsQY6zW.js} +3 -3
  44. package/dist/{index-DTfxCpd4.js → index-CYmjv9TK.js} +4 -4
  45. package/dist/{index-CHsTUwr0.js → index-DKMFAW5f.js} +1 -1
  46. package/dist/{index-MiIytQo8.js → index-DOrEPYZN.js} +3 -3
  47. package/dist/{index-DGKfXQr5.js → index-DfnEQYyW.js} +2 -2
  48. package/dist/{index-DeB1ImKD.js → index-DrgdyC6J.js} +2 -2
  49. package/dist/{index-DXSxiqo1.js → index-DvrKcy8f.js} +2 -2
  50. package/dist/{index-7ovesCC_.js → index-DxZ1bG6u.js} +2 -2
  51. package/dist/{index-BHFYCrDl.js → index-DykCZUJc.js} +4 -4
  52. package/dist/{index-Dr3sF4q3.js → index-YX_yu3BN.js} +2 -2
  53. package/dist/{index-rHl9uQvG.js → index-_3uQ1KPn.js} +3 -3
  54. package/dist/{index-BKbESj9f.js → index-a62vDo6s.js} +2 -2
  55. package/dist/index.js +11825 -10044
  56. package/dist/legacy/components/Spotlight/ProjectLinkSelector/ProjectLinkSelector.component.spec.d.ts +1 -0
  57. package/dist/legacy.js +209 -210
  58. package/dist/translations/en.d.ts +206 -1
  59. package/dist/translations/fr.d.ts +206 -1
  60. package/package.json +9 -6
  61. package/scripts/check-auth-entry-isolation.cjs +1 -2
  62. package/test-results/catalog/.last-run.json +4 -0
  63. package/vite.config.ts +3 -3
  64. package/scripts/check-external-react-toastify.cjs +0 -104
@@ -125,7 +125,7 @@ declare const _default: {
125
125
  WORKSPACE_RETROSPECTIVE_COUNT: string;
126
126
  LINK_COUNT: string;
127
127
  LINK_RESOLUTIONS_MONTH: string;
128
- MONITOR_WEBHOOK_INVOCATIONS_MONTH: string;
128
+ FLOW_WEBHOOK_DELIVERIES_MONTH: string;
129
129
  FLOW_WORKFLOW_CREDITS_MONTH: string;
130
130
  REFLEX_EXECUTIONS_MONTH: string;
131
131
  CONSOLE_VAULT_ENTRIES_COUNT: string;
@@ -868,6 +868,211 @@ declare const _default: {
868
868
  placeholder: string;
869
869
  error: string;
870
870
  };
871
+ deliveries: {
872
+ 'open-in-flow': string;
873
+ total: string;
874
+ 'action-failed': string;
875
+ 'row-actions': string;
876
+ cancel: string;
877
+ secret: {
878
+ title: string;
879
+ once: string;
880
+ copy: string;
881
+ done: string;
882
+ };
883
+ state: {
884
+ active: string;
885
+ inactive: string;
886
+ 'auto-disabled': string;
887
+ };
888
+ status: {
889
+ PENDING: string;
890
+ RETRYING: string;
891
+ DELIVERED: string;
892
+ FAILED: string;
893
+ DROPPED: string;
894
+ };
895
+ 'run-status': {
896
+ PENDING: string;
897
+ RUNNING: string;
898
+ SUCCEEDED: string;
899
+ FAILED: string;
900
+ TIMED_OUT: string;
901
+ SKIPPED: string;
902
+ };
903
+ source: {
904
+ MONITOR: string;
905
+ STORAGE: string;
906
+ FORM: string;
907
+ EXTRACT: string;
908
+ PROBE: string;
909
+ };
910
+ event: {
911
+ MONITOR_EVENT: string;
912
+ MONITOR_SENTINEL: string;
913
+ STORAGE_UPLOAD: string;
914
+ STORAGE_WRITE: string;
915
+ STORAGE_DELETE: string;
916
+ STORAGE_SCAN_RESULT: string;
917
+ FORM_SUBMISSION: string;
918
+ EXTRACT_COMPLETED: string;
919
+ EXTRACT_FAILED: string;
920
+ EXPORT_COMPLETED: string;
921
+ EXPORT_FAILED: string;
922
+ PROBE_SCAN_COMPLETED: string;
923
+ };
924
+ format: {
925
+ JSON: string;
926
+ DISCORD: string;
927
+ };
928
+ 'duration-ms': string;
929
+ subscriptions: {
930
+ label: string;
931
+ pagination: string;
932
+ new: string;
933
+ 'all-sources': string;
934
+ empty: string;
935
+ 'empty-desc': string;
936
+ column: {
937
+ url: string;
938
+ source: string;
939
+ events: string;
940
+ format: string;
941
+ enabled: string;
942
+ failures: string;
943
+ actions: string;
944
+ };
945
+ action: {
946
+ edit: string;
947
+ history: string;
948
+ 'reset-secret': string;
949
+ delete: string;
950
+ toggle: string;
951
+ };
952
+ form: {
953
+ 'title-create': string;
954
+ 'title-edit': string;
955
+ source: string;
956
+ events: string;
957
+ 'events-help': string;
958
+ 'error-events': string;
959
+ url: string;
960
+ 'error-url': string;
961
+ format: string;
962
+ enabled: string;
963
+ };
964
+ delete: {
965
+ title: string;
966
+ body: string;
967
+ confirm: string;
968
+ };
969
+ 'reset-secret': {
970
+ title: string;
971
+ body: string;
972
+ confirm: string;
973
+ };
974
+ };
975
+ history: {
976
+ label: string;
977
+ pagination: string;
978
+ empty: string;
979
+ 'empty-desc': string;
980
+ 'status-filter': string;
981
+ 'all-statuses': string;
982
+ column: {
983
+ status: string;
984
+ event: string;
985
+ attempts: string;
986
+ code: string;
987
+ created: string;
988
+ delivered: string;
989
+ };
990
+ replay: string;
991
+ detail: {
992
+ title: string;
993
+ 'load-failed': string;
994
+ 'delivery-id': string;
995
+ 'request-body': string;
996
+ headers: string;
997
+ response: string;
998
+ 'response-code': string;
999
+ 'response-body': string;
1000
+ error: string;
1001
+ timeline: string;
1002
+ 'timeline-created': string;
1003
+ 'timeline-attempts': string;
1004
+ 'timeline-next': string;
1005
+ 'timeline-delivered': string;
1006
+ none: string;
1007
+ };
1008
+ };
1009
+ tasks: {
1010
+ label: string;
1011
+ pagination: string;
1012
+ new: string;
1013
+ empty: string;
1014
+ 'empty-desc': string;
1015
+ 'never-run': string;
1016
+ column: {
1017
+ name: string;
1018
+ schedule: string;
1019
+ enabled: string;
1020
+ 'last-run': string;
1021
+ failures: string;
1022
+ actions: string;
1023
+ };
1024
+ action: {
1025
+ edit: string;
1026
+ runs: string;
1027
+ trigger: string;
1028
+ 'regenerate-secret': string;
1029
+ delete: string;
1030
+ toggle: string;
1031
+ };
1032
+ triggered: string;
1033
+ form: {
1034
+ 'title-create': string;
1035
+ 'title-edit': string;
1036
+ 'created-disabled': string;
1037
+ name: string;
1038
+ description: string;
1039
+ schedule: string;
1040
+ 'schedule-help': string;
1041
+ preset: string;
1042
+ 'preset-none': string;
1043
+ url: string;
1044
+ timeout: string;
1045
+ retries: string;
1046
+ 'retry-delay': string;
1047
+ enabled: string;
1048
+ 'error-name': string;
1049
+ 'error-schedule': string;
1050
+ 'error-url': string;
1051
+ };
1052
+ delete: {
1053
+ title: string;
1054
+ body: string;
1055
+ confirm: string;
1056
+ };
1057
+ 'regenerate-secret': {
1058
+ title: string;
1059
+ body: string;
1060
+ confirm: string;
1061
+ };
1062
+ runs: {
1063
+ title: string;
1064
+ pagination: string;
1065
+ empty: string;
1066
+ 'empty-desc': string;
1067
+ column: {
1068
+ status: string;
1069
+ 'scheduled-for': string;
1070
+ duration: string;
1071
+ code: string;
1072
+ };
1073
+ };
1074
+ };
1075
+ };
871
1076
  support: {
872
1077
  status: {
873
1078
  OPEN: string;
@@ -125,7 +125,7 @@ declare const _default: {
125
125
  WORKSPACE_RETROSPECTIVE_COUNT: string;
126
126
  LINK_COUNT: string;
127
127
  LINK_RESOLUTIONS_MONTH: string;
128
- MONITOR_WEBHOOK_INVOCATIONS_MONTH: string;
128
+ FLOW_WEBHOOK_DELIVERIES_MONTH: string;
129
129
  FLOW_WORKFLOW_CREDITS_MONTH: string;
130
130
  REFLEX_EXECUTIONS_MONTH: string;
131
131
  CONSOLE_VAULT_ENTRIES_COUNT: string;
@@ -886,6 +886,211 @@ declare const _default: {
886
886
  };
887
887
  };
888
888
  };
889
+ deliveries: {
890
+ 'open-in-flow': string;
891
+ total: string;
892
+ 'action-failed': string;
893
+ 'row-actions': string;
894
+ cancel: string;
895
+ secret: {
896
+ title: string;
897
+ once: string;
898
+ copy: string;
899
+ done: string;
900
+ };
901
+ state: {
902
+ active: string;
903
+ inactive: string;
904
+ 'auto-disabled': string;
905
+ };
906
+ status: {
907
+ PENDING: string;
908
+ RETRYING: string;
909
+ DELIVERED: string;
910
+ FAILED: string;
911
+ DROPPED: string;
912
+ };
913
+ 'run-status': {
914
+ PENDING: string;
915
+ RUNNING: string;
916
+ SUCCEEDED: string;
917
+ FAILED: string;
918
+ TIMED_OUT: string;
919
+ SKIPPED: string;
920
+ };
921
+ source: {
922
+ MONITOR: string;
923
+ STORAGE: string;
924
+ FORM: string;
925
+ EXTRACT: string;
926
+ PROBE: string;
927
+ };
928
+ event: {
929
+ MONITOR_EVENT: string;
930
+ MONITOR_SENTINEL: string;
931
+ STORAGE_UPLOAD: string;
932
+ STORAGE_WRITE: string;
933
+ STORAGE_DELETE: string;
934
+ STORAGE_SCAN_RESULT: string;
935
+ FORM_SUBMISSION: string;
936
+ EXTRACT_COMPLETED: string;
937
+ EXTRACT_FAILED: string;
938
+ EXPORT_COMPLETED: string;
939
+ EXPORT_FAILED: string;
940
+ PROBE_SCAN_COMPLETED: string;
941
+ };
942
+ format: {
943
+ JSON: string;
944
+ DISCORD: string;
945
+ };
946
+ 'duration-ms': string;
947
+ subscriptions: {
948
+ label: string;
949
+ pagination: string;
950
+ new: string;
951
+ 'all-sources': string;
952
+ empty: string;
953
+ 'empty-desc': string;
954
+ column: {
955
+ url: string;
956
+ source: string;
957
+ events: string;
958
+ format: string;
959
+ enabled: string;
960
+ failures: string;
961
+ actions: string;
962
+ };
963
+ action: {
964
+ edit: string;
965
+ history: string;
966
+ 'reset-secret': string;
967
+ delete: string;
968
+ toggle: string;
969
+ };
970
+ form: {
971
+ 'title-create': string;
972
+ 'title-edit': string;
973
+ source: string;
974
+ events: string;
975
+ 'events-help': string;
976
+ 'error-events': string;
977
+ url: string;
978
+ 'error-url': string;
979
+ format: string;
980
+ enabled: string;
981
+ };
982
+ delete: {
983
+ title: string;
984
+ body: string;
985
+ confirm: string;
986
+ };
987
+ 'reset-secret': {
988
+ title: string;
989
+ body: string;
990
+ confirm: string;
991
+ };
992
+ };
993
+ history: {
994
+ label: string;
995
+ pagination: string;
996
+ empty: string;
997
+ 'empty-desc': string;
998
+ 'status-filter': string;
999
+ 'all-statuses': string;
1000
+ column: {
1001
+ status: string;
1002
+ event: string;
1003
+ attempts: string;
1004
+ code: string;
1005
+ created: string;
1006
+ delivered: string;
1007
+ };
1008
+ replay: string;
1009
+ detail: {
1010
+ title: string;
1011
+ 'load-failed': string;
1012
+ 'delivery-id': string;
1013
+ 'request-body': string;
1014
+ headers: string;
1015
+ response: string;
1016
+ 'response-code': string;
1017
+ 'response-body': string;
1018
+ error: string;
1019
+ timeline: string;
1020
+ 'timeline-created': string;
1021
+ 'timeline-attempts': string;
1022
+ 'timeline-next': string;
1023
+ 'timeline-delivered': string;
1024
+ none: string;
1025
+ };
1026
+ };
1027
+ tasks: {
1028
+ label: string;
1029
+ pagination: string;
1030
+ new: string;
1031
+ empty: string;
1032
+ 'empty-desc': string;
1033
+ 'never-run': string;
1034
+ column: {
1035
+ name: string;
1036
+ schedule: string;
1037
+ enabled: string;
1038
+ 'last-run': string;
1039
+ failures: string;
1040
+ actions: string;
1041
+ };
1042
+ action: {
1043
+ edit: string;
1044
+ runs: string;
1045
+ trigger: string;
1046
+ 'regenerate-secret': string;
1047
+ delete: string;
1048
+ toggle: string;
1049
+ };
1050
+ triggered: string;
1051
+ form: {
1052
+ 'title-create': string;
1053
+ 'title-edit': string;
1054
+ 'created-disabled': string;
1055
+ name: string;
1056
+ description: string;
1057
+ schedule: string;
1058
+ 'schedule-help': string;
1059
+ preset: string;
1060
+ 'preset-none': string;
1061
+ url: string;
1062
+ timeout: string;
1063
+ retries: string;
1064
+ 'retry-delay': string;
1065
+ enabled: string;
1066
+ 'error-name': string;
1067
+ 'error-schedule': string;
1068
+ 'error-url': string;
1069
+ };
1070
+ delete: {
1071
+ title: string;
1072
+ body: string;
1073
+ confirm: string;
1074
+ };
1075
+ 'regenerate-secret': {
1076
+ title: string;
1077
+ body: string;
1078
+ confirm: string;
1079
+ };
1080
+ runs: {
1081
+ title: string;
1082
+ pagination: string;
1083
+ empty: string;
1084
+ 'empty-desc': string;
1085
+ column: {
1086
+ status: string;
1087
+ 'scheduled-for': string;
1088
+ duration: string;
1089
+ code: string;
1090
+ };
1091
+ };
1092
+ };
1093
+ };
889
1094
  support: {
890
1095
  status: {
891
1096
  OPEN: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/commons-front-core",
3
- "version": "17.0.0",
3
+ "version": "17.2.0",
4
4
  "description": "Front Core package of AbyssProject",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -67,6 +67,7 @@
67
67
  "peerDependencies": {
68
68
  "@abyss-project/capacitor-auth": "^1.0.0",
69
69
  "@abyss-project/cloud": "^2.4.0",
70
+ "@abyss-project/flow": "^1.2.0",
70
71
  "@abyss-project/monitor-browser": "^2.0.0",
71
72
  "@abyss-project/workspace": "^4.6.0",
72
73
  "@dnd-kit/core": "^6.0.0",
@@ -86,13 +87,15 @@
86
87
  "react-intl": "^6.2.5",
87
88
  "react-is": "^18.0.0 || ^19.0.0",
88
89
  "react-router-dom": "^6.15.0",
89
- "react-toastify": "^8.0.2 || ^10.0.0",
90
90
  "zustand": "^5.0.0",
91
- "@abyss-project/main": "31.1.0"
91
+ "@abyss-project/main": "32.0.0"
92
92
  },
93
93
  "peerDependenciesMeta": {
94
94
  "@abyss-project/capacitor-auth": {
95
95
  "optional": true
96
+ },
97
+ "@abyss-project/flow": {
98
+ "optional": true
96
99
  }
97
100
  },
98
101
  "dependencies": {
@@ -140,10 +143,11 @@
140
143
  "use-debounce": "^10.0.5",
141
144
  "uuid": "^9.0.0",
142
145
  "yup": "^0.32.11",
143
- "@abyss-project/main": "31.1.0"
146
+ "@abyss-project/main": "32.0.0"
144
147
  },
145
148
  "devDependencies": {
146
149
  "@abyss-project/cloud": "^2.4.0",
150
+ "@abyss-project/flow": "^1.2.0",
147
151
  "@abyss-project/monitor-browser": "^2.0.0",
148
152
  "@abyss-project/workspace": "^4.6.0",
149
153
  "@playwright/test": "^1.52.0",
@@ -172,7 +176,6 @@
172
176
  "eslint-plugin-react-hooks": "^4.6.2",
173
177
  "jsdom": "^29.1.1",
174
178
  "prettier": "^2.5.1",
175
- "react-toastify": "^8.0.2",
176
179
  "tsc-watch": "^4.6.2",
177
180
  "typescript": "5.9.3",
178
181
  "vite": "^6.3.5",
@@ -184,7 +187,7 @@
184
187
  "lint": "eslint \"{src,apps,libs,test,core,catalog}/**/*.{ts,tsx}\" --fix",
185
188
  "lint:check": "eslint \"{src,apps,libs,test,core,catalog}/**/*.{ts,tsx}\" --max-warnings 0",
186
189
  "tsc": "tsc --noEmit && tsc --noEmit -p catalog/tsconfig.json",
187
- "build": "vite build && node scripts/check-auth-entry-isolation.cjs && node scripts/check-external-react-toastify.cjs",
190
+ "build": "vite build && node scripts/check-auth-entry-isolation.cjs",
188
191
  "dev": "vite build --watch",
189
192
  "test": "vitest run --config vitest.config.ts",
190
193
  "test:watch": "vitest --config vitest.config.ts",
@@ -8,7 +8,7 @@
8
8
  * The `@abyss-project/commons-front-core/auth` entry exists so that an app's auth bootstrap
9
9
  * module (and every test that re-imports it, e.g. after `vi.resetModules()`) never pays for the
10
10
  * screens (`AuthFlow`, `SecuritySettings`, `ReauthDialog`…) and their dependencies (MUI, pdf.js,
11
- * milkdown, nivo, react-toastify…) — the whole reason this entry exists alongside the full
11
+ * milkdown, nivo…) — the whole reason this entry exists alongside the full
12
12
  * barrel, same as `cookie-consent` and `auth-native` already do for their own concerns.
13
13
  *
14
14
  * This walks `dist/auth.js` and every chunk it statically imports by a relative path (a bare
@@ -45,7 +45,6 @@ const FORBIDDEN_MARKERS = [
45
45
  '@milkdown/',
46
46
  'pdfjs-dist',
47
47
  'pdf-lib',
48
- 'react-toastify',
49
48
  'react-dropzone',
50
49
  'qrcode',
51
50
  '@dnd-kit/',
@@ -0,0 +1,4 @@
1
+ {
2
+ "status": "passed",
3
+ "failedTests": []
4
+ }
package/vite.config.ts CHANGED
@@ -57,8 +57,8 @@ export default defineConfig({
57
57
  // Multiple entries: the full barrel (`index`) plus a browser-safe,
58
58
  // tree-shaken `cookie-consent` entry. The latter lets webpack consumers
59
59
  // (e.g. the Next.js landing) pull ONLY the cookie-consent UI without
60
- // dragging in react-toastify (React-17 `render`), pdf.js, or the server
61
- // monitor SDK that the full barrel transitively includes.
60
+ // dragging in pdf.js or the server monitor SDK that the full barrel
61
+ // transitively includes.
62
62
  entry: {
63
63
  index: resolve(__dirname, 'src/index.ts'),
64
64
  'cookie-consent': resolve(__dirname, 'src/components/business/CookieConsent/index.ts'),
@@ -93,7 +93,7 @@ export default defineConfig({
93
93
  // 'react' silently externalizes 'react-is', 'react-fast-compare', etc.
94
94
  external: (id) => {
95
95
  const exactNames = [
96
- 'react', 'react-dom', 'react-intl', 'react-router-dom', 'react-toastify',
96
+ 'react', 'react-dom', 'react-intl', 'react-router-dom',
97
97
  'pdfjs-dist', 'pdf-lib',
98
98
  // Monaco: one copy per app, resolved by the consumer (like pdf.js).
99
99
  '@monaco-editor/react',
@@ -1,104 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
- 'use strict';
4
-
5
- /**
6
- * check-external-react-toastify.cjs - build guard for the `react-toastify` peer dependency (#766).
7
- *
8
- * `react-toastify` is a peerDependency of the package and is declared external in `vite.config.ts`.
9
- * Bundled instead, the toasts emitted from the core (the quota helpers, the legacy DropZone,
10
- * CloudImport, ProjectLinkSelector and SupportMessageThread) would go to a private copy of the
11
- * library that no `ToastContainer` listens to, and be lost silently.
12
- *
13
- * This walks `dist/index.js` and `dist/legacy.js` plus every chunk they import by a relative path,
14
- * and fails if, for either entry:
15
- * - no reachable file imports the bare specifier "react-toastify";
16
- * - any reachable file carries the internal code of the library (markers below).
17
- *
18
- * Exit 0: external. Exit 1: bundled or not imported. Exit 2: usage or tooling error (dist absent -
19
- * build the package first). Run from the package's own `build` script, after `vite build`.
20
- */
21
-
22
- const fs = require('fs');
23
- const path = require('path');
24
-
25
- const DIST_DIR = path.resolve(__dirname, '../dist');
26
- const ENTRIES = ['index.js', 'legacy.js'];
27
-
28
- // Internal symbols of react-toastify that only exist when its code is bundled.
29
- const BUNDLED_MARKERS = ['useToastContainer', 'eventManager'];
30
-
31
- const BARE_IMPORT = /(?:import|export)\s[^'"]*?from\s*["']react-toastify["']|import\s*["']react-toastify["']/;
32
-
33
- class UsageError extends Error {}
34
-
35
- function localImportSpecifiers(source) {
36
- const specifiers = new Set();
37
- const re = /(?:import|export)\s[^'"]*?from\s*["']([^"']+)["']|import\s*["']([^"']+)["']/g;
38
- let match = re.exec(source);
39
- while (match !== null) {
40
- const specifier = match[1] || match[2];
41
- if (specifier.startsWith('.')) {
42
- specifiers.add(specifier);
43
- }
44
- match = re.exec(source);
45
- }
46
- return specifiers;
47
- }
48
-
49
- function walk(entry) {
50
- const files = new Map();
51
- const queue = [entry];
52
- while (queue.length > 0) {
53
- const file = queue.shift();
54
- if (files.has(file)) {
55
- continue;
56
- }
57
- if (!fs.existsSync(file)) {
58
- throw new UsageError(`${file} is missing: build the package first (\`vite build\`).`);
59
- }
60
- const source = fs.readFileSync(file, 'utf8');
61
- files.set(file, source);
62
- for (const specifier of localImportSpecifiers(source)) {
63
- queue.push(path.resolve(path.dirname(file), specifier));
64
- }
65
- }
66
- return files;
67
- }
68
-
69
- function run() {
70
- const failures = [];
71
- for (const name of ENTRIES) {
72
- const files = walk(path.join(DIST_DIR, name));
73
- const sources = [...files.entries()];
74
- if (!sources.some(([, source]) => BARE_IMPORT.test(source))) {
75
- failures.push(`${name} does not import "react-toastify"`);
76
- }
77
- for (const [file, source] of sources) {
78
- for (const marker of BUNDLED_MARKERS) {
79
- if (source.includes(marker)) {
80
- failures.push(
81
- `${name}: ${path.relative(DIST_DIR, file)} embeds react-toastify code ("${marker}")`,
82
- );
83
- }
84
- }
85
- }
86
- }
87
- if (failures.length > 0) {
88
- console.error('REACT-TOASTIFY EXTERNAL REFUSE :');
89
- for (const failure of failures) console.error(` - ${failure}`);
90
- return 1;
91
- }
92
- console.log('REACT-TOASTIFY EXTERNAL OK : imported by index.js and legacy.js, not bundled.');
93
- return 0;
94
- }
95
-
96
- try {
97
- process.exit(run());
98
- } catch (error) {
99
- if (error instanceof UsageError) {
100
- console.error(error.message);
101
- process.exit(2);
102
- }
103
- throw error;
104
- }