@medusajs/admin-vite-plugin 2.19.0-snapshot-20260812155528 → 2.19.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 (3) hide show
  1. package/dist/index.js +99 -185
  2. package/dist/index.mjs +99 -186
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ __export(index_exports, {
35
35
  module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // src/plugin.ts
38
- var import_promises17 = require("fs/promises");
38
+ var import_promises15 = require("fs/promises");
39
39
  var import_node_path = __toESM(require("path"));
40
40
 
41
41
  // src/cell-renderers/generate-cell-renderer-hash.ts
@@ -83,12 +83,12 @@ function generateModule(code) {
83
83
  var VALID_FILE_EXTENSIONS = [".tsx", ".jsx", ".js", ".ts"];
84
84
  async function crawl(dir, file, depth) {
85
85
  const dirDepth = dir.split(import_path.default.sep).length;
86
- const crawler = new import_fdir.fdir().withBasePath().exclude((dirName) => dirName.startsWith("_")).filter((path7) => {
87
- return VALID_FILE_EXTENSIONS.some((ext) => path7.endsWith(ext));
86
+ const crawler = new import_fdir.fdir().withBasePath().exclude((dirName) => dirName.startsWith("_")).filter((path5) => {
87
+ return VALID_FILE_EXTENSIONS.some((ext) => path5.endsWith(ext));
88
88
  });
89
89
  if (file) {
90
- crawler.filter((path7) => {
91
- return VALID_FILE_EXTENSIONS.some((ext) => path7.endsWith(file + ext));
90
+ crawler.filter((path5) => {
91
+ return VALID_FILE_EXTENSIONS.some((ext) => path5.endsWith(file + ext));
92
92
  });
93
93
  }
94
94
  if (depth) {
@@ -105,15 +105,15 @@ async function crawl(dir, file, depth) {
105
105
  }
106
106
  return crawler.crawl(dir).withPromise();
107
107
  }
108
- function getConfigObjectProperties(path7) {
109
- if ((0, import_types.isVariableDeclarator)(path7.node)) {
110
- const configDeclaration = (0, import_types.isIdentifier)(path7.node.id, { name: "config" }) ? path7.node : null;
108
+ function getConfigObjectProperties(path5) {
109
+ if ((0, import_types.isVariableDeclarator)(path5.node)) {
110
+ const configDeclaration = (0, import_types.isIdentifier)(path5.node.id, { name: "config" }) ? path5.node : null;
111
111
  if (configDeclaration && (0, import_types.isCallExpression)(configDeclaration.init) && configDeclaration.init.arguments.length > 0 && (0, import_types.isObjectExpression)(configDeclaration.init.arguments[0])) {
112
112
  return configDeclaration.init.arguments[0].properties;
113
113
  }
114
114
  return null;
115
115
  }
116
- const declaration = path7.node.declaration;
116
+ const declaration = path5.node.declaration;
117
117
  if ((0, import_types.isVariableDeclaration)(declaration)) {
118
118
  const configDeclaration = declaration.declarations.find(
119
119
  (d) => (0, import_types.isVariableDeclarator)(d) && (0, import_types.isIdentifier)(d.id, { name: "config" })
@@ -130,13 +130,13 @@ async function hasDefaultExport(ast) {
130
130
  ExportDefaultDeclaration() {
131
131
  hasDefaultExport2 = true;
132
132
  },
133
- AssignmentExpression(path7) {
134
- if (path7.node.left.type === "MemberExpression" && path7.node.left.object.type === "Identifier" && path7.node.left.object.name === "exports" && path7.node.left.property.type === "Identifier" && path7.node.left.property.name === "default") {
133
+ AssignmentExpression(path5) {
134
+ if (path5.node.left.type === "MemberExpression" && path5.node.left.object.type === "Identifier" && path5.node.left.object.name === "exports" && path5.node.left.property.type === "Identifier" && path5.node.left.property.name === "default") {
135
135
  hasDefaultExport2 = true;
136
136
  }
137
137
  },
138
- ExportNamedDeclaration(path7) {
139
- const specifiers = path7.node.specifiers;
138
+ ExportNamedDeclaration(path5) {
139
+ const specifiers = path5.node.specifiers;
140
140
  if (specifiers?.some(
141
141
  (s) => s.type === "ExportSpecifier" && s.exported.type === "Identifier" && s.exported.name === "default"
142
142
  )) {
@@ -222,8 +222,8 @@ var logger = {
222
222
 
223
223
  // src/custom-fields/helpers.ts
224
224
  var import_admin_shared = require("@medusajs/admin-shared");
225
- function getModel(path7, file) {
226
- const configArgument = getConfigArgument(path7);
225
+ function getModel(path5, file) {
226
+ const configArgument = getConfigArgument(path5);
227
227
  if (!configArgument) {
228
228
  return null;
229
229
  }
@@ -257,23 +257,23 @@ function getModel(path7, file) {
257
257
  }
258
258
  return model;
259
259
  }
260
- function getConfigArgument(path7) {
261
- if (!(0, import_types.isCallExpression)(path7.node.declaration)) {
260
+ function getConfigArgument(path5) {
261
+ if (!(0, import_types.isCallExpression)(path5.node.declaration)) {
262
262
  return null;
263
263
  }
264
- if (!(0, import_types.isIdentifier)(path7.node.declaration.callee, {
264
+ if (!(0, import_types.isIdentifier)(path5.node.declaration.callee, {
265
265
  name: "unstable_defineCustomFieldsConfig"
266
266
  })) {
267
267
  return null;
268
268
  }
269
- const configArgument = path7.node.declaration.arguments[0];
269
+ const configArgument = path5.node.declaration.arguments[0];
270
270
  if (!(0, import_types.isObjectExpression)(configArgument)) {
271
271
  return null;
272
272
  }
273
273
  return configArgument;
274
274
  }
275
- function validateLink(path7, file) {
276
- const configArgument = getConfigArgument(path7);
275
+ function validateLink(path5, file) {
276
+ const configArgument = getConfigArgument(path5);
277
277
  if (!configArgument) {
278
278
  return false;
279
279
  }
@@ -363,14 +363,14 @@ async function parseDisplayFile(file, index) {
363
363
  let hasLink = false;
364
364
  try {
365
365
  traverse(ast, {
366
- ExportDefaultDeclaration(path7) {
367
- const _model = getModel(path7, file);
366
+ ExportDefaultDeclaration(path5) {
367
+ const _model = getModel(path5, file);
368
368
  if (!_model) {
369
369
  return;
370
370
  }
371
371
  model = _model;
372
- displays = getDisplays(path7, model, index, file);
373
- hasLink = validateLink(path7, file);
372
+ displays = getDisplays(path5, model, index, file);
373
+ hasLink = validateLink(path5, file);
374
374
  }
375
375
  });
376
376
  } catch (err) {
@@ -394,8 +394,8 @@ async function parseDisplayFile(file, index) {
394
394
  displays
395
395
  };
396
396
  }
397
- function getDisplays(path7, model, index, file) {
398
- const configArgument = getConfigArgument(path7);
397
+ function getDisplays(path5, model, index, file) {
398
+ const configArgument = getConfigArgument(path5);
399
399
  if (!configArgument) {
400
400
  return null;
401
401
  }
@@ -471,8 +471,8 @@ function generateCustomFieldConfigName(index) {
471
471
  return `CustomFieldConfig${index}`;
472
472
  }
473
473
  function generateImport(file, index) {
474
- const path7 = normalizePath(file);
475
- return `import ${generateCustomFieldConfigName(index)} from "${path7}"`;
474
+ const path5 = normalizePath(file);
475
+ return `import ${generateCustomFieldConfigName(index)} from "${path5}"`;
476
476
  }
477
477
 
478
478
  // src/custom-fields/generate-custom-field-forms.ts
@@ -592,15 +592,15 @@ async function parseFile(file, index) {
592
592
  let hasLink = false;
593
593
  try {
594
594
  traverse(ast, {
595
- ExportDefaultDeclaration(path7) {
596
- const _model = getModel(path7, file);
595
+ ExportDefaultDeclaration(path5) {
596
+ const _model = getModel(path5, file);
597
597
  if (!_model) {
598
598
  return;
599
599
  }
600
600
  model = _model;
601
- hasLink = validateLink(path7, file);
602
- configs = getConfigs(path7, model, index, file);
603
- forms = getForms(path7, model, index, file);
601
+ hasLink = validateLink(path5, file);
602
+ configs = getConfigs(path5, model, index, file);
603
+ forms = getForms(path5, model, index, file);
604
604
  }
605
605
  });
606
606
  } catch (err) {
@@ -629,11 +629,11 @@ function generateCustomFieldConfigName2(index) {
629
629
  return `CustomFieldConfig${index}`;
630
630
  }
631
631
  function generateImport2(file, index) {
632
- const path7 = normalizePath(file);
633
- return `import ${generateCustomFieldConfigName2(index)} from "${path7}"`;
632
+ const path5 = normalizePath(file);
633
+ return `import ${generateCustomFieldConfigName2(index)} from "${path5}"`;
634
634
  }
635
- function getForms(path7, model, index, file) {
636
- const formArray = getFormsArgument(path7, file);
635
+ function getForms(path5, model, index, file) {
636
+ const formArray = getFormsArgument(path5, file);
637
637
  if (!formArray) {
638
638
  return null;
639
639
  }
@@ -797,8 +797,8 @@ function getFormFieldSectionValue(exists, fileIndex, formIndex, fieldKey, value)
797
797
  function getFormEntryFieldPath(model, zone, tab) {
798
798
  return `${model}.${zone}.${tab ? `${tab}.` : ""}$field`;
799
799
  }
800
- function getConfigs(path7, model, index, file) {
801
- const formArray = getFormsArgument(path7, file);
800
+ function getConfigs(path5, model, index, file) {
801
+ const formArray = getFormsArgument(path5, file);
802
802
  if (!formArray) {
803
803
  logger.warn(`'forms' property is missing.`, { file });
804
804
  return null;
@@ -917,8 +917,8 @@ function getFormFieldValue(fileIndex, formIndex, fieldKey, value) {
917
917
  function getFormEntryConfigPath(model, zone) {
918
918
  return `${model}.${zone}.$config`;
919
919
  }
920
- function getFormsArgument(path7, file) {
921
- const configArgument = getConfigArgument(path7);
920
+ function getFormsArgument(path5, file) {
921
+ const configArgument = getConfigArgument(path5);
922
922
  if (!configArgument) {
923
923
  return null;
924
924
  }
@@ -979,8 +979,8 @@ async function getCustomFieldContents(file) {
979
979
  let displayContent = null;
980
980
  try {
981
981
  traverse(ast, {
982
- ExportDefaultDeclaration(path7) {
983
- const configArgument = getConfigArgument(path7);
982
+ ExportDefaultDeclaration(path5) {
983
+ const configArgument = getConfigArgument(path5);
984
984
  if (!configArgument) {
985
985
  return;
986
986
  }
@@ -1074,13 +1074,13 @@ async function parseFile2(file, index) {
1074
1074
  let model = null;
1075
1075
  try {
1076
1076
  traverse(ast, {
1077
- ExportDefaultDeclaration(path7) {
1078
- const _model = getModel(path7, file);
1077
+ ExportDefaultDeclaration(path5) {
1078
+ const _model = getModel(path5, file);
1079
1079
  if (!_model) {
1080
1080
  return;
1081
1081
  }
1082
1082
  model = _model;
1083
- link = getLink(path7, index, file);
1083
+ link = getLink(path5, index, file);
1084
1084
  }
1085
1085
  });
1086
1086
  } catch (err) {
@@ -1103,11 +1103,11 @@ function generateCustomFieldConfigName3(index) {
1103
1103
  return `CustomFieldConfig${index}`;
1104
1104
  }
1105
1105
  function generateImport3(file, index) {
1106
- const path7 = normalizePath(file);
1107
- return `import ${generateCustomFieldConfigName3(index)} from "${path7}"`;
1106
+ const path5 = normalizePath(file);
1107
+ return `import ${generateCustomFieldConfigName3(index)} from "${path5}"`;
1108
1108
  }
1109
- function getLink(path7, index, file) {
1110
- const configArgument = getConfigArgument(path7);
1109
+ function getLink(path5, index, file) {
1110
+ const configArgument = getConfigArgument(path5);
1111
1111
  if (!configArgument) {
1112
1112
  return null;
1113
1113
  }
@@ -1246,11 +1246,11 @@ async function parseFile3(file, index) {
1246
1246
  function hasConfigExport(ast) {
1247
1247
  let found = false;
1248
1248
  traverse(ast, {
1249
- ExportNamedDeclaration(path7) {
1249
+ ExportNamedDeclaration(path5) {
1250
1250
  if (found) {
1251
1251
  return;
1252
1252
  }
1253
- if (getConfigObjectProperties(path7)) {
1253
+ if (getConfigObjectProperties(path5)) {
1254
1254
  found = true;
1255
1255
  }
1256
1256
  }
@@ -1258,8 +1258,8 @@ function hasConfigExport(ast) {
1258
1258
  return found;
1259
1259
  }
1260
1260
  function generateImport4(file, componentName, configName) {
1261
- const path7 = normalizePath(file);
1262
- return `import ${componentName}, { config as ${configName} } from "${path7}"`;
1261
+ const path5 = normalizePath(file);
1262
+ return `import ${componentName}, { config as ${configName} } from "${path5}"`;
1263
1263
  }
1264
1264
 
1265
1265
  // src/layouts/generate-layout-hash.ts
@@ -1307,11 +1307,11 @@ function generateCode4(results) {
1307
1307
  `;
1308
1308
  }
1309
1309
  function formatMenuItem(route) {
1310
- const { label, icon, path: path7, nested, rank, translationNs } = route;
1310
+ const { label, icon, path: path5, nested, rank, translationNs } = route;
1311
1311
  return `{
1312
1312
  label: ${label},
1313
1313
  icon: ${icon || "undefined"},
1314
- path: "${path7}",
1314
+ path: "${path5}",
1315
1315
  nested: ${nested ? `"${nested}"` : "undefined"},
1316
1316
  rank: ${rank !== void 0 ? rank : "undefined"},
1317
1317
  translationNs: ${translationNs ? `${translationNs}` : "undefined"}
@@ -1347,8 +1347,8 @@ async function parseFile4(file, index) {
1347
1347
  };
1348
1348
  }
1349
1349
  function generateImport5(file, index) {
1350
- const path7 = normalizePath(file);
1351
- return `import { config as ${generateRouteConfigName(index)} } from "${path7}"`;
1350
+ const path5 = normalizePath(file);
1351
+ return `import { config as ${generateRouteConfigName(index)} } from "${path5}"`;
1352
1352
  }
1353
1353
  function generateMenuItem(config, file, index) {
1354
1354
  const configName = generateRouteConfigName(index);
@@ -1381,11 +1381,11 @@ async function getRouteConfig(file) {
1381
1381
  * For bundled files, the config will not be a named export,
1382
1382
  * but instead a variable declaration.
1383
1383
  */
1384
- VariableDeclarator(path7) {
1384
+ VariableDeclarator(path5) {
1385
1385
  if (configFound) {
1386
1386
  return;
1387
1387
  }
1388
- const properties = getConfigObjectProperties(path7);
1388
+ const properties = getConfigObjectProperties(path5);
1389
1389
  if (!properties) {
1390
1390
  return;
1391
1391
  }
@@ -1397,11 +1397,11 @@ async function getRouteConfig(file) {
1397
1397
  /**
1398
1398
  * For unbundled files, the `config` will always be a named export.
1399
1399
  */
1400
- ExportNamedDeclaration(path7) {
1400
+ ExportNamedDeclaration(path5) {
1401
1401
  if (configFound) {
1402
1402
  return;
1403
1403
  }
1404
- const properties = getConfigObjectProperties(path7);
1404
+ const properties = getConfigObjectProperties(path5);
1405
1405
  if (!properties) {
1406
1406
  return;
1407
1407
  }
@@ -1506,13 +1506,13 @@ async function getRouteContents(file) {
1506
1506
  let configContent = null;
1507
1507
  try {
1508
1508
  traverse(ast, {
1509
- ExportDefaultDeclaration(path7) {
1510
- defaultExportContent = code.slice(path7.node.start, path7.node.end);
1509
+ ExportDefaultDeclaration(path5) {
1510
+ defaultExportContent = code.slice(path5.node.start, path5.node.end);
1511
1511
  },
1512
- ExportNamedDeclaration(path7) {
1513
- const properties = getConfigObjectProperties(path7);
1512
+ ExportNamedDeclaration(path5) {
1513
+ const properties = getConfigObjectProperties(path5);
1514
1514
  if (properties) {
1515
- configContent = code.slice(path7.node.start, path7.node.end);
1515
+ configContent = code.slice(path5.node.start, path5.node.end);
1516
1516
  }
1517
1517
  }
1518
1518
  });
@@ -1692,8 +1692,8 @@ async function hasNamedExports(ast, file) {
1692
1692
  let hasConfig = false;
1693
1693
  try {
1694
1694
  traverse(ast, {
1695
- ExportNamedDeclaration(path7) {
1696
- const declaration = path7.node.declaration;
1695
+ ExportNamedDeclaration(path5) {
1696
+ const declaration = path5.node.declaration;
1697
1697
  if (declaration?.type === "VariableDeclaration") {
1698
1698
  declaration.declarations.forEach((decl) => {
1699
1699
  if (decl.id.type === "Identifier" && decl.id.name === "handle") {
@@ -1721,27 +1721,6 @@ async function hasNamedExports(ast, file) {
1721
1721
  return { hasHandle, hasLoader, hasConfig };
1722
1722
  }
1723
1723
 
1724
- // src/search-entities/generate-search-entity-hash.ts
1725
- var import_promises12 = __toESM(require("fs/promises"));
1726
- var import_path3 = __toESM(require("path"));
1727
- var SEARCH_ENTITY_FILES = ["search-entities.tsx", "search-entities.ts"];
1728
- async function generateSearchEntityHash(sources) {
1729
- const contents = [];
1730
- for (const source of sources) {
1731
- for (const fileName of SEARCH_ENTITY_FILES) {
1732
- const searchEntitiesPath = import_path3.default.join(source, fileName);
1733
- try {
1734
- const content = await import_promises12.default.readFile(searchEntitiesPath, "utf-8");
1735
- contents.push(content);
1736
- break;
1737
- } catch {
1738
- }
1739
- }
1740
- }
1741
- const totalContent = contents.join("");
1742
- return generateHash(totalContent);
1743
- }
1744
-
1745
1724
  // src/virtual-modules/generate-virtual-display-module.ts
1746
1725
  var import_outdent6 = require("outdent");
1747
1726
  async function generateVirtualDisplayModule(sources, pluginMode = false) {
@@ -1821,7 +1800,7 @@ async function generateVirtualRouteModule(sources, pluginMode = false) {
1821
1800
  var import_outdent13 = __toESM(require("outdent"));
1822
1801
 
1823
1802
  // src/widgets/generate-widget-hash.ts
1824
- var import_promises13 = __toESM(require("fs/promises"));
1803
+ var import_promises12 = __toESM(require("fs/promises"));
1825
1804
 
1826
1805
  // src/widgets/helpers.ts
1827
1806
  async function getWidgetFilesFromSources(sources) {
@@ -1838,7 +1817,7 @@ async function generateWidgetHash(sources) {
1838
1817
  return generateHash(totalContent);
1839
1818
  }
1840
1819
  async function getWidgetContents(file) {
1841
- const code = await import_promises13.default.readFile(file, "utf-8");
1820
+ const code = await import_promises12.default.readFile(file, "utf-8");
1842
1821
  let ast;
1843
1822
  try {
1844
1823
  ast = (0, import_parser.parse)(code, getParserOptions(file));
@@ -1855,14 +1834,14 @@ async function getWidgetContents(file) {
1855
1834
  let configContent = null;
1856
1835
  let defaultExportContent = null;
1857
1836
  traverse(ast, {
1858
- ExportNamedDeclaration(path7) {
1859
- const properties = getConfigObjectProperties(path7);
1837
+ ExportNamedDeclaration(path5) {
1838
+ const properties = getConfigObjectProperties(path5);
1860
1839
  if (properties) {
1861
- configContent = code.slice(path7.node.start, path7.node.end);
1840
+ configContent = code.slice(path5.node.start, path5.node.end);
1862
1841
  }
1863
1842
  },
1864
- ExportDefaultDeclaration(path7) {
1865
- defaultExportContent = code.slice(path7.node.start, path7.node.end);
1843
+ ExportDefaultDeclaration(path5) {
1844
+ defaultExportContent = code.slice(path5.node.start, path5.node.end);
1866
1845
  }
1867
1846
  });
1868
1847
  return { config: configContent, defaultExport: defaultExportContent };
@@ -1870,7 +1849,7 @@ async function getWidgetContents(file) {
1870
1849
 
1871
1850
  // src/widgets/generate-widgets.ts
1872
1851
  var import_admin_shared5 = require("@medusajs/admin-shared");
1873
- var import_promises14 = __toESM(require("fs/promises"));
1852
+ var import_promises13 = __toESM(require("fs/promises"));
1874
1853
  var import_outdent12 = __toESM(require("outdent"));
1875
1854
  async function generateWidgets(sources) {
1876
1855
  const files = await getWidgetFilesFromSources(sources);
@@ -1914,7 +1893,7 @@ function getWidgetId(idOverride, file) {
1914
1893
  return `Widget-${generateHash(relative).slice(0, 4)}`;
1915
1894
  }
1916
1895
  async function parseFile6(file, index) {
1917
- const code = await import_promises14.default.readFile(file, "utf-8");
1896
+ const code = await import_promises13.default.readFile(file, "utf-8");
1918
1897
  let ast;
1919
1898
  try {
1920
1899
  ast = (0, import_parser.parse)(code, getParserOptions(file));
@@ -1975,10 +1954,10 @@ function generateWidgetConfigName(index) {
1975
1954
  return `WidgetConfig${index}`;
1976
1955
  }
1977
1956
  function generateImport6(file, index) {
1978
- const path7 = normalizePath(file);
1957
+ const path5 = normalizePath(file);
1979
1958
  return `import ${generateWidgetComponentName(
1980
1959
  index
1981
- )}, { config as ${generateWidgetConfigName(index)} } from "${path7}"`;
1960
+ )}, { config as ${generateWidgetConfigName(index)} } from "${path5}"`;
1982
1961
  }
1983
1962
  function generateWidget(zone, index, widgetId) {
1984
1963
  return {
@@ -1990,11 +1969,11 @@ function generateWidget(zone, index, widgetId) {
1990
1969
  function getWidgetIdOverride(ast) {
1991
1970
  let id = null;
1992
1971
  let found = false;
1993
- const readId = (path7) => {
1972
+ const readId = (path5) => {
1994
1973
  if (found) {
1995
1974
  return;
1996
1975
  }
1997
- const properties = getConfigObjectProperties(path7);
1976
+ const properties = getConfigObjectProperties(path5);
1998
1977
  if (!properties) {
1999
1978
  return;
2000
1979
  }
@@ -2023,12 +2002,12 @@ async function getWidgetZone(ast, file) {
2023
2002
  * not be a named export. Instead we look for a `VariableDeclaration` named
2024
2003
  * `config` and extract the `zone` property from it.
2025
2004
  */
2026
- VariableDeclarator(path7) {
2005
+ VariableDeclarator(path5) {
2027
2006
  if (zoneFound) {
2028
2007
  return;
2029
2008
  }
2030
- if (path7.node.id.type === "Identifier" && path7.node.id.name === "config" && path7.node.init?.type === "CallExpression") {
2031
- const arg = path7.node.init.arguments[0];
2009
+ if (path5.node.id.type === "Identifier" && path5.node.id.name === "config" && path5.node.init?.type === "CallExpression") {
2010
+ const arg = path5.node.init.arguments[0];
2032
2011
  if (arg?.type === "ObjectExpression") {
2033
2012
  const zoneProperty = arg.properties.find(
2034
2013
  (p) => p.type === "ObjectProperty" && p.key.name === "zone"
@@ -2043,11 +2022,11 @@ async function getWidgetZone(ast, file) {
2043
2022
  /**
2044
2023
  * For unbundled files, the `config` will always be a named export.
2045
2024
  */
2046
- ExportNamedDeclaration(path7) {
2025
+ ExportNamedDeclaration(path5) {
2047
2026
  if (zoneFound) {
2048
2027
  return;
2049
2028
  }
2050
- const declaration = path7.node.declaration;
2029
+ const declaration = path5.node.declaration;
2051
2030
  if (declaration?.type === "VariableDeclaration" && declaration.declarations[0]?.type === "VariableDeclarator" && declaration.declarations[0].id.type === "Identifier" && declaration.declarations[0].id.name === "config" && declaration.declarations[0].init?.type === "CallExpression") {
2052
2031
  const arg = declaration.declarations[0].init.arguments[0];
2053
2032
  if (arg?.type === "ObjectExpression") {
@@ -2124,14 +2103,14 @@ async function generateVirtualI18nModule(sources, pluginMode = false) {
2124
2103
 
2125
2104
  // src/virtual-modules/generate-virtual-cell-renderer-module.ts
2126
2105
  var import_outdent15 = __toESM(require("outdent"));
2127
- var import_promises15 = __toESM(require("fs/promises"));
2128
- var import_path4 = __toESM(require("path"));
2106
+ var import_promises14 = __toESM(require("fs/promises"));
2107
+ var import_path3 = __toESM(require("path"));
2129
2108
  async function generateVirtualCellRendererModule(sources, pluginMode = false) {
2130
2109
  const imports = [];
2131
2110
  for (const source of sources) {
2132
- const cellRenderersPath = import_path4.default.join(source, "cell-renderers.tsx");
2111
+ const cellRenderersPath = import_path3.default.join(source, "cell-renderers.tsx");
2133
2112
  try {
2134
- await import_promises15.default.access(cellRenderersPath);
2113
+ await import_promises14.default.access(cellRenderersPath);
2135
2114
  imports.push(`import "${cellRenderersPath}"`);
2136
2115
  } catch {
2137
2116
  }
@@ -2144,32 +2123,6 @@ async function generateVirtualCellRendererModule(sources, pluginMode = false) {
2144
2123
  return generateModule(code);
2145
2124
  }
2146
2125
 
2147
- // src/virtual-modules/generate-virtual-search-entity-module.ts
2148
- var import_outdent16 = __toESM(require("outdent"));
2149
- var import_promises16 = __toESM(require("fs/promises"));
2150
- var import_path5 = __toESM(require("path"));
2151
- var SEARCH_ENTITY_FILES2 = ["search-entities.tsx", "search-entities.ts"];
2152
- async function generateVirtualSearchEntityModule(sources, pluginMode = false) {
2153
- const imports = [];
2154
- for (const source of sources) {
2155
- for (const fileName of SEARCH_ENTITY_FILES2) {
2156
- const searchEntitiesPath = import_path5.default.join(source, fileName);
2157
- try {
2158
- await import_promises16.default.access(searchEntitiesPath);
2159
- imports.push(`import "${searchEntitiesPath}"`);
2160
- break;
2161
- } catch {
2162
- }
2163
- }
2164
- }
2165
- const code = import_outdent16.default`
2166
- ${imports.join("\n")}
2167
-
2168
- ${pluginMode ? `const searchEntityModule = {}` : `export default {}`}
2169
- `;
2170
- return generateModule(code);
2171
- }
2172
-
2173
2126
  // src/vmod.ts
2174
2127
  var import_admin_shared6 = require("@medusajs/admin-shared");
2175
2128
  var RESOLVED_LINK_VIRTUAL_MODULE = `\0${import_admin_shared6.LINK_VIRTUAL_MODULE}`;
@@ -2181,7 +2134,6 @@ var RESOLVED_WIDGET_VIRTUAL_MODULE = `\0${import_admin_shared6.WIDGET_VIRTUAL_MO
2181
2134
  var RESOLVED_I18N_VIRTUAL_MODULE = `\0${import_admin_shared6.I18N_VIRTUAL_MODULE}`;
2182
2135
  var RESOLVED_CELL_RENDERER_VIRTUAL_MODULE = `\0${import_admin_shared6.CELL_RENDERER_VIRTUAL_MODULE}`;
2183
2136
  var RESOLVED_LAYOUT_VIRTUAL_MODULE = `\0${import_admin_shared6.LAYOUT_VIRTUAL_MODULE}`;
2184
- var RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE = `\0${import_admin_shared6.SEARCH_ENTITY_VIRTUAL_MODULE}`;
2185
2137
  var VIRTUAL_MODULES = [
2186
2138
  import_admin_shared6.LINK_VIRTUAL_MODULE,
2187
2139
  import_admin_shared6.FORM_VIRTUAL_MODULE,
@@ -2191,8 +2143,7 @@ var VIRTUAL_MODULES = [
2191
2143
  import_admin_shared6.WIDGET_VIRTUAL_MODULE,
2192
2144
  import_admin_shared6.I18N_VIRTUAL_MODULE,
2193
2145
  import_admin_shared6.CELL_RENDERER_VIRTUAL_MODULE,
2194
- import_admin_shared6.LAYOUT_VIRTUAL_MODULE,
2195
- import_admin_shared6.SEARCH_ENTITY_VIRTUAL_MODULE
2146
+ import_admin_shared6.LAYOUT_VIRTUAL_MODULE
2196
2147
  ];
2197
2148
  var RESOLVED_VIRTUAL_MODULES = [
2198
2149
  RESOLVED_LINK_VIRTUAL_MODULE,
@@ -2203,8 +2154,7 @@ var RESOLVED_VIRTUAL_MODULES = [
2203
2154
  RESOLVED_WIDGET_VIRTUAL_MODULE,
2204
2155
  RESOLVED_I18N_VIRTUAL_MODULE,
2205
2156
  RESOLVED_CELL_RENDERER_VIRTUAL_MODULE,
2206
- RESOLVED_LAYOUT_VIRTUAL_MODULE,
2207
- RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE
2157
+ RESOLVED_LAYOUT_VIRTUAL_MODULE
2208
2158
  ];
2209
2159
  function resolveVirtualId(id) {
2210
2160
  return `\0${id}`;
@@ -2226,8 +2176,7 @@ var resolvedVirtualModuleIds = {
2226
2176
  widget: RESOLVED_WIDGET_VIRTUAL_MODULE,
2227
2177
  i18n: RESOLVED_I18N_VIRTUAL_MODULE,
2228
2178
  cellRenderer: RESOLVED_CELL_RENDERER_VIRTUAL_MODULE,
2229
- layout: RESOLVED_LAYOUT_VIRTUAL_MODULE,
2230
- searchEntity: RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE
2179
+ layout: RESOLVED_LAYOUT_VIRTUAL_MODULE
2231
2180
  };
2232
2181
  var virtualModuleIds = {
2233
2182
  link: import_admin_shared6.LINK_VIRTUAL_MODULE,
@@ -2238,8 +2187,7 @@ var virtualModuleIds = {
2238
2187
  widget: import_admin_shared6.WIDGET_VIRTUAL_MODULE,
2239
2188
  i18n: import_admin_shared6.I18N_VIRTUAL_MODULE,
2240
2189
  cellRenderer: import_admin_shared6.CELL_RENDERER_VIRTUAL_MODULE,
2241
- layout: import_admin_shared6.LAYOUT_VIRTUAL_MODULE,
2242
- searchEntity: import_admin_shared6.SEARCH_ENTITY_VIRTUAL_MODULE
2190
+ layout: import_admin_shared6.LAYOUT_VIRTUAL_MODULE
2243
2191
  };
2244
2192
  var vmod = {
2245
2193
  resolved: resolvedVirtualModuleIds,
@@ -2289,7 +2237,6 @@ var medusaVitePlugin = (options) => {
2289
2237
  const i18nModule = await generateVirtualI18nModule(sources, true);
2290
2238
  const cellRendererModule = await generateVirtualCellRendererModule(sources, true);
2291
2239
  const layoutModule = await generateVirtualLayoutModule(sources, true);
2292
- const searchEntityModule = await generateVirtualSearchEntityModule(sources, true);
2293
2240
  return `
2294
2241
  // Auto-generated index file for Medusa Admin UI extensions
2295
2242
  ${widgetModule.code}
@@ -2300,7 +2247,6 @@ var medusaVitePlugin = (options) => {
2300
2247
  ${i18nModule.code}
2301
2248
  ${cellRendererModule.code}
2302
2249
  ${layoutModule.code}
2303
- ${searchEntityModule.code}
2304
2250
 
2305
2251
  const plugin = {
2306
2252
  widgetModule,
@@ -2310,8 +2256,7 @@ var medusaVitePlugin = (options) => {
2310
2256
  displayModule,
2311
2257
  i18nModule,
2312
2258
  cellRendererModule,
2313
- layoutModule,
2314
- searchEntityModule
2259
+ layoutModule
2315
2260
  }
2316
2261
 
2317
2262
  export default plugin
@@ -2328,7 +2273,7 @@ var medusaVitePlugin = (options) => {
2328
2273
  switch (mode) {
2329
2274
  case "plugin" /* PLUGIN */: {
2330
2275
  const code = await generatePluginEntryModule(_sources);
2331
- await (0, import_promises17.writeFile)(pluginEntryFile, code, "utf-8");
2276
+ await (0, import_promises15.writeFile)(pluginEntryFile, code, "utf-8");
2332
2277
  break;
2333
2278
  }
2334
2279
  case "application" /* APPLICATION */: {
@@ -2340,7 +2285,7 @@ var medusaVitePlugin = (options) => {
2340
2285
  switch (mode) {
2341
2286
  case "plugin" /* PLUGIN */: {
2342
2287
  try {
2343
- await (0, import_promises17.rm)(pluginEntryFile, { force: true });
2288
+ await (0, import_promises15.rm)(pluginEntryFile, { force: true });
2344
2289
  } catch (error) {
2345
2290
  }
2346
2291
  break;
@@ -2432,11 +2377,6 @@ var loadConfigs = {
2432
2377
  hashGenerator: async (sources) => generateLayoutHash(sources),
2433
2378
  moduleGenerator: async (sources) => generateVirtualLayoutModule(sources),
2434
2379
  hashKey: vmod.virtual.layout
2435
- },
2436
- [vmod.resolved.searchEntity]: {
2437
- hashGenerator: async (sources) => generateSearchEntityHash(sources),
2438
- moduleGenerator: async (sources) => generateVirtualSearchEntityModule(sources),
2439
- hashKey: vmod.virtual.searchEntity
2440
2380
  }
2441
2381
  };
2442
2382
  var watcherConfigs = [
@@ -2528,32 +2468,6 @@ var watcherConfigs = [
2528
2468
  hashKey: "layoutConfigHash"
2529
2469
  }
2530
2470
  ]
2531
- },
2532
- {
2533
- subdirectory: "search-entities.tsx",
2534
- hashGenerator: async (sources) => ({
2535
- searchEntityHash: await generateSearchEntityHash(sources)
2536
- }),
2537
- modules: [
2538
- {
2539
- virtualModule: vmod.virtual.searchEntity,
2540
- resolvedModule: vmod.resolved.searchEntity,
2541
- hashKey: "searchEntityHash"
2542
- }
2543
- ]
2544
- },
2545
- {
2546
- subdirectory: "search-entities.ts",
2547
- hashGenerator: async (sources) => ({
2548
- searchEntityHash: await generateSearchEntityHash(sources)
2549
- }),
2550
- modules: [
2551
- {
2552
- virtualModule: vmod.virtual.searchEntity,
2553
- resolvedModule: vmod.resolved.searchEntity,
2554
- hashKey: "searchEntityHash"
2555
- }
2556
- ]
2557
2471
  }
2558
2472
  ];
2559
2473
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/plugin.ts
2
2
  import { rm, writeFile } from "fs/promises";
3
- import path6 from "path";
3
+ import path4 from "path";
4
4
 
5
5
  // src/cell-renderers/generate-cell-renderer-hash.ts
6
6
  import fs from "fs/promises";
@@ -62,12 +62,12 @@ function generateModule(code) {
62
62
  var VALID_FILE_EXTENSIONS = [".tsx", ".jsx", ".js", ".ts"];
63
63
  async function crawl(dir, file, depth) {
64
64
  const dirDepth = dir.split(path.sep).length;
65
- const crawler = new fdir().withBasePath().exclude((dirName) => dirName.startsWith("_")).filter((path7) => {
66
- return VALID_FILE_EXTENSIONS.some((ext) => path7.endsWith(ext));
65
+ const crawler = new fdir().withBasePath().exclude((dirName) => dirName.startsWith("_")).filter((path5) => {
66
+ return VALID_FILE_EXTENSIONS.some((ext) => path5.endsWith(ext));
67
67
  });
68
68
  if (file) {
69
- crawler.filter((path7) => {
70
- return VALID_FILE_EXTENSIONS.some((ext) => path7.endsWith(file + ext));
69
+ crawler.filter((path5) => {
70
+ return VALID_FILE_EXTENSIONS.some((ext) => path5.endsWith(file + ext));
71
71
  });
72
72
  }
73
73
  if (depth) {
@@ -84,15 +84,15 @@ async function crawl(dir, file, depth) {
84
84
  }
85
85
  return crawler.crawl(dir).withPromise();
86
86
  }
87
- function getConfigObjectProperties(path7) {
88
- if (isVariableDeclarator(path7.node)) {
89
- const configDeclaration = isIdentifier(path7.node.id, { name: "config" }) ? path7.node : null;
87
+ function getConfigObjectProperties(path5) {
88
+ if (isVariableDeclarator(path5.node)) {
89
+ const configDeclaration = isIdentifier(path5.node.id, { name: "config" }) ? path5.node : null;
90
90
  if (configDeclaration && isCallExpression(configDeclaration.init) && configDeclaration.init.arguments.length > 0 && isObjectExpression(configDeclaration.init.arguments[0])) {
91
91
  return configDeclaration.init.arguments[0].properties;
92
92
  }
93
93
  return null;
94
94
  }
95
- const declaration = path7.node.declaration;
95
+ const declaration = path5.node.declaration;
96
96
  if (isVariableDeclaration(declaration)) {
97
97
  const configDeclaration = declaration.declarations.find(
98
98
  (d) => isVariableDeclarator(d) && isIdentifier(d.id, { name: "config" })
@@ -109,13 +109,13 @@ async function hasDefaultExport(ast) {
109
109
  ExportDefaultDeclaration() {
110
110
  hasDefaultExport2 = true;
111
111
  },
112
- AssignmentExpression(path7) {
113
- if (path7.node.left.type === "MemberExpression" && path7.node.left.object.type === "Identifier" && path7.node.left.object.name === "exports" && path7.node.left.property.type === "Identifier" && path7.node.left.property.name === "default") {
112
+ AssignmentExpression(path5) {
113
+ if (path5.node.left.type === "MemberExpression" && path5.node.left.object.type === "Identifier" && path5.node.left.object.name === "exports" && path5.node.left.property.type === "Identifier" && path5.node.left.property.name === "default") {
114
114
  hasDefaultExport2 = true;
115
115
  }
116
116
  },
117
- ExportNamedDeclaration(path7) {
118
- const specifiers = path7.node.specifiers;
117
+ ExportNamedDeclaration(path5) {
118
+ const specifiers = path5.node.specifiers;
119
119
  if (specifiers?.some(
120
120
  (s) => s.type === "ExportSpecifier" && s.exported.type === "Identifier" && s.exported.name === "default"
121
121
  )) {
@@ -206,8 +206,8 @@ var logger = {
206
206
  import {
207
207
  isValidCustomFieldModel
208
208
  } from "@medusajs/admin-shared";
209
- function getModel(path7, file) {
210
- const configArgument = getConfigArgument(path7);
209
+ function getModel(path5, file) {
210
+ const configArgument = getConfigArgument(path5);
211
211
  if (!configArgument) {
212
212
  return null;
213
213
  }
@@ -241,23 +241,23 @@ function getModel(path7, file) {
241
241
  }
242
242
  return model;
243
243
  }
244
- function getConfigArgument(path7) {
245
- if (!isCallExpression(path7.node.declaration)) {
244
+ function getConfigArgument(path5) {
245
+ if (!isCallExpression(path5.node.declaration)) {
246
246
  return null;
247
247
  }
248
- if (!isIdentifier(path7.node.declaration.callee, {
248
+ if (!isIdentifier(path5.node.declaration.callee, {
249
249
  name: "unstable_defineCustomFieldsConfig"
250
250
  })) {
251
251
  return null;
252
252
  }
253
- const configArgument = path7.node.declaration.arguments[0];
253
+ const configArgument = path5.node.declaration.arguments[0];
254
254
  if (!isObjectExpression(configArgument)) {
255
255
  return null;
256
256
  }
257
257
  return configArgument;
258
258
  }
259
- function validateLink(path7, file) {
260
- const configArgument = getConfigArgument(path7);
259
+ function validateLink(path5, file) {
260
+ const configArgument = getConfigArgument(path5);
261
261
  if (!configArgument) {
262
262
  return false;
263
263
  }
@@ -347,14 +347,14 @@ async function parseDisplayFile(file, index) {
347
347
  let hasLink = false;
348
348
  try {
349
349
  traverse(ast, {
350
- ExportDefaultDeclaration(path7) {
351
- const _model = getModel(path7, file);
350
+ ExportDefaultDeclaration(path5) {
351
+ const _model = getModel(path5, file);
352
352
  if (!_model) {
353
353
  return;
354
354
  }
355
355
  model = _model;
356
- displays = getDisplays(path7, model, index, file);
357
- hasLink = validateLink(path7, file);
356
+ displays = getDisplays(path5, model, index, file);
357
+ hasLink = validateLink(path5, file);
358
358
  }
359
359
  });
360
360
  } catch (err) {
@@ -378,8 +378,8 @@ async function parseDisplayFile(file, index) {
378
378
  displays
379
379
  };
380
380
  }
381
- function getDisplays(path7, model, index, file) {
382
- const configArgument = getConfigArgument(path7);
381
+ function getDisplays(path5, model, index, file) {
382
+ const configArgument = getConfigArgument(path5);
383
383
  if (!configArgument) {
384
384
  return null;
385
385
  }
@@ -455,8 +455,8 @@ function generateCustomFieldConfigName(index) {
455
455
  return `CustomFieldConfig${index}`;
456
456
  }
457
457
  function generateImport(file, index) {
458
- const path7 = normalizePath(file);
459
- return `import ${generateCustomFieldConfigName(index)} from "${path7}"`;
458
+ const path5 = normalizePath(file);
459
+ return `import ${generateCustomFieldConfigName(index)} from "${path5}"`;
460
460
  }
461
461
 
462
462
  // src/custom-fields/generate-custom-field-forms.ts
@@ -581,15 +581,15 @@ async function parseFile(file, index) {
581
581
  let hasLink = false;
582
582
  try {
583
583
  traverse(ast, {
584
- ExportDefaultDeclaration(path7) {
585
- const _model = getModel(path7, file);
584
+ ExportDefaultDeclaration(path5) {
585
+ const _model = getModel(path5, file);
586
586
  if (!_model) {
587
587
  return;
588
588
  }
589
589
  model = _model;
590
- hasLink = validateLink(path7, file);
591
- configs = getConfigs(path7, model, index, file);
592
- forms = getForms(path7, model, index, file);
590
+ hasLink = validateLink(path5, file);
591
+ configs = getConfigs(path5, model, index, file);
592
+ forms = getForms(path5, model, index, file);
593
593
  }
594
594
  });
595
595
  } catch (err) {
@@ -618,11 +618,11 @@ function generateCustomFieldConfigName2(index) {
618
618
  return `CustomFieldConfig${index}`;
619
619
  }
620
620
  function generateImport2(file, index) {
621
- const path7 = normalizePath(file);
622
- return `import ${generateCustomFieldConfigName2(index)} from "${path7}"`;
621
+ const path5 = normalizePath(file);
622
+ return `import ${generateCustomFieldConfigName2(index)} from "${path5}"`;
623
623
  }
624
- function getForms(path7, model, index, file) {
625
- const formArray = getFormsArgument(path7, file);
624
+ function getForms(path5, model, index, file) {
625
+ const formArray = getFormsArgument(path5, file);
626
626
  if (!formArray) {
627
627
  return null;
628
628
  }
@@ -786,8 +786,8 @@ function getFormFieldSectionValue(exists, fileIndex, formIndex, fieldKey, value)
786
786
  function getFormEntryFieldPath(model, zone, tab) {
787
787
  return `${model}.${zone}.${tab ? `${tab}.` : ""}$field`;
788
788
  }
789
- function getConfigs(path7, model, index, file) {
790
- const formArray = getFormsArgument(path7, file);
789
+ function getConfigs(path5, model, index, file) {
790
+ const formArray = getFormsArgument(path5, file);
791
791
  if (!formArray) {
792
792
  logger.warn(`'forms' property is missing.`, { file });
793
793
  return null;
@@ -906,8 +906,8 @@ function getFormFieldValue(fileIndex, formIndex, fieldKey, value) {
906
906
  function getFormEntryConfigPath(model, zone) {
907
907
  return `${model}.${zone}.$config`;
908
908
  }
909
- function getFormsArgument(path7, file) {
910
- const configArgument = getConfigArgument(path7);
909
+ function getFormsArgument(path5, file) {
910
+ const configArgument = getConfigArgument(path5);
911
911
  if (!configArgument) {
912
912
  return null;
913
913
  }
@@ -968,8 +968,8 @@ async function getCustomFieldContents(file) {
968
968
  let displayContent = null;
969
969
  try {
970
970
  traverse(ast, {
971
- ExportDefaultDeclaration(path7) {
972
- const configArgument = getConfigArgument(path7);
971
+ ExportDefaultDeclaration(path5) {
972
+ const configArgument = getConfigArgument(path5);
973
973
  if (!configArgument) {
974
974
  return;
975
975
  }
@@ -1063,13 +1063,13 @@ async function parseFile2(file, index) {
1063
1063
  let model = null;
1064
1064
  try {
1065
1065
  traverse(ast, {
1066
- ExportDefaultDeclaration(path7) {
1067
- const _model = getModel(path7, file);
1066
+ ExportDefaultDeclaration(path5) {
1067
+ const _model = getModel(path5, file);
1068
1068
  if (!_model) {
1069
1069
  return;
1070
1070
  }
1071
1071
  model = _model;
1072
- link = getLink(path7, index, file);
1072
+ link = getLink(path5, index, file);
1073
1073
  }
1074
1074
  });
1075
1075
  } catch (err) {
@@ -1092,11 +1092,11 @@ function generateCustomFieldConfigName3(index) {
1092
1092
  return `CustomFieldConfig${index}`;
1093
1093
  }
1094
1094
  function generateImport3(file, index) {
1095
- const path7 = normalizePath(file);
1096
- return `import ${generateCustomFieldConfigName3(index)} from "${path7}"`;
1095
+ const path5 = normalizePath(file);
1096
+ return `import ${generateCustomFieldConfigName3(index)} from "${path5}"`;
1097
1097
  }
1098
- function getLink(path7, index, file) {
1099
- const configArgument = getConfigArgument(path7);
1098
+ function getLink(path5, index, file) {
1099
+ const configArgument = getConfigArgument(path5);
1100
1100
  if (!configArgument) {
1101
1101
  return null;
1102
1102
  }
@@ -1235,11 +1235,11 @@ async function parseFile3(file, index) {
1235
1235
  function hasConfigExport(ast) {
1236
1236
  let found = false;
1237
1237
  traverse(ast, {
1238
- ExportNamedDeclaration(path7) {
1238
+ ExportNamedDeclaration(path5) {
1239
1239
  if (found) {
1240
1240
  return;
1241
1241
  }
1242
- if (getConfigObjectProperties(path7)) {
1242
+ if (getConfigObjectProperties(path5)) {
1243
1243
  found = true;
1244
1244
  }
1245
1245
  }
@@ -1247,8 +1247,8 @@ function hasConfigExport(ast) {
1247
1247
  return found;
1248
1248
  }
1249
1249
  function generateImport4(file, componentName, configName) {
1250
- const path7 = normalizePath(file);
1251
- return `import ${componentName}, { config as ${configName} } from "${path7}"`;
1250
+ const path5 = normalizePath(file);
1251
+ return `import ${componentName}, { config as ${configName} } from "${path5}"`;
1252
1252
  }
1253
1253
 
1254
1254
  // src/layouts/generate-layout-hash.ts
@@ -1298,11 +1298,11 @@ function generateCode4(results) {
1298
1298
  `;
1299
1299
  }
1300
1300
  function formatMenuItem(route) {
1301
- const { label, icon, path: path7, nested, rank, translationNs } = route;
1301
+ const { label, icon, path: path5, nested, rank, translationNs } = route;
1302
1302
  return `{
1303
1303
  label: ${label},
1304
1304
  icon: ${icon || "undefined"},
1305
- path: "${path7}",
1305
+ path: "${path5}",
1306
1306
  nested: ${nested ? `"${nested}"` : "undefined"},
1307
1307
  rank: ${rank !== void 0 ? rank : "undefined"},
1308
1308
  translationNs: ${translationNs ? `${translationNs}` : "undefined"}
@@ -1338,8 +1338,8 @@ async function parseFile4(file, index) {
1338
1338
  };
1339
1339
  }
1340
1340
  function generateImport5(file, index) {
1341
- const path7 = normalizePath(file);
1342
- return `import { config as ${generateRouteConfigName(index)} } from "${path7}"`;
1341
+ const path5 = normalizePath(file);
1342
+ return `import { config as ${generateRouteConfigName(index)} } from "${path5}"`;
1343
1343
  }
1344
1344
  function generateMenuItem(config, file, index) {
1345
1345
  const configName = generateRouteConfigName(index);
@@ -1372,11 +1372,11 @@ async function getRouteConfig(file) {
1372
1372
  * For bundled files, the config will not be a named export,
1373
1373
  * but instead a variable declaration.
1374
1374
  */
1375
- VariableDeclarator(path7) {
1375
+ VariableDeclarator(path5) {
1376
1376
  if (configFound) {
1377
1377
  return;
1378
1378
  }
1379
- const properties = getConfigObjectProperties(path7);
1379
+ const properties = getConfigObjectProperties(path5);
1380
1380
  if (!properties) {
1381
1381
  return;
1382
1382
  }
@@ -1388,11 +1388,11 @@ async function getRouteConfig(file) {
1388
1388
  /**
1389
1389
  * For unbundled files, the `config` will always be a named export.
1390
1390
  */
1391
- ExportNamedDeclaration(path7) {
1391
+ ExportNamedDeclaration(path5) {
1392
1392
  if (configFound) {
1393
1393
  return;
1394
1394
  }
1395
- const properties = getConfigObjectProperties(path7);
1395
+ const properties = getConfigObjectProperties(path5);
1396
1396
  if (!properties) {
1397
1397
  return;
1398
1398
  }
@@ -1497,13 +1497,13 @@ async function getRouteContents(file) {
1497
1497
  let configContent = null;
1498
1498
  try {
1499
1499
  traverse(ast, {
1500
- ExportDefaultDeclaration(path7) {
1501
- defaultExportContent = code.slice(path7.node.start, path7.node.end);
1500
+ ExportDefaultDeclaration(path5) {
1501
+ defaultExportContent = code.slice(path5.node.start, path5.node.end);
1502
1502
  },
1503
- ExportNamedDeclaration(path7) {
1504
- const properties = getConfigObjectProperties(path7);
1503
+ ExportNamedDeclaration(path5) {
1504
+ const properties = getConfigObjectProperties(path5);
1505
1505
  if (properties) {
1506
- configContent = code.slice(path7.node.start, path7.node.end);
1506
+ configContent = code.slice(path5.node.start, path5.node.end);
1507
1507
  }
1508
1508
  }
1509
1509
  });
@@ -1683,8 +1683,8 @@ async function hasNamedExports(ast, file) {
1683
1683
  let hasConfig = false;
1684
1684
  try {
1685
1685
  traverse(ast, {
1686
- ExportNamedDeclaration(path7) {
1687
- const declaration = path7.node.declaration;
1686
+ ExportNamedDeclaration(path5) {
1687
+ const declaration = path5.node.declaration;
1688
1688
  if (declaration?.type === "VariableDeclaration") {
1689
1689
  declaration.declarations.forEach((decl) => {
1690
1690
  if (decl.id.type === "Identifier" && decl.id.name === "handle") {
@@ -1712,27 +1712,6 @@ async function hasNamedExports(ast, file) {
1712
1712
  return { hasHandle, hasLoader, hasConfig };
1713
1713
  }
1714
1714
 
1715
- // src/search-entities/generate-search-entity-hash.ts
1716
- import fs12 from "fs/promises";
1717
- import path3 from "path";
1718
- var SEARCH_ENTITY_FILES = ["search-entities.tsx", "search-entities.ts"];
1719
- async function generateSearchEntityHash(sources) {
1720
- const contents = [];
1721
- for (const source of sources) {
1722
- for (const fileName of SEARCH_ENTITY_FILES) {
1723
- const searchEntitiesPath = path3.join(source, fileName);
1724
- try {
1725
- const content = await fs12.readFile(searchEntitiesPath, "utf-8");
1726
- contents.push(content);
1727
- break;
1728
- } catch {
1729
- }
1730
- }
1731
- }
1732
- const totalContent = contents.join("");
1733
- return generateHash(totalContent);
1734
- }
1735
-
1736
1715
  // src/virtual-modules/generate-virtual-display-module.ts
1737
1716
  import { outdent as outdent6 } from "outdent";
1738
1717
  async function generateVirtualDisplayModule(sources, pluginMode = false) {
@@ -1812,7 +1791,7 @@ async function generateVirtualRouteModule(sources, pluginMode = false) {
1812
1791
  import outdent13 from "outdent";
1813
1792
 
1814
1793
  // src/widgets/generate-widget-hash.ts
1815
- import fs13 from "fs/promises";
1794
+ import fs12 from "fs/promises";
1816
1795
 
1817
1796
  // src/widgets/helpers.ts
1818
1797
  async function getWidgetFilesFromSources(sources) {
@@ -1829,7 +1808,7 @@ async function generateWidgetHash(sources) {
1829
1808
  return generateHash(totalContent);
1830
1809
  }
1831
1810
  async function getWidgetContents(file) {
1832
- const code = await fs13.readFile(file, "utf-8");
1811
+ const code = await fs12.readFile(file, "utf-8");
1833
1812
  let ast;
1834
1813
  try {
1835
1814
  ast = parse(code, getParserOptions(file));
@@ -1846,14 +1825,14 @@ async function getWidgetContents(file) {
1846
1825
  let configContent = null;
1847
1826
  let defaultExportContent = null;
1848
1827
  traverse(ast, {
1849
- ExportNamedDeclaration(path7) {
1850
- const properties = getConfigObjectProperties(path7);
1828
+ ExportNamedDeclaration(path5) {
1829
+ const properties = getConfigObjectProperties(path5);
1851
1830
  if (properties) {
1852
- configContent = code.slice(path7.node.start, path7.node.end);
1831
+ configContent = code.slice(path5.node.start, path5.node.end);
1853
1832
  }
1854
1833
  },
1855
- ExportDefaultDeclaration(path7) {
1856
- defaultExportContent = code.slice(path7.node.start, path7.node.end);
1834
+ ExportDefaultDeclaration(path5) {
1835
+ defaultExportContent = code.slice(path5.node.start, path5.node.end);
1857
1836
  }
1858
1837
  });
1859
1838
  return { config: configContent, defaultExport: defaultExportContent };
@@ -1861,7 +1840,7 @@ async function getWidgetContents(file) {
1861
1840
 
1862
1841
  // src/widgets/generate-widgets.ts
1863
1842
  import { isValidInjectionZone } from "@medusajs/admin-shared";
1864
- import fs14 from "fs/promises";
1843
+ import fs13 from "fs/promises";
1865
1844
  import outdent12 from "outdent";
1866
1845
  async function generateWidgets(sources) {
1867
1846
  const files = await getWidgetFilesFromSources(sources);
@@ -1905,7 +1884,7 @@ function getWidgetId(idOverride, file) {
1905
1884
  return `Widget-${generateHash(relative).slice(0, 4)}`;
1906
1885
  }
1907
1886
  async function parseFile6(file, index) {
1908
- const code = await fs14.readFile(file, "utf-8");
1887
+ const code = await fs13.readFile(file, "utf-8");
1909
1888
  let ast;
1910
1889
  try {
1911
1890
  ast = parse(code, getParserOptions(file));
@@ -1966,10 +1945,10 @@ function generateWidgetConfigName(index) {
1966
1945
  return `WidgetConfig${index}`;
1967
1946
  }
1968
1947
  function generateImport6(file, index) {
1969
- const path7 = normalizePath(file);
1948
+ const path5 = normalizePath(file);
1970
1949
  return `import ${generateWidgetComponentName(
1971
1950
  index
1972
- )}, { config as ${generateWidgetConfigName(index)} } from "${path7}"`;
1951
+ )}, { config as ${generateWidgetConfigName(index)} } from "${path5}"`;
1973
1952
  }
1974
1953
  function generateWidget(zone, index, widgetId) {
1975
1954
  return {
@@ -1981,11 +1960,11 @@ function generateWidget(zone, index, widgetId) {
1981
1960
  function getWidgetIdOverride(ast) {
1982
1961
  let id = null;
1983
1962
  let found = false;
1984
- const readId = (path7) => {
1963
+ const readId = (path5) => {
1985
1964
  if (found) {
1986
1965
  return;
1987
1966
  }
1988
- const properties = getConfigObjectProperties(path7);
1967
+ const properties = getConfigObjectProperties(path5);
1989
1968
  if (!properties) {
1990
1969
  return;
1991
1970
  }
@@ -2014,12 +1993,12 @@ async function getWidgetZone(ast, file) {
2014
1993
  * not be a named export. Instead we look for a `VariableDeclaration` named
2015
1994
  * `config` and extract the `zone` property from it.
2016
1995
  */
2017
- VariableDeclarator(path7) {
1996
+ VariableDeclarator(path5) {
2018
1997
  if (zoneFound) {
2019
1998
  return;
2020
1999
  }
2021
- if (path7.node.id.type === "Identifier" && path7.node.id.name === "config" && path7.node.init?.type === "CallExpression") {
2022
- const arg = path7.node.init.arguments[0];
2000
+ if (path5.node.id.type === "Identifier" && path5.node.id.name === "config" && path5.node.init?.type === "CallExpression") {
2001
+ const arg = path5.node.init.arguments[0];
2023
2002
  if (arg?.type === "ObjectExpression") {
2024
2003
  const zoneProperty = arg.properties.find(
2025
2004
  (p) => p.type === "ObjectProperty" && p.key.name === "zone"
@@ -2034,11 +2013,11 @@ async function getWidgetZone(ast, file) {
2034
2013
  /**
2035
2014
  * For unbundled files, the `config` will always be a named export.
2036
2015
  */
2037
- ExportNamedDeclaration(path7) {
2016
+ ExportNamedDeclaration(path5) {
2038
2017
  if (zoneFound) {
2039
2018
  return;
2040
2019
  }
2041
- const declaration = path7.node.declaration;
2020
+ const declaration = path5.node.declaration;
2042
2021
  if (declaration?.type === "VariableDeclaration" && declaration.declarations[0]?.type === "VariableDeclarator" && declaration.declarations[0].id.type === "Identifier" && declaration.declarations[0].id.name === "config" && declaration.declarations[0].init?.type === "CallExpression") {
2043
2022
  const arg = declaration.declarations[0].init.arguments[0];
2044
2023
  if (arg?.type === "ObjectExpression") {
@@ -2115,14 +2094,14 @@ async function generateVirtualI18nModule(sources, pluginMode = false) {
2115
2094
 
2116
2095
  // src/virtual-modules/generate-virtual-cell-renderer-module.ts
2117
2096
  import outdent15 from "outdent";
2118
- import fs15 from "fs/promises";
2119
- import path4 from "path";
2097
+ import fs14 from "fs/promises";
2098
+ import path3 from "path";
2120
2099
  async function generateVirtualCellRendererModule(sources, pluginMode = false) {
2121
2100
  const imports = [];
2122
2101
  for (const source of sources) {
2123
- const cellRenderersPath = path4.join(source, "cell-renderers.tsx");
2102
+ const cellRenderersPath = path3.join(source, "cell-renderers.tsx");
2124
2103
  try {
2125
- await fs15.access(cellRenderersPath);
2104
+ await fs14.access(cellRenderersPath);
2126
2105
  imports.push(`import "${cellRenderersPath}"`);
2127
2106
  } catch {
2128
2107
  }
@@ -2135,32 +2114,6 @@ async function generateVirtualCellRendererModule(sources, pluginMode = false) {
2135
2114
  return generateModule(code);
2136
2115
  }
2137
2116
 
2138
- // src/virtual-modules/generate-virtual-search-entity-module.ts
2139
- import outdent16 from "outdent";
2140
- import fs16 from "fs/promises";
2141
- import path5 from "path";
2142
- var SEARCH_ENTITY_FILES2 = ["search-entities.tsx", "search-entities.ts"];
2143
- async function generateVirtualSearchEntityModule(sources, pluginMode = false) {
2144
- const imports = [];
2145
- for (const source of sources) {
2146
- for (const fileName of SEARCH_ENTITY_FILES2) {
2147
- const searchEntitiesPath = path5.join(source, fileName);
2148
- try {
2149
- await fs16.access(searchEntitiesPath);
2150
- imports.push(`import "${searchEntitiesPath}"`);
2151
- break;
2152
- } catch {
2153
- }
2154
- }
2155
- }
2156
- const code = outdent16`
2157
- ${imports.join("\n")}
2158
-
2159
- ${pluginMode ? `const searchEntityModule = {}` : `export default {}`}
2160
- `;
2161
- return generateModule(code);
2162
- }
2163
-
2164
2117
  // src/vmod.ts
2165
2118
  import {
2166
2119
  CELL_RENDERER_VIRTUAL_MODULE,
@@ -2171,7 +2124,6 @@ import {
2171
2124
  LINK_VIRTUAL_MODULE,
2172
2125
  MENU_ITEM_VIRTUAL_MODULE,
2173
2126
  ROUTE_VIRTUAL_MODULE,
2174
- SEARCH_ENTITY_VIRTUAL_MODULE,
2175
2127
  WIDGET_VIRTUAL_MODULE
2176
2128
  } from "@medusajs/admin-shared";
2177
2129
  var RESOLVED_LINK_VIRTUAL_MODULE = `\0${LINK_VIRTUAL_MODULE}`;
@@ -2183,7 +2135,6 @@ var RESOLVED_WIDGET_VIRTUAL_MODULE = `\0${WIDGET_VIRTUAL_MODULE}`;
2183
2135
  var RESOLVED_I18N_VIRTUAL_MODULE = `\0${I18N_VIRTUAL_MODULE}`;
2184
2136
  var RESOLVED_CELL_RENDERER_VIRTUAL_MODULE = `\0${CELL_RENDERER_VIRTUAL_MODULE}`;
2185
2137
  var RESOLVED_LAYOUT_VIRTUAL_MODULE = `\0${LAYOUT_VIRTUAL_MODULE}`;
2186
- var RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE = `\0${SEARCH_ENTITY_VIRTUAL_MODULE}`;
2187
2138
  var VIRTUAL_MODULES = [
2188
2139
  LINK_VIRTUAL_MODULE,
2189
2140
  FORM_VIRTUAL_MODULE,
@@ -2193,8 +2144,7 @@ var VIRTUAL_MODULES = [
2193
2144
  WIDGET_VIRTUAL_MODULE,
2194
2145
  I18N_VIRTUAL_MODULE,
2195
2146
  CELL_RENDERER_VIRTUAL_MODULE,
2196
- LAYOUT_VIRTUAL_MODULE,
2197
- SEARCH_ENTITY_VIRTUAL_MODULE
2147
+ LAYOUT_VIRTUAL_MODULE
2198
2148
  ];
2199
2149
  var RESOLVED_VIRTUAL_MODULES = [
2200
2150
  RESOLVED_LINK_VIRTUAL_MODULE,
@@ -2205,8 +2155,7 @@ var RESOLVED_VIRTUAL_MODULES = [
2205
2155
  RESOLVED_WIDGET_VIRTUAL_MODULE,
2206
2156
  RESOLVED_I18N_VIRTUAL_MODULE,
2207
2157
  RESOLVED_CELL_RENDERER_VIRTUAL_MODULE,
2208
- RESOLVED_LAYOUT_VIRTUAL_MODULE,
2209
- RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE
2158
+ RESOLVED_LAYOUT_VIRTUAL_MODULE
2210
2159
  ];
2211
2160
  function resolveVirtualId(id) {
2212
2161
  return `\0${id}`;
@@ -2228,8 +2177,7 @@ var resolvedVirtualModuleIds = {
2228
2177
  widget: RESOLVED_WIDGET_VIRTUAL_MODULE,
2229
2178
  i18n: RESOLVED_I18N_VIRTUAL_MODULE,
2230
2179
  cellRenderer: RESOLVED_CELL_RENDERER_VIRTUAL_MODULE,
2231
- layout: RESOLVED_LAYOUT_VIRTUAL_MODULE,
2232
- searchEntity: RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE
2180
+ layout: RESOLVED_LAYOUT_VIRTUAL_MODULE
2233
2181
  };
2234
2182
  var virtualModuleIds = {
2235
2183
  link: LINK_VIRTUAL_MODULE,
@@ -2240,8 +2188,7 @@ var virtualModuleIds = {
2240
2188
  widget: WIDGET_VIRTUAL_MODULE,
2241
2189
  i18n: I18N_VIRTUAL_MODULE,
2242
2190
  cellRenderer: CELL_RENDERER_VIRTUAL_MODULE,
2243
- layout: LAYOUT_VIRTUAL_MODULE,
2244
- searchEntity: SEARCH_ENTITY_VIRTUAL_MODULE
2191
+ layout: LAYOUT_VIRTUAL_MODULE
2245
2192
  };
2246
2193
  var vmod = {
2247
2194
  resolved: resolvedVirtualModuleIds,
@@ -2256,7 +2203,7 @@ var medusaVitePlugin = (options) => {
2256
2203
  let watcher;
2257
2204
  function isFileInSources(file) {
2258
2205
  for (const source of _sources) {
2259
- if (file.startsWith(path6.resolve(source))) {
2206
+ if (file.startsWith(path4.resolve(source))) {
2260
2207
  return true;
2261
2208
  }
2262
2209
  }
@@ -2291,7 +2238,6 @@ var medusaVitePlugin = (options) => {
2291
2238
  const i18nModule = await generateVirtualI18nModule(sources, true);
2292
2239
  const cellRendererModule = await generateVirtualCellRendererModule(sources, true);
2293
2240
  const layoutModule = await generateVirtualLayoutModule(sources, true);
2294
- const searchEntityModule = await generateVirtualSearchEntityModule(sources, true);
2295
2241
  return `
2296
2242
  // Auto-generated index file for Medusa Admin UI extensions
2297
2243
  ${widgetModule.code}
@@ -2302,7 +2248,6 @@ var medusaVitePlugin = (options) => {
2302
2248
  ${i18nModule.code}
2303
2249
  ${cellRendererModule.code}
2304
2250
  ${layoutModule.code}
2305
- ${searchEntityModule.code}
2306
2251
 
2307
2252
  const plugin = {
2308
2253
  widgetModule,
@@ -2312,14 +2257,13 @@ var medusaVitePlugin = (options) => {
2312
2257
  displayModule,
2313
2258
  i18nModule,
2314
2259
  cellRendererModule,
2315
- layoutModule,
2316
- searchEntityModule
2260
+ layoutModule
2317
2261
  }
2318
2262
 
2319
2263
  export default plugin
2320
2264
  `;
2321
2265
  }
2322
- const pluginEntryFile = path6.resolve(
2266
+ const pluginEntryFile = path4.resolve(
2323
2267
  process.cwd(),
2324
2268
  "src/admin/__admin-extensions__.js"
2325
2269
  );
@@ -2434,11 +2378,6 @@ var loadConfigs = {
2434
2378
  hashGenerator: async (sources) => generateLayoutHash(sources),
2435
2379
  moduleGenerator: async (sources) => generateVirtualLayoutModule(sources),
2436
2380
  hashKey: vmod.virtual.layout
2437
- },
2438
- [vmod.resolved.searchEntity]: {
2439
- hashGenerator: async (sources) => generateSearchEntityHash(sources),
2440
- moduleGenerator: async (sources) => generateVirtualSearchEntityModule(sources),
2441
- hashKey: vmod.virtual.searchEntity
2442
2381
  }
2443
2382
  };
2444
2383
  var watcherConfigs = [
@@ -2530,32 +2469,6 @@ var watcherConfigs = [
2530
2469
  hashKey: "layoutConfigHash"
2531
2470
  }
2532
2471
  ]
2533
- },
2534
- {
2535
- subdirectory: "search-entities.tsx",
2536
- hashGenerator: async (sources) => ({
2537
- searchEntityHash: await generateSearchEntityHash(sources)
2538
- }),
2539
- modules: [
2540
- {
2541
- virtualModule: vmod.virtual.searchEntity,
2542
- resolvedModule: vmod.resolved.searchEntity,
2543
- hashKey: "searchEntityHash"
2544
- }
2545
- ]
2546
- },
2547
- {
2548
- subdirectory: "search-entities.ts",
2549
- hashGenerator: async (sources) => ({
2550
- searchEntityHash: await generateSearchEntityHash(sources)
2551
- }),
2552
- modules: [
2553
- {
2554
- virtualModule: vmod.virtual.searchEntity,
2555
- resolvedModule: vmod.resolved.searchEntity,
2556
- hashKey: "searchEntityHash"
2557
- }
2558
- ]
2559
2472
  }
2560
2473
  ];
2561
2474
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/admin-vite-plugin",
3
- "version": "2.19.0-snapshot-20260812155528",
3
+ "version": "2.19.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "@babel/parser": "7.25.6",
40
40
  "@babel/traverse": "7.25.6",
41
41
  "@babel/types": "7.25.6",
42
- "@medusajs/admin-shared": "2.19.0-snapshot-20260812155528",
42
+ "@medusajs/admin-shared": "2.19.0",
43
43
  "fdir": "6.1.1",
44
44
  "magic-string": "0.30.5",
45
45
  "outdent": "^0.8.0",