@abyss-project/commons-front-core 13.2.0 → 14.0.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.
- package/catalog/captures-plan.ts +4 -1
- package/catalog/catalog-entries.ts +6 -1
- package/catalog/expected-error.ts +6 -0
- package/catalog/pages/CookieConsent.tsx +38 -0
- package/catalog/pages/ErrorBoundary.tsx +22 -0
- package/catalog/pages/PasswordField.tsx +62 -0
- package/catalog/pages/Toast.tsx +17 -6
- package/catalog/pages/index.ts +6 -0
- package/catalog/specs/captures.spec.ts +10 -0
- package/catalog/specs/catalog-page.ts +6 -1
- package/catalog/specs/write-capture-index.ts +1 -0
- package/dist/{AbyssCloud-D_AbU9k7.js → AbyssCloud-B3rMelRi.js} +636 -712
- package/dist/CookieConsentSettings-DyJGEnVA.js +505 -0
- package/dist/{use-rich-intl.hook-BETUyCkW.js → Surface-B_J_I_1i.js} +700 -147
- package/dist/Tabs-_TzugjHZ.js +1941 -0
- package/dist/auth/components/AuthHeroLayout/auth-hero-gradient.d.ts +18 -0
- package/dist/auth/components/shared/AuthLoadingScreen.component.d.ts +5 -0
- package/dist/auth/components/shared/use-async-resource.hook.d.ts +4 -1
- package/dist/auth/components/shared/use-async-resource.hook.spec.d.ts +1 -0
- package/dist/components/business/CookieConsent/AbyssCookieConsentProvider.spec.d.ts +1 -0
- package/dist/components/business/CookieConsent/CookieConsent.spec.d.ts +1 -0
- package/dist/{legacy/components/CookieConsent/CookieConsentBanner.component.d.ts → components/business/CookieConsent/CookieConsentBanner.d.ts} +1 -2
- package/dist/components/business/CookieConsent/CookieConsentSettings.d.ts +1 -0
- package/dist/{legacy/components → components/business}/CookieConsent/index.d.ts +2 -2
- package/dist/components/business/index.d.ts +3 -0
- package/dist/components/inputs/FormField/FormField.d.ts +5 -1
- package/dist/components/inputs/PasswordField/PasswordField.d.ts +40 -0
- package/dist/components/inputs/PasswordField/PasswordField.spec.d.ts +1 -0
- package/dist/components/inputs/index.d.ts +1 -0
- package/dist/components/layers/Toast/Toast.d.ts +3 -18
- package/dist/components/layers/Toast/toast-clearance.d.ts +6 -0
- package/dist/components/layers/Toast/toast-store.d.ts +76 -0
- package/dist/components/states/ErrorBoundary/ErrorBoundary.d.ts +17 -0
- package/dist/components/states/ErrorBoundary/ErrorBoundary.spec.d.ts +1 -0
- package/dist/components/states/PageState/PageState.d.ts +3 -1
- package/dist/components/states/index.d.ts +1 -0
- package/dist/cookie-consent.d.ts +1 -1
- package/dist/cookie-consent.js +14 -15
- package/dist/demo/DemoBanner/DemoBanner.d.ts +16 -0
- package/dist/demo/DemoBanner/DemoBanner.spec.d.ts +1 -0
- package/dist/demo/DemoBanner/index.d.ts +1 -0
- package/dist/demo/demo-blocked.interceptor.d.ts +7 -0
- package/dist/demo/demo.en.d.ts +17 -0
- package/dist/demo/demo.fr.d.ts +17 -0
- package/dist/demo/index.d.ts +3 -0
- package/dist/demo/tests/demo-blocked.interceptor.spec.d.ts +1 -0
- package/dist/demo/use-demo-account.hook.d.ts +19 -0
- package/dist/design-theme-D5L0JNbX.js +26599 -0
- package/dist/{editors-CUsZNFfw.js → editors-C6Rocm6M.js} +83 -83
- package/dist/editors.js +1 -1
- package/dist/hooks/use-rich-intl.hook.d.ts +78 -0
- package/dist/{index-BQ4GXlMJ.js → index-5AavH8Oo.js} +1 -1
- package/dist/{index-Bn4gTAno.js → index-B58_3EoW.js} +2 -2
- package/dist/{index-DuMzZrqc.js → index-BElPTqLa.js} +2 -2
- package/dist/{index-D1ro2oTw.js → index-BI4ooqu1.js} +2 -2
- package/dist/{index-TB7ekLl-.js → index-BYDMmzla.js} +2 -2
- package/dist/{index-CM0x-TnE.js → index-C1GCQ2Ke.js} +2 -2
- package/dist/{index-DEBTvCWD.js → index-C1I7MW-q.js} +3 -3
- package/dist/{index-pnfk6VZ7.js → index-CDI4_t7D.js} +4 -4
- package/dist/{index-Lyt4_W7a.js → index-CDWJlhuZ.js} +2 -2
- package/dist/{index-C7a2XXcz.js → index-CKJMsjnV.js} +4 -4
- package/dist/{index-CDpC4_po.js → index-Cskjr11h.js} +2 -2
- package/dist/{index-DErJ9c2q.js → index-CuYK_i3Q.js} +2 -2
- package/dist/{index-GTkZik4b.js → index-Cwgj3j50.js} +3 -3
- package/dist/{index-CjV5ui_B.js → index-Czhx2OUB.js} +2 -2
- package/dist/{index-CiDg4J7c.js → index-DGoR-pBV.js} +4 -4
- package/dist/{index-YzYX-H93.js → index-DjAZPCEQ.js} +3 -3
- package/dist/{index-Ba41aBBN.js → index-Dutd4cJm.js} +2 -2
- package/dist/{index-DobX4g2g.js → index-Dym_r-do.js} +2 -2
- package/dist/{index-BhFOCfCj.js → index-TshVV9T4.js} +2 -2
- package/dist/{index-BzoBMWdL.js → index-UjGNADrL.js} +3 -3
- package/dist/{index-CYUixRIB.js → index-u-EAOYOb.js} +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5493 -4746
- package/dist/legacy/components/Spotlight/ProjectLinkSelector/index.d.ts +1 -4
- package/dist/legacy/components/Support/AbyssServiceSelect.component.d.ts +1 -1
- package/dist/legacy/components/index.d.ts +1 -1
- package/dist/legacy.js +9626 -8128
- package/dist/translations/en.d.ts +38 -0
- package/dist/translations/fr.d.ts +38 -0
- package/dist/utils/billing-quota-error.utils.d.ts +11 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/project-link-mode.d.ts +4 -0
- package/dist/utils/project-link-wording.utils.d.ts +1 -1
- package/dist/utils/quota-refusal-toast.utils.d.ts +12 -0
- package/dist/utils/quota-refusal-toast.utils.spec.d.ts +1 -0
- package/dist/utils/service-config.d.ts +8 -0
- package/dist/utils/service-config.spec.d.ts +1 -0
- package/package.json +6 -5
- package/scripts/check-external-react-toastify.cjs +104 -0
- package/vite.config.ts +2 -2
- package/dist/AbyssCookieConsentProvider-Ds99df0E.js +0 -4562
- package/dist/CookieConsentSettings.component-DoWLHqw5.js +0 -78
- package/dist/Tabs-C1qcQ2i5.js +0 -2335
- package/dist/design-theme-CG4Gc105.js +0 -24753
- package/dist/legacy/components/CookieConsent/CookieConsentSettings.component.d.ts +0 -2
- /package/dist/{legacy/components/CookieConsent/AbyssCookieConsentProvider.spec.d.ts → auth/components/SecuritySettings/sections/SessionsSection.component.spec.d.ts} +0 -0
- /package/dist/{legacy/components → components/business}/CookieConsent/AbyssCookieConsentProvider.d.ts +0 -0
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
+
demo: {
|
|
3
|
+
banner: {
|
|
4
|
+
title: string;
|
|
5
|
+
summary: string;
|
|
6
|
+
'expires-in': string;
|
|
7
|
+
'expires-today': string;
|
|
8
|
+
reset: string;
|
|
9
|
+
'learn-more': string;
|
|
10
|
+
'reset-dialog': {
|
|
11
|
+
title: string;
|
|
12
|
+
body: string;
|
|
13
|
+
confirm: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
blocked: string;
|
|
17
|
+
};
|
|
2
18
|
'space-display-name': {
|
|
3
19
|
personal: string;
|
|
4
20
|
'perso-in-org': string;
|
|
@@ -164,6 +180,18 @@ declare const _default: {
|
|
|
164
180
|
'error-retry': string;
|
|
165
181
|
};
|
|
166
182
|
};
|
|
183
|
+
'error-boundary': {
|
|
184
|
+
title: string;
|
|
185
|
+
'go-home': string;
|
|
186
|
+
'show-details': string;
|
|
187
|
+
'hide-details': string;
|
|
188
|
+
'details-label': string;
|
|
189
|
+
message: string;
|
|
190
|
+
'component-stack': string;
|
|
191
|
+
copy: string;
|
|
192
|
+
copied: string;
|
|
193
|
+
'copy-failed': string;
|
|
194
|
+
};
|
|
167
195
|
cookies: {
|
|
168
196
|
banner: {
|
|
169
197
|
title: string;
|
|
@@ -810,6 +838,10 @@ declare const _default: {
|
|
|
810
838
|
name: string;
|
|
811
839
|
description: string;
|
|
812
840
|
};
|
|
841
|
+
demo: {
|
|
842
|
+
name: string;
|
|
843
|
+
description: string;
|
|
844
|
+
};
|
|
813
845
|
custom: {
|
|
814
846
|
name: string;
|
|
815
847
|
};
|
|
@@ -1335,6 +1367,7 @@ declare const _default: {
|
|
|
1335
1367
|
totp: string;
|
|
1336
1368
|
recovery: string;
|
|
1337
1369
|
impersonation: string;
|
|
1370
|
+
demo_link: string;
|
|
1338
1371
|
};
|
|
1339
1372
|
passkeys: {
|
|
1340
1373
|
title: string;
|
|
@@ -1806,6 +1839,7 @@ declare const _default: {
|
|
|
1806
1839
|
toast: {
|
|
1807
1840
|
region: string;
|
|
1808
1841
|
dismiss: string;
|
|
1842
|
+
progress: string;
|
|
1809
1843
|
};
|
|
1810
1844
|
'command-palette': {
|
|
1811
1845
|
label: string;
|
|
@@ -2144,5 +2178,9 @@ declare const _default: {
|
|
|
2144
2178
|
};
|
|
2145
2179
|
};
|
|
2146
2180
|
};
|
|
2181
|
+
'password-field': {
|
|
2182
|
+
show: string;
|
|
2183
|
+
hide: string;
|
|
2184
|
+
};
|
|
2147
2185
|
};
|
|
2148
2186
|
export default _default;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
+
demo: {
|
|
3
|
+
banner: {
|
|
4
|
+
title: string;
|
|
5
|
+
summary: string;
|
|
6
|
+
'expires-in': string;
|
|
7
|
+
'expires-today': string;
|
|
8
|
+
reset: string;
|
|
9
|
+
'learn-more': string;
|
|
10
|
+
'reset-dialog': {
|
|
11
|
+
title: string;
|
|
12
|
+
body: string;
|
|
13
|
+
confirm: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
blocked: string;
|
|
17
|
+
};
|
|
2
18
|
'space-display-name': {
|
|
3
19
|
personal: string;
|
|
4
20
|
'perso-in-org': string;
|
|
@@ -164,6 +180,18 @@ declare const _default: {
|
|
|
164
180
|
'error-retry': string;
|
|
165
181
|
};
|
|
166
182
|
};
|
|
183
|
+
'error-boundary': {
|
|
184
|
+
title: string;
|
|
185
|
+
'go-home': string;
|
|
186
|
+
'show-details': string;
|
|
187
|
+
'hide-details': string;
|
|
188
|
+
'details-label': string;
|
|
189
|
+
message: string;
|
|
190
|
+
'component-stack': string;
|
|
191
|
+
copy: string;
|
|
192
|
+
copied: string;
|
|
193
|
+
'copy-failed': string;
|
|
194
|
+
};
|
|
167
195
|
cookies: {
|
|
168
196
|
banner: {
|
|
169
197
|
title: string;
|
|
@@ -810,6 +838,10 @@ declare const _default: {
|
|
|
810
838
|
name: string;
|
|
811
839
|
description: string;
|
|
812
840
|
};
|
|
841
|
+
demo: {
|
|
842
|
+
name: string;
|
|
843
|
+
description: string;
|
|
844
|
+
};
|
|
813
845
|
custom: {
|
|
814
846
|
name: string;
|
|
815
847
|
};
|
|
@@ -1335,6 +1367,7 @@ declare const _default: {
|
|
|
1335
1367
|
totp: string;
|
|
1336
1368
|
recovery: string;
|
|
1337
1369
|
impersonation: string;
|
|
1370
|
+
demo_link: string;
|
|
1338
1371
|
};
|
|
1339
1372
|
passkeys: {
|
|
1340
1373
|
title: string;
|
|
@@ -1806,6 +1839,7 @@ declare const _default: {
|
|
|
1806
1839
|
toast: {
|
|
1807
1840
|
region: string;
|
|
1808
1841
|
dismiss: string;
|
|
1842
|
+
progress: string;
|
|
1809
1843
|
};
|
|
1810
1844
|
'command-palette': {
|
|
1811
1845
|
label: string;
|
|
@@ -2144,5 +2178,9 @@ declare const _default: {
|
|
|
2144
2178
|
};
|
|
2145
2179
|
};
|
|
2146
2180
|
};
|
|
2181
|
+
'password-field': {
|
|
2182
|
+
show: string;
|
|
2183
|
+
hide: string;
|
|
2184
|
+
};
|
|
2147
2185
|
};
|
|
2148
2186
|
export default _default;
|
|
@@ -8,4 +8,14 @@ import { QuotaDialogPayload } from '../hooks/quota-dialog.store';
|
|
|
8
8
|
* returns the offending metric.
|
|
9
9
|
*/
|
|
10
10
|
export declare const parseQuotaError: (error: unknown) => QuotaDialogPayload | null;
|
|
11
|
-
export
|
|
11
|
+
export interface QuotaInterceptorOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Tells whether a location is a public route (a page a visitor opens without being the account
|
|
14
|
+
* owner). Evaluated when the request leaves, never when the response arrives: a request that left
|
|
15
|
+
* from a public route never opens the quota dialog, even if the route changed in between. A
|
|
16
|
+
* request that left from a private route keeps opening it, even when its response arrives on a
|
|
17
|
+
* public page, because the quota that was hit is the visitor's own.
|
|
18
|
+
*/
|
|
19
|
+
isPublicRoute?: (location: Pick<Location, 'pathname'>) => boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const attachQuotaInterceptor: (instances: AxiosInstance[], options?: QuotaInterceptorOptions) => void;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ export * from './billing.utils';
|
|
|
2
2
|
export * from './clipboard.utils';
|
|
3
3
|
export * from './cookie.utils';
|
|
4
4
|
export * from './message-link.utils';
|
|
5
|
+
export * from './project-link-mode';
|
|
5
6
|
export * from './project-link-wording.utils';
|
|
6
7
|
export * from './locale.utils';
|
|
7
8
|
export * from './share-notification.utils';
|
|
8
9
|
export * from './space-display-name.utils';
|
|
9
10
|
export * from './cloud-space-url.utils';
|
|
10
11
|
export * from './billing-quota-error.utils';
|
|
12
|
+
export * from './quota-refusal-toast.utils';
|
|
11
13
|
export * from './cookie-storage.utils';
|
|
12
14
|
export * from './cookie-consent-reconcile.utils';
|
|
13
15
|
export * from './cookie-consent.types';
|
|
@@ -15,4 +17,5 @@ export * from './privacy-link.constant';
|
|
|
15
17
|
export * from './quota-offer-state.utils';
|
|
16
18
|
export * from './family';
|
|
17
19
|
export * from './file.utils';
|
|
20
|
+
export * from './service-config';
|
|
18
21
|
export * from './table-column-width';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ProjectLinkMode } from '
|
|
1
|
+
import { ProjectLinkMode } from './project-link-mode';
|
|
2
2
|
import { ExistingTranslationKey } from '../hooks/use-rich-intl.hook';
|
|
3
3
|
export declare const getAbyssLinkWording: (link: ProjectLinkMode) => ExistingTranslationKey;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shows an error toast unless the error is a quota refusal: that one already opens the shared quota
|
|
3
|
+
* dialog (attachQuotaInterceptor), and a generic toast on top of it would contradict it and hide its
|
|
4
|
+
* call to action on a phone.
|
|
5
|
+
*/
|
|
6
|
+
export declare const toastErrorUnlessQuotaRefusal: (error: unknown, message: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Same as `toastErrorUnlessQuotaRefusal` for a batch of calls (an upload of many files, a bulk
|
|
9
|
+
* action): the quota dialog opens as soon as ONE of them is refused, so no toast follows when any
|
|
10
|
+
* error of the batch is a quota refusal, whatever the order in which the errors arrived.
|
|
11
|
+
*/
|
|
12
|
+
export declare const toastErrorUnlessAnyQuotaRefusal: (errors: readonly unknown[], message: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActivatableService } from '@abyss-project/main';
|
|
2
|
+
export interface ServiceLogoConfig {
|
|
3
|
+
/** URL of the service's mark. */
|
|
4
|
+
logo: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const SERVICE_LOGOS: Partial<Record<ActivatableService, ServiceLogoConfig>>;
|
|
7
|
+
/** The mark of a service; a service without a mark of its own (a game) falls back to Abyss's. */
|
|
8
|
+
export declare const getServiceConfig: (service: ActivatableService) => ServiceLogoConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyss-project/commons-front-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "Front Core package of AbyssProject",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -86,8 +86,9 @@
|
|
|
86
86
|
"react-intl": "^6.2.5",
|
|
87
87
|
"react-is": "^18.0.0 || ^19.0.0",
|
|
88
88
|
"react-router-dom": "^6.15.0",
|
|
89
|
+
"react-toastify": "^8.0.2 || ^10.0.0",
|
|
89
90
|
"zustand": "^5.0.0",
|
|
90
|
-
"@abyss-project/main": "
|
|
91
|
+
"@abyss-project/main": "28.0.0"
|
|
91
92
|
},
|
|
92
93
|
"peerDependenciesMeta": {
|
|
93
94
|
"@abyss-project/capacitor-auth": {
|
|
@@ -135,11 +136,10 @@
|
|
|
135
136
|
"react-dropzone": "^14.3.8",
|
|
136
137
|
"react-error-boundary": "^6.1.1",
|
|
137
138
|
"react-router-dom": "^6.15.0",
|
|
138
|
-
"react-toastify": "^8.0.2",
|
|
139
139
|
"use-debounce": "^10.0.5",
|
|
140
140
|
"uuid": "^9.0.0",
|
|
141
141
|
"yup": "^0.32.11",
|
|
142
|
-
"@abyss-project/main": "
|
|
142
|
+
"@abyss-project/main": "28.0.0"
|
|
143
143
|
},
|
|
144
144
|
"devDependencies": {
|
|
145
145
|
"@abyss-project/cloud": "^2.4.0",
|
|
@@ -171,6 +171,7 @@
|
|
|
171
171
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
172
172
|
"jsdom": "^29.1.1",
|
|
173
173
|
"prettier": "^2.5.1",
|
|
174
|
+
"react-toastify": "^8.0.2",
|
|
174
175
|
"tsc-watch": "^4.6.2",
|
|
175
176
|
"typescript": "5.9.3",
|
|
176
177
|
"vite": "^6.3.5",
|
|
@@ -182,7 +183,7 @@
|
|
|
182
183
|
"lint": "eslint \"{src,apps,libs,test,core,catalog}/**/*.{ts,tsx}\" --fix",
|
|
183
184
|
"lint:check": "eslint \"{src,apps,libs,test,core,catalog}/**/*.{ts,tsx}\" --max-warnings 0",
|
|
184
185
|
"tsc": "tsc --noEmit && tsc --noEmit -p catalog/tsconfig.json",
|
|
185
|
-
"build": "vite build && node scripts/check-auth-entry-isolation.cjs",
|
|
186
|
+
"build": "vite build && node scripts/check-auth-entry-isolation.cjs && node scripts/check-external-react-toastify.cjs",
|
|
186
187
|
"dev": "vite build --watch",
|
|
187
188
|
"test": "vitest run --config vitest.config.ts",
|
|
188
189
|
"test:watch": "vitest --config vitest.config.ts",
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
}
|
package/vite.config.ts
CHANGED
|
@@ -61,7 +61,7 @@ export default defineConfig({
|
|
|
61
61
|
// monitor SDK that the full barrel transitively includes.
|
|
62
62
|
entry: {
|
|
63
63
|
index: resolve(__dirname, 'src/index.ts'),
|
|
64
|
-
'cookie-consent': resolve(__dirname, 'src/
|
|
64
|
+
'cookie-consent': resolve(__dirname, 'src/components/business/CookieConsent/index.ts'),
|
|
65
65
|
// The native auth bridge, out of the main barrel: the only importer of the optional peer
|
|
66
66
|
// `@abyss-project/capacitor-auth`, which a web-only consumer does not install.
|
|
67
67
|
'auth-native': resolve(__dirname, 'src/auth/client/capacitor-bridge.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',
|
|
96
|
+
'react', 'react-dom', 'react-intl', 'react-router-dom', 'react-toastify',
|
|
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',
|