@mercurjs/dashboard-sdk 2.1.2-canary.5 → 2.2.0-canary.1
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/dist/index.cjs +7 -5
- package/dist/index.d.cts +8 -19
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -144,7 +144,7 @@ var import_path = __toESM(require("path"), 1);
|
|
|
144
144
|
function getRoute(file, routesDir) {
|
|
145
145
|
const importPath = normalizePath(file);
|
|
146
146
|
const normalizedRoutesDir = normalizePath(routesDir);
|
|
147
|
-
return importPath.replace(normalizedRoutesDir, "").replace(/\[\[\*\]\]/g, "*?").replace(/\[\*\]/g, "*").replace(/\(([
|
|
147
|
+
return importPath.replace(normalizedRoutesDir, "").replace(/\[\[\*\]\]/g, "*?").replace(/\[\*\]/g, "*").replace(/\(([^[\])]+)\)/g, "$1?").replace(/\[\[([^\]]+)\]\]/g, ":$1?").replace(/\[([^\]]+)\]/g, ":$1").replace(
|
|
148
148
|
new RegExp(
|
|
149
149
|
`/page\\.(${VALID_FILE_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})$`
|
|
150
150
|
),
|
|
@@ -387,7 +387,7 @@ function crawlRoutes2(dir, pattern = "page") {
|
|
|
387
387
|
function getRoute2(file, routesDir) {
|
|
388
388
|
const importPath = normalizePath(file);
|
|
389
389
|
const normalizedRoutesDir = normalizePath(routesDir);
|
|
390
|
-
return importPath.replace(normalizedRoutesDir, "").replace(/\[\[\*\]\]/g, "*?").replace(/\[\*\]/g, "*").replace(/\(([
|
|
390
|
+
return importPath.replace(normalizedRoutesDir, "").replace(/\[\[\*\]\]/g, "*?").replace(/\[\*\]/g, "*").replace(/\(([^[\])]+)\)/g, "$1?").replace(/\[\[([^\]]+)\]\]/g, ":$1?").replace(/\[([^\]]+)\]/g, ":$1").replace(
|
|
391
391
|
new RegExp(
|
|
392
392
|
`/page\\.(${VALID_FILE_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})$`
|
|
393
393
|
),
|
|
@@ -614,7 +614,7 @@ function loadVirtualModule({
|
|
|
614
614
|
return null;
|
|
615
615
|
}
|
|
616
616
|
function loadConfigModule(mercurConfig) {
|
|
617
|
-
const {
|
|
617
|
+
const { ...configWithoutComponents } = mercurConfig;
|
|
618
618
|
return `export default ${JSON.stringify(configWithoutComponents)}`;
|
|
619
619
|
}
|
|
620
620
|
function loadComponentsModule(mercurConfig, cwd) {
|
|
@@ -623,7 +623,7 @@ function loadComponentsModule(mercurConfig, cwd) {
|
|
|
623
623
|
const exports2 = [];
|
|
624
624
|
Object.entries(components).forEach(([name, componentPath]) => {
|
|
625
625
|
const resolvedPath = import_path4.default.resolve(cwd, "src", componentPath);
|
|
626
|
-
imports.push(`import _${name} from "${resolvedPath}"`);
|
|
626
|
+
imports.push(`import _${name} from "${JSON.stringify(resolvedPath)}"`);
|
|
627
627
|
exports2.push(`${name}: _${name}`);
|
|
628
628
|
});
|
|
629
629
|
return `
|
|
@@ -768,13 +768,15 @@ function mercurDashboardPlugin(pluginConfig) {
|
|
|
768
768
|
);
|
|
769
769
|
const srcDir = import_path5.default.join(root, "src");
|
|
770
770
|
const backendUrl = pluginConfig.backendUrl ?? "http://localhost:9000";
|
|
771
|
+
const imageLimit = pluginConfig.imageLimit ?? 2 * 1024 * 1024;
|
|
771
772
|
config = {
|
|
772
773
|
...pluginConfig,
|
|
773
774
|
backendUrl,
|
|
774
775
|
base,
|
|
775
776
|
root,
|
|
776
777
|
srcDir,
|
|
777
|
-
pluginExtensions
|
|
778
|
+
pluginExtensions,
|
|
779
|
+
imageLimit
|
|
778
780
|
};
|
|
779
781
|
return {
|
|
780
782
|
base: config.base,
|
package/dist/index.d.cts
CHANGED
|
@@ -49,25 +49,6 @@ interface MercurConfig {
|
|
|
49
49
|
SettingsSidebar?: string;
|
|
50
50
|
TopbarActions?: string;
|
|
51
51
|
StoreSetup?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Component that injects additional fields into the vendor
|
|
54
|
-
* onboarding wizard's company step.
|
|
55
|
-
*
|
|
56
|
-
* The default export should be a React component that calls
|
|
57
|
-
* `useFormContext()` from react-hook-form and renders extra
|
|
58
|
-
* `<Form.Field />` entries. Values are forwarded to the
|
|
59
|
-
* create-seller mutation under the standard Medusa
|
|
60
|
-
* `additional_data` key.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```ts
|
|
64
|
-
* components: {
|
|
65
|
-
* OnboardingCompanyExtraFields:
|
|
66
|
-
* 'components/onboarding/company-extra-fields',
|
|
67
|
-
* }
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
OnboardingCompanyExtraFields?: string;
|
|
71
52
|
};
|
|
72
53
|
/** Internationalization settings. */
|
|
73
54
|
i18n?: {
|
|
@@ -76,6 +57,13 @@ interface MercurConfig {
|
|
|
76
57
|
};
|
|
77
58
|
/** Whether to allow new sellers to register from the login screen. */
|
|
78
59
|
enableSellerRegistration?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Maximum allowed size for image uploads, in bytes.
|
|
62
|
+
* Used by dashboard upload components to reject oversized files
|
|
63
|
+
* before they are sent to the backend.
|
|
64
|
+
* @default 2_097_152 // 2 MB
|
|
65
|
+
*/
|
|
66
|
+
imageLimit?: number;
|
|
79
67
|
}
|
|
80
68
|
interface BuiltMercurConfig extends MercurConfig {
|
|
81
69
|
backendUrl: string;
|
|
@@ -83,6 +71,7 @@ interface BuiltMercurConfig extends MercurConfig {
|
|
|
83
71
|
root: string;
|
|
84
72
|
srcDir: string;
|
|
85
73
|
pluginExtensions: string[];
|
|
74
|
+
imageLimit: number;
|
|
86
75
|
}
|
|
87
76
|
type RouteConfig = {
|
|
88
77
|
label: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercurjs/dashboard-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-canary.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mercurjs/mercur",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"dev": "tsup --watch",
|
|
24
24
|
"build": "tsup",
|
|
25
|
-
"lint": "
|
|
25
|
+
"lint": "oxlint --max-warnings 0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/parser": "7.25.6",
|