@medusajs/admin-vite-plugin 3.0.0-snapshot-20251104011621 → 3.0.0-snapshot-20251106143524
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.js +15 -5
- package/dist/index.mjs +15 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1153,7 +1153,7 @@ var import_outdent3 = require("outdent");
|
|
|
1153
1153
|
// src/routes/helpers.ts
|
|
1154
1154
|
function getRoute(file) {
|
|
1155
1155
|
const importPath = normalizePath(file);
|
|
1156
|
-
return importPath.replace(/.*\/admin\/(routes)/, "").replace(/\[([^\]]+)\]/g, ":$1").replace(
|
|
1156
|
+
return importPath.replace(/.*\/admin\/(routes)/, "").replace("[[*]]", "*?").replace("[*]", "*").replace(/\(([^\[\]\)]+)\)/g, "$1?").replace(/\[\[([^\]]+)\]\]/g, ":$1?").replace(/\[([^\]]+)\]/g, ":$1").replace(
|
|
1157
1157
|
new RegExp(
|
|
1158
1158
|
`/page\\.(${VALID_FILE_EXTENSIONS.map((ext) => ext.slice(1)).join(
|
|
1159
1159
|
"|"
|
|
@@ -1180,12 +1180,13 @@ function generateCode3(results) {
|
|
|
1180
1180
|
`;
|
|
1181
1181
|
}
|
|
1182
1182
|
function formatMenuItem(route) {
|
|
1183
|
-
const { label, icon, path: path3, nested } = route;
|
|
1183
|
+
const { label, icon, path: path3, nested, translationNs } = route;
|
|
1184
1184
|
return `{
|
|
1185
1185
|
label: ${label},
|
|
1186
1186
|
icon: ${icon || "undefined"},
|
|
1187
1187
|
path: "${path3}",
|
|
1188
|
-
nested: ${nested ? `"${nested}"` : "undefined"}
|
|
1188
|
+
nested: ${nested ? `"${nested}"` : "undefined"},
|
|
1189
|
+
translationNs: ${translationNs ? `${translationNs}` : "undefined"}
|
|
1189
1190
|
}`;
|
|
1190
1191
|
}
|
|
1191
1192
|
async function getFilesFromSources5(sources) {
|
|
@@ -1227,7 +1228,8 @@ function generateMenuItem(config, file, index) {
|
|
|
1227
1228
|
label: `${configName}.label`,
|
|
1228
1229
|
icon: config.icon ? `${configName}.icon` : void 0,
|
|
1229
1230
|
path: getRoute(file),
|
|
1230
|
-
nested: config.nested
|
|
1231
|
+
nested: config.nested,
|
|
1232
|
+
translationNs: config.translationNs ? `${configName}.translationNs` : void 0
|
|
1231
1233
|
};
|
|
1232
1234
|
}
|
|
1233
1235
|
async function getRouteConfig(file) {
|
|
@@ -1312,10 +1314,18 @@ function processConfigProperties(properties, file) {
|
|
|
1312
1314
|
);
|
|
1313
1315
|
return null;
|
|
1314
1316
|
}
|
|
1317
|
+
const translationNs = properties.find(
|
|
1318
|
+
(prop) => (0, import_types.isObjectProperty)(prop) && (0, import_types.isIdentifier)(prop.key, { name: "translationNs" })
|
|
1319
|
+
);
|
|
1320
|
+
let translationNsValue = void 0;
|
|
1321
|
+
if ((0, import_types.isStringLiteral)(translationNs?.value)) {
|
|
1322
|
+
translationNsValue = translationNs.value.value;
|
|
1323
|
+
}
|
|
1315
1324
|
return {
|
|
1316
1325
|
label: hasLabel,
|
|
1317
1326
|
icon: hasProperty("icon"),
|
|
1318
|
-
nested: nestedValue
|
|
1327
|
+
nested: nestedValue,
|
|
1328
|
+
translationNs: translationNsValue
|
|
1319
1329
|
};
|
|
1320
1330
|
}
|
|
1321
1331
|
function generateRouteConfigName(index) {
|
package/dist/index.mjs
CHANGED
|
@@ -1143,7 +1143,7 @@ import { outdent as outdent3 } from "outdent";
|
|
|
1143
1143
|
// src/routes/helpers.ts
|
|
1144
1144
|
function getRoute(file) {
|
|
1145
1145
|
const importPath = normalizePath(file);
|
|
1146
|
-
return importPath.replace(/.*\/admin\/(routes)/, "").replace(/\[([^\]]+)\]/g, ":$1").replace(
|
|
1146
|
+
return importPath.replace(/.*\/admin\/(routes)/, "").replace("[[*]]", "*?").replace("[*]", "*").replace(/\(([^\[\]\)]+)\)/g, "$1?").replace(/\[\[([^\]]+)\]\]/g, ":$1?").replace(/\[([^\]]+)\]/g, ":$1").replace(
|
|
1147
1147
|
new RegExp(
|
|
1148
1148
|
`/page\\.(${VALID_FILE_EXTENSIONS.map((ext) => ext.slice(1)).join(
|
|
1149
1149
|
"|"
|
|
@@ -1170,12 +1170,13 @@ function generateCode3(results) {
|
|
|
1170
1170
|
`;
|
|
1171
1171
|
}
|
|
1172
1172
|
function formatMenuItem(route) {
|
|
1173
|
-
const { label, icon, path: path3, nested } = route;
|
|
1173
|
+
const { label, icon, path: path3, nested, translationNs } = route;
|
|
1174
1174
|
return `{
|
|
1175
1175
|
label: ${label},
|
|
1176
1176
|
icon: ${icon || "undefined"},
|
|
1177
1177
|
path: "${path3}",
|
|
1178
|
-
nested: ${nested ? `"${nested}"` : "undefined"}
|
|
1178
|
+
nested: ${nested ? `"${nested}"` : "undefined"},
|
|
1179
|
+
translationNs: ${translationNs ? `${translationNs}` : "undefined"}
|
|
1179
1180
|
}`;
|
|
1180
1181
|
}
|
|
1181
1182
|
async function getFilesFromSources5(sources) {
|
|
@@ -1217,7 +1218,8 @@ function generateMenuItem(config, file, index) {
|
|
|
1217
1218
|
label: `${configName}.label`,
|
|
1218
1219
|
icon: config.icon ? `${configName}.icon` : void 0,
|
|
1219
1220
|
path: getRoute(file),
|
|
1220
|
-
nested: config.nested
|
|
1221
|
+
nested: config.nested,
|
|
1222
|
+
translationNs: config.translationNs ? `${configName}.translationNs` : void 0
|
|
1221
1223
|
};
|
|
1222
1224
|
}
|
|
1223
1225
|
async function getRouteConfig(file) {
|
|
@@ -1302,10 +1304,18 @@ function processConfigProperties(properties, file) {
|
|
|
1302
1304
|
);
|
|
1303
1305
|
return null;
|
|
1304
1306
|
}
|
|
1307
|
+
const translationNs = properties.find(
|
|
1308
|
+
(prop) => isObjectProperty(prop) && isIdentifier(prop.key, { name: "translationNs" })
|
|
1309
|
+
);
|
|
1310
|
+
let translationNsValue = void 0;
|
|
1311
|
+
if (isStringLiteral(translationNs?.value)) {
|
|
1312
|
+
translationNsValue = translationNs.value.value;
|
|
1313
|
+
}
|
|
1305
1314
|
return {
|
|
1306
1315
|
label: hasLabel,
|
|
1307
1316
|
icon: hasProperty("icon"),
|
|
1308
|
-
nested: nestedValue
|
|
1317
|
+
nested: nestedValue,
|
|
1318
|
+
translationNs: translationNsValue
|
|
1309
1319
|
};
|
|
1310
1320
|
}
|
|
1311
1321
|
function generateRouteConfigName(index) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/admin-vite-plugin",
|
|
3
|
-
"version": "3.0.0-snapshot-
|
|
3
|
+
"version": "3.0.0-snapshot-20251106143524",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@babel/parser": "7.25.6",
|
|
37
37
|
"@babel/traverse": "7.25.6",
|
|
38
38
|
"@babel/types": "7.25.6",
|
|
39
|
-
"@medusajs/admin-shared": "3.0.0-snapshot-
|
|
39
|
+
"@medusajs/admin-shared": "3.0.0-snapshot-20251106143524",
|
|
40
40
|
"chokidar": "^3.5.3",
|
|
41
41
|
"fdir": "6.1.1",
|
|
42
42
|
"magic-string": "0.30.5",
|