@medusajs/admin-vite-plugin 2.19.0-snapshot-20260813102506 → 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 +100 -184
  2. package/dist/index.mjs +100 -185
  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((path6) => {
87
- return VALID_FILE_EXTENSIONS.some((ext) => path6.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((path6) => {
91
- return VALID_FILE_EXTENSIONS.some((ext) => path6.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(path6) {
109
- if ((0, import_types.isVariableDeclarator)(path6.node)) {
110
- const configDeclaration = (0, import_types.isIdentifier)(path6.node.id, { name: "config" }) ? path6.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 = path6.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(path6) {
134
- if (path6.node.left.type === "MemberExpression" && path6.node.left.object.type === "Identifier" && path6.node.left.object.name === "exports" && path6.node.left.property.type === "Identifier" && path6.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(path6) {
139
- const specifiers = path6.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(path6, file) {
226
- const configArgument = getConfigArgument(path6);
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(path6, file) {
257
257
  }
258
258
  return model;
259
259
  }
260
- function getConfigArgument(path6) {
261
- if (!(0, import_types.isCallExpression)(path6.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)(path6.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 = path6.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(path6, file) {
276
- const configArgument = getConfigArgument(path6);
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(path6) {
367
- const _model = getModel(path6, 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(path6, model, index, file);
373
- hasLink = validateLink(path6, 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(path6, model, index, file) {
398
- const configArgument = getConfigArgument(path6);
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 path6 = normalizePath(file);
475
- return `import ${generateCustomFieldConfigName(index)} from "${path6}"`;
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(path6) {
596
- const _model = getModel(path6, 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(path6, file);
602
- configs = getConfigs(path6, model, index, file);
603
- forms = getForms(path6, 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 path6 = normalizePath(file);
633
- return `import ${generateCustomFieldConfigName2(index)} from "${path6}"`;
632
+ const path5 = normalizePath(file);
633
+ return `import ${generateCustomFieldConfigName2(index)} from "${path5}"`;
634
634
  }
635
- function getForms(path6, model, index, file) {
636
- const formArray = getFormsArgument(path6, 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(path6, model, index, file) {
801
- const formArray = getFormsArgument(path6, 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(path6, file) {
921
- const configArgument = getConfigArgument(path6);
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(path6) {
983
- const configArgument = getConfigArgument(path6);
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(path6) {
1078
- const _model = getModel(path6, 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(path6, 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 path6 = normalizePath(file);
1107
- return `import ${generateCustomFieldConfigName3(index)} from "${path6}"`;
1106
+ const path5 = normalizePath(file);
1107
+ return `import ${generateCustomFieldConfigName3(index)} from "${path5}"`;
1108
1108
  }
1109
- function getLink(path6, index, file) {
1110
- const configArgument = getConfigArgument(path6);
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(path6) {
1249
+ ExportNamedDeclaration(path5) {
1250
1250
  if (found) {
1251
1251
  return;
1252
1252
  }
1253
- if (getConfigObjectProperties(path6)) {
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 path6 = normalizePath(file);
1262
- return `import ${componentName}, { config as ${configName} } from "${path6}"`;
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: path6, 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: "${path6}",
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 path6 = normalizePath(file);
1351
- return `import { config as ${generateRouteConfigName(index)} } from "${path6}"`;
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(path6) {
1384
+ VariableDeclarator(path5) {
1385
1385
  if (configFound) {
1386
1386
  return;
1387
1387
  }
1388
- const properties = getConfigObjectProperties(path6);
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(path6) {
1400
+ ExportNamedDeclaration(path5) {
1401
1401
  if (configFound) {
1402
1402
  return;
1403
1403
  }
1404
- const properties = getConfigObjectProperties(path6);
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(path6) {
1510
- defaultExportContent = code.slice(path6.node.start, path6.node.end);
1509
+ ExportDefaultDeclaration(path5) {
1510
+ defaultExportContent = code.slice(path5.node.start, path5.node.end);
1511
1511
  },
1512
- ExportNamedDeclaration(path6) {
1513
- const properties = getConfigObjectProperties(path6);
1512
+ ExportNamedDeclaration(path5) {
1513
+ const properties = getConfigObjectProperties(path5);
1514
1514
  if (properties) {
1515
- configContent = code.slice(path6.node.start, path6.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(path6) {
1696
- const declaration = path6.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,44 +1721,6 @@ async function hasNamedExports(ast, file) {
1721
1721
  return { hasHandle, hasLoader, hasConfig };
1722
1722
  }
1723
1723
 
1724
- // src/search-entities/constants.ts
1725
- var SEARCH_ENTITY_FILES = [
1726
- "search-entities.tsx",
1727
- "search-entities.ts"
1728
- ];
1729
-
1730
- // src/search-entities/find-search-entity-file.ts
1731
- var import_promises12 = __toESM(require("fs/promises"));
1732
- var import_path3 = __toESM(require("path"));
1733
- async function findSearchEntityFile(source) {
1734
- for (const fileName of SEARCH_ENTITY_FILES) {
1735
- const filePath = import_path3.default.join(source, fileName);
1736
- try {
1737
- await import_promises12.default.access(filePath);
1738
- return filePath;
1739
- } catch {
1740
- }
1741
- }
1742
- return null;
1743
- }
1744
-
1745
- // src/search-entities/generate-search-entity-hash.ts
1746
- var import_promises13 = __toESM(require("fs/promises"));
1747
- async function generateSearchEntityHash(sources) {
1748
- const contents = [];
1749
- for (const source of sources) {
1750
- const searchEntitiesPath = await findSearchEntityFile(source);
1751
- if (!searchEntitiesPath) {
1752
- continue;
1753
- }
1754
- try {
1755
- contents.push(await import_promises13.default.readFile(searchEntitiesPath, "utf-8"));
1756
- } catch {
1757
- }
1758
- }
1759
- return generateHash(contents.join(""));
1760
- }
1761
-
1762
1724
  // src/virtual-modules/generate-virtual-display-module.ts
1763
1725
  var import_outdent6 = require("outdent");
1764
1726
  async function generateVirtualDisplayModule(sources, pluginMode = false) {
@@ -1838,7 +1800,7 @@ async function generateVirtualRouteModule(sources, pluginMode = false) {
1838
1800
  var import_outdent13 = __toESM(require("outdent"));
1839
1801
 
1840
1802
  // src/widgets/generate-widget-hash.ts
1841
- var import_promises14 = __toESM(require("fs/promises"));
1803
+ var import_promises12 = __toESM(require("fs/promises"));
1842
1804
 
1843
1805
  // src/widgets/helpers.ts
1844
1806
  async function getWidgetFilesFromSources(sources) {
@@ -1855,7 +1817,7 @@ async function generateWidgetHash(sources) {
1855
1817
  return generateHash(totalContent);
1856
1818
  }
1857
1819
  async function getWidgetContents(file) {
1858
- const code = await import_promises14.default.readFile(file, "utf-8");
1820
+ const code = await import_promises12.default.readFile(file, "utf-8");
1859
1821
  let ast;
1860
1822
  try {
1861
1823
  ast = (0, import_parser.parse)(code, getParserOptions(file));
@@ -1872,14 +1834,14 @@ async function getWidgetContents(file) {
1872
1834
  let configContent = null;
1873
1835
  let defaultExportContent = null;
1874
1836
  traverse(ast, {
1875
- ExportNamedDeclaration(path6) {
1876
- const properties = getConfigObjectProperties(path6);
1837
+ ExportNamedDeclaration(path5) {
1838
+ const properties = getConfigObjectProperties(path5);
1877
1839
  if (properties) {
1878
- configContent = code.slice(path6.node.start, path6.node.end);
1840
+ configContent = code.slice(path5.node.start, path5.node.end);
1879
1841
  }
1880
1842
  },
1881
- ExportDefaultDeclaration(path6) {
1882
- defaultExportContent = code.slice(path6.node.start, path6.node.end);
1843
+ ExportDefaultDeclaration(path5) {
1844
+ defaultExportContent = code.slice(path5.node.start, path5.node.end);
1883
1845
  }
1884
1846
  });
1885
1847
  return { config: configContent, defaultExport: defaultExportContent };
@@ -1887,7 +1849,7 @@ async function getWidgetContents(file) {
1887
1849
 
1888
1850
  // src/widgets/generate-widgets.ts
1889
1851
  var import_admin_shared5 = require("@medusajs/admin-shared");
1890
- var import_promises15 = __toESM(require("fs/promises"));
1852
+ var import_promises13 = __toESM(require("fs/promises"));
1891
1853
  var import_outdent12 = __toESM(require("outdent"));
1892
1854
  async function generateWidgets(sources) {
1893
1855
  const files = await getWidgetFilesFromSources(sources);
@@ -1931,7 +1893,7 @@ function getWidgetId(idOverride, file) {
1931
1893
  return `Widget-${generateHash(relative).slice(0, 4)}`;
1932
1894
  }
1933
1895
  async function parseFile6(file, index) {
1934
- const code = await import_promises15.default.readFile(file, "utf-8");
1896
+ const code = await import_promises13.default.readFile(file, "utf-8");
1935
1897
  let ast;
1936
1898
  try {
1937
1899
  ast = (0, import_parser.parse)(code, getParserOptions(file));
@@ -1992,10 +1954,10 @@ function generateWidgetConfigName(index) {
1992
1954
  return `WidgetConfig${index}`;
1993
1955
  }
1994
1956
  function generateImport6(file, index) {
1995
- const path6 = normalizePath(file);
1957
+ const path5 = normalizePath(file);
1996
1958
  return `import ${generateWidgetComponentName(
1997
1959
  index
1998
- )}, { config as ${generateWidgetConfigName(index)} } from "${path6}"`;
1960
+ )}, { config as ${generateWidgetConfigName(index)} } from "${path5}"`;
1999
1961
  }
2000
1962
  function generateWidget(zone, index, widgetId) {
2001
1963
  return {
@@ -2007,11 +1969,11 @@ function generateWidget(zone, index, widgetId) {
2007
1969
  function getWidgetIdOverride(ast) {
2008
1970
  let id = null;
2009
1971
  let found = false;
2010
- const readId = (path6) => {
1972
+ const readId = (path5) => {
2011
1973
  if (found) {
2012
1974
  return;
2013
1975
  }
2014
- const properties = getConfigObjectProperties(path6);
1976
+ const properties = getConfigObjectProperties(path5);
2015
1977
  if (!properties) {
2016
1978
  return;
2017
1979
  }
@@ -2040,12 +2002,12 @@ async function getWidgetZone(ast, file) {
2040
2002
  * not be a named export. Instead we look for a `VariableDeclaration` named
2041
2003
  * `config` and extract the `zone` property from it.
2042
2004
  */
2043
- VariableDeclarator(path6) {
2005
+ VariableDeclarator(path5) {
2044
2006
  if (zoneFound) {
2045
2007
  return;
2046
2008
  }
2047
- if (path6.node.id.type === "Identifier" && path6.node.id.name === "config" && path6.node.init?.type === "CallExpression") {
2048
- const arg = path6.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];
2049
2011
  if (arg?.type === "ObjectExpression") {
2050
2012
  const zoneProperty = arg.properties.find(
2051
2013
  (p) => p.type === "ObjectProperty" && p.key.name === "zone"
@@ -2060,11 +2022,11 @@ async function getWidgetZone(ast, file) {
2060
2022
  /**
2061
2023
  * For unbundled files, the `config` will always be a named export.
2062
2024
  */
2063
- ExportNamedDeclaration(path6) {
2025
+ ExportNamedDeclaration(path5) {
2064
2026
  if (zoneFound) {
2065
2027
  return;
2066
2028
  }
2067
- const declaration = path6.node.declaration;
2029
+ const declaration = path5.node.declaration;
2068
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") {
2069
2031
  const arg = declaration.declarations[0].init.arguments[0];
2070
2032
  if (arg?.type === "ObjectExpression") {
@@ -2141,14 +2103,14 @@ async function generateVirtualI18nModule(sources, pluginMode = false) {
2141
2103
 
2142
2104
  // src/virtual-modules/generate-virtual-cell-renderer-module.ts
2143
2105
  var import_outdent15 = __toESM(require("outdent"));
2144
- var import_promises16 = __toESM(require("fs/promises"));
2145
- var import_path4 = __toESM(require("path"));
2106
+ var import_promises14 = __toESM(require("fs/promises"));
2107
+ var import_path3 = __toESM(require("path"));
2146
2108
  async function generateVirtualCellRendererModule(sources, pluginMode = false) {
2147
2109
  const imports = [];
2148
2110
  for (const source of sources) {
2149
- const cellRenderersPath = import_path4.default.join(source, "cell-renderers.tsx");
2111
+ const cellRenderersPath = import_path3.default.join(source, "cell-renderers.tsx");
2150
2112
  try {
2151
- await import_promises16.default.access(cellRenderersPath);
2113
+ await import_promises14.default.access(cellRenderersPath);
2152
2114
  imports.push(`import "${cellRenderersPath}"`);
2153
2115
  } catch {
2154
2116
  }
@@ -2161,24 +2123,6 @@ async function generateVirtualCellRendererModule(sources, pluginMode = false) {
2161
2123
  return generateModule(code);
2162
2124
  }
2163
2125
 
2164
- // src/virtual-modules/generate-virtual-search-entity-module.ts
2165
- var import_outdent16 = __toESM(require("outdent"));
2166
- async function generateVirtualSearchEntityModule(sources, pluginMode = false) {
2167
- const imports = [];
2168
- for (const source of sources) {
2169
- const searchEntitiesPath = await findSearchEntityFile(source);
2170
- if (searchEntitiesPath) {
2171
- imports.push(`import "${normalizePath(searchEntitiesPath)}"`);
2172
- }
2173
- }
2174
- const code = import_outdent16.default`
2175
- ${imports.join("\n")}
2176
-
2177
- ${pluginMode ? `const searchEntityModule = {}` : `export default {}`}
2178
- `;
2179
- return generateModule(code);
2180
- }
2181
-
2182
2126
  // src/vmod.ts
2183
2127
  var import_admin_shared6 = require("@medusajs/admin-shared");
2184
2128
  var RESOLVED_LINK_VIRTUAL_MODULE = `\0${import_admin_shared6.LINK_VIRTUAL_MODULE}`;
@@ -2190,7 +2134,6 @@ var RESOLVED_WIDGET_VIRTUAL_MODULE = `\0${import_admin_shared6.WIDGET_VIRTUAL_MO
2190
2134
  var RESOLVED_I18N_VIRTUAL_MODULE = `\0${import_admin_shared6.I18N_VIRTUAL_MODULE}`;
2191
2135
  var RESOLVED_CELL_RENDERER_VIRTUAL_MODULE = `\0${import_admin_shared6.CELL_RENDERER_VIRTUAL_MODULE}`;
2192
2136
  var RESOLVED_LAYOUT_VIRTUAL_MODULE = `\0${import_admin_shared6.LAYOUT_VIRTUAL_MODULE}`;
2193
- var RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE = `\0${import_admin_shared6.SEARCH_ENTITY_VIRTUAL_MODULE}`;
2194
2137
  var VIRTUAL_MODULES = [
2195
2138
  import_admin_shared6.LINK_VIRTUAL_MODULE,
2196
2139
  import_admin_shared6.FORM_VIRTUAL_MODULE,
@@ -2200,8 +2143,7 @@ var VIRTUAL_MODULES = [
2200
2143
  import_admin_shared6.WIDGET_VIRTUAL_MODULE,
2201
2144
  import_admin_shared6.I18N_VIRTUAL_MODULE,
2202
2145
  import_admin_shared6.CELL_RENDERER_VIRTUAL_MODULE,
2203
- import_admin_shared6.LAYOUT_VIRTUAL_MODULE,
2204
- import_admin_shared6.SEARCH_ENTITY_VIRTUAL_MODULE
2146
+ import_admin_shared6.LAYOUT_VIRTUAL_MODULE
2205
2147
  ];
2206
2148
  var RESOLVED_VIRTUAL_MODULES = [
2207
2149
  RESOLVED_LINK_VIRTUAL_MODULE,
@@ -2212,8 +2154,7 @@ var RESOLVED_VIRTUAL_MODULES = [
2212
2154
  RESOLVED_WIDGET_VIRTUAL_MODULE,
2213
2155
  RESOLVED_I18N_VIRTUAL_MODULE,
2214
2156
  RESOLVED_CELL_RENDERER_VIRTUAL_MODULE,
2215
- RESOLVED_LAYOUT_VIRTUAL_MODULE,
2216
- RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE
2157
+ RESOLVED_LAYOUT_VIRTUAL_MODULE
2217
2158
  ];
2218
2159
  function resolveVirtualId(id) {
2219
2160
  return `\0${id}`;
@@ -2235,8 +2176,7 @@ var resolvedVirtualModuleIds = {
2235
2176
  widget: RESOLVED_WIDGET_VIRTUAL_MODULE,
2236
2177
  i18n: RESOLVED_I18N_VIRTUAL_MODULE,
2237
2178
  cellRenderer: RESOLVED_CELL_RENDERER_VIRTUAL_MODULE,
2238
- layout: RESOLVED_LAYOUT_VIRTUAL_MODULE,
2239
- searchEntity: RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE
2179
+ layout: RESOLVED_LAYOUT_VIRTUAL_MODULE
2240
2180
  };
2241
2181
  var virtualModuleIds = {
2242
2182
  link: import_admin_shared6.LINK_VIRTUAL_MODULE,
@@ -2247,8 +2187,7 @@ var virtualModuleIds = {
2247
2187
  widget: import_admin_shared6.WIDGET_VIRTUAL_MODULE,
2248
2188
  i18n: import_admin_shared6.I18N_VIRTUAL_MODULE,
2249
2189
  cellRenderer: import_admin_shared6.CELL_RENDERER_VIRTUAL_MODULE,
2250
- layout: import_admin_shared6.LAYOUT_VIRTUAL_MODULE,
2251
- searchEntity: import_admin_shared6.SEARCH_ENTITY_VIRTUAL_MODULE
2190
+ layout: import_admin_shared6.LAYOUT_VIRTUAL_MODULE
2252
2191
  };
2253
2192
  var vmod = {
2254
2193
  resolved: resolvedVirtualModuleIds,
@@ -2298,7 +2237,6 @@ var medusaVitePlugin = (options) => {
2298
2237
  const i18nModule = await generateVirtualI18nModule(sources, true);
2299
2238
  const cellRendererModule = await generateVirtualCellRendererModule(sources, true);
2300
2239
  const layoutModule = await generateVirtualLayoutModule(sources, true);
2301
- const searchEntityModule = await generateVirtualSearchEntityModule(sources, true);
2302
2240
  return `
2303
2241
  // Auto-generated index file for Medusa Admin UI extensions
2304
2242
  ${widgetModule.code}
@@ -2309,7 +2247,6 @@ var medusaVitePlugin = (options) => {
2309
2247
  ${i18nModule.code}
2310
2248
  ${cellRendererModule.code}
2311
2249
  ${layoutModule.code}
2312
- ${searchEntityModule.code}
2313
2250
 
2314
2251
  const plugin = {
2315
2252
  widgetModule,
@@ -2319,8 +2256,7 @@ var medusaVitePlugin = (options) => {
2319
2256
  displayModule,
2320
2257
  i18nModule,
2321
2258
  cellRendererModule,
2322
- layoutModule,
2323
- searchEntityModule
2259
+ layoutModule
2324
2260
  }
2325
2261
 
2326
2262
  export default plugin
@@ -2337,7 +2273,7 @@ var medusaVitePlugin = (options) => {
2337
2273
  switch (mode) {
2338
2274
  case "plugin" /* PLUGIN */: {
2339
2275
  const code = await generatePluginEntryModule(_sources);
2340
- await (0, import_promises17.writeFile)(pluginEntryFile, code, "utf-8");
2276
+ await (0, import_promises15.writeFile)(pluginEntryFile, code, "utf-8");
2341
2277
  break;
2342
2278
  }
2343
2279
  case "application" /* APPLICATION */: {
@@ -2349,7 +2285,7 @@ var medusaVitePlugin = (options) => {
2349
2285
  switch (mode) {
2350
2286
  case "plugin" /* PLUGIN */: {
2351
2287
  try {
2352
- await (0, import_promises17.rm)(pluginEntryFile, { force: true });
2288
+ await (0, import_promises15.rm)(pluginEntryFile, { force: true });
2353
2289
  } catch (error) {
2354
2290
  }
2355
2291
  break;
@@ -2441,11 +2377,6 @@ var loadConfigs = {
2441
2377
  hashGenerator: async (sources) => generateLayoutHash(sources),
2442
2378
  moduleGenerator: async (sources) => generateVirtualLayoutModule(sources),
2443
2379
  hashKey: vmod.virtual.layout
2444
- },
2445
- [vmod.resolved.searchEntity]: {
2446
- hashGenerator: async (sources) => generateSearchEntityHash(sources),
2447
- moduleGenerator: async (sources) => generateVirtualSearchEntityModule(sources),
2448
- hashKey: vmod.virtual.searchEntity
2449
2380
  }
2450
2381
  };
2451
2382
  var watcherConfigs = [
@@ -2537,22 +2468,7 @@ var watcherConfigs = [
2537
2468
  hashKey: "layoutConfigHash"
2538
2469
  }
2539
2470
  ]
2540
- },
2541
- ...SEARCH_ENTITY_FILES.map(
2542
- (subdirectory) => ({
2543
- subdirectory,
2544
- hashGenerator: async (sources) => ({
2545
- searchEntityHash: await generateSearchEntityHash(sources)
2546
- }),
2547
- modules: [
2548
- {
2549
- virtualModule: vmod.virtual.searchEntity,
2550
- resolvedModule: vmod.resolved.searchEntity,
2551
- hashKey: "searchEntityHash"
2552
- }
2553
- ]
2554
- })
2555
- )
2471
+ }
2556
2472
  ];
2557
2473
 
2558
2474
  // src/index.ts
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/plugin.ts
2
2
  import { rm, writeFile } from "fs/promises";
3
- import path5 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((path6) => {
66
- return VALID_FILE_EXTENSIONS.some((ext) => path6.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((path6) => {
70
- return VALID_FILE_EXTENSIONS.some((ext) => path6.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(path6) {
88
- if (isVariableDeclarator(path6.node)) {
89
- const configDeclaration = isIdentifier(path6.node.id, { name: "config" }) ? path6.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 = path6.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(path6) {
113
- if (path6.node.left.type === "MemberExpression" && path6.node.left.object.type === "Identifier" && path6.node.left.object.name === "exports" && path6.node.left.property.type === "Identifier" && path6.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(path6) {
118
- const specifiers = path6.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(path6, file) {
210
- const configArgument = getConfigArgument(path6);
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(path6, file) {
241
241
  }
242
242
  return model;
243
243
  }
244
- function getConfigArgument(path6) {
245
- if (!isCallExpression(path6.node.declaration)) {
244
+ function getConfigArgument(path5) {
245
+ if (!isCallExpression(path5.node.declaration)) {
246
246
  return null;
247
247
  }
248
- if (!isIdentifier(path6.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 = path6.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(path6, file) {
260
- const configArgument = getConfigArgument(path6);
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(path6) {
351
- const _model = getModel(path6, 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(path6, model, index, file);
357
- hasLink = validateLink(path6, 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(path6, model, index, file) {
382
- const configArgument = getConfigArgument(path6);
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 path6 = normalizePath(file);
459
- return `import ${generateCustomFieldConfigName(index)} from "${path6}"`;
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(path6) {
585
- const _model = getModel(path6, 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(path6, file);
591
- configs = getConfigs(path6, model, index, file);
592
- forms = getForms(path6, 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 path6 = normalizePath(file);
622
- return `import ${generateCustomFieldConfigName2(index)} from "${path6}"`;
621
+ const path5 = normalizePath(file);
622
+ return `import ${generateCustomFieldConfigName2(index)} from "${path5}"`;
623
623
  }
624
- function getForms(path6, model, index, file) {
625
- const formArray = getFormsArgument(path6, 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(path6, model, index, file) {
790
- const formArray = getFormsArgument(path6, 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(path6, file) {
910
- const configArgument = getConfigArgument(path6);
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(path6) {
972
- const configArgument = getConfigArgument(path6);
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(path6) {
1067
- const _model = getModel(path6, 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(path6, 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 path6 = normalizePath(file);
1096
- return `import ${generateCustomFieldConfigName3(index)} from "${path6}"`;
1095
+ const path5 = normalizePath(file);
1096
+ return `import ${generateCustomFieldConfigName3(index)} from "${path5}"`;
1097
1097
  }
1098
- function getLink(path6, index, file) {
1099
- const configArgument = getConfigArgument(path6);
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(path6) {
1238
+ ExportNamedDeclaration(path5) {
1239
1239
  if (found) {
1240
1240
  return;
1241
1241
  }
1242
- if (getConfigObjectProperties(path6)) {
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 path6 = normalizePath(file);
1251
- return `import ${componentName}, { config as ${configName} } from "${path6}"`;
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: path6, 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: "${path6}",
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 path6 = normalizePath(file);
1342
- return `import { config as ${generateRouteConfigName(index)} } from "${path6}"`;
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(path6) {
1375
+ VariableDeclarator(path5) {
1376
1376
  if (configFound) {
1377
1377
  return;
1378
1378
  }
1379
- const properties = getConfigObjectProperties(path6);
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(path6) {
1391
+ ExportNamedDeclaration(path5) {
1392
1392
  if (configFound) {
1393
1393
  return;
1394
1394
  }
1395
- const properties = getConfigObjectProperties(path6);
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(path6) {
1501
- defaultExportContent = code.slice(path6.node.start, path6.node.end);
1500
+ ExportDefaultDeclaration(path5) {
1501
+ defaultExportContent = code.slice(path5.node.start, path5.node.end);
1502
1502
  },
1503
- ExportNamedDeclaration(path6) {
1504
- const properties = getConfigObjectProperties(path6);
1503
+ ExportNamedDeclaration(path5) {
1504
+ const properties = getConfigObjectProperties(path5);
1505
1505
  if (properties) {
1506
- configContent = code.slice(path6.node.start, path6.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(path6) {
1687
- const declaration = path6.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,44 +1712,6 @@ async function hasNamedExports(ast, file) {
1712
1712
  return { hasHandle, hasLoader, hasConfig };
1713
1713
  }
1714
1714
 
1715
- // src/search-entities/constants.ts
1716
- var SEARCH_ENTITY_FILES = [
1717
- "search-entities.tsx",
1718
- "search-entities.ts"
1719
- ];
1720
-
1721
- // src/search-entities/find-search-entity-file.ts
1722
- import fs12 from "fs/promises";
1723
- import path3 from "path";
1724
- async function findSearchEntityFile(source) {
1725
- for (const fileName of SEARCH_ENTITY_FILES) {
1726
- const filePath = path3.join(source, fileName);
1727
- try {
1728
- await fs12.access(filePath);
1729
- return filePath;
1730
- } catch {
1731
- }
1732
- }
1733
- return null;
1734
- }
1735
-
1736
- // src/search-entities/generate-search-entity-hash.ts
1737
- import fs13 from "fs/promises";
1738
- async function generateSearchEntityHash(sources) {
1739
- const contents = [];
1740
- for (const source of sources) {
1741
- const searchEntitiesPath = await findSearchEntityFile(source);
1742
- if (!searchEntitiesPath) {
1743
- continue;
1744
- }
1745
- try {
1746
- contents.push(await fs13.readFile(searchEntitiesPath, "utf-8"));
1747
- } catch {
1748
- }
1749
- }
1750
- return generateHash(contents.join(""));
1751
- }
1752
-
1753
1715
  // src/virtual-modules/generate-virtual-display-module.ts
1754
1716
  import { outdent as outdent6 } from "outdent";
1755
1717
  async function generateVirtualDisplayModule(sources, pluginMode = false) {
@@ -1829,7 +1791,7 @@ async function generateVirtualRouteModule(sources, pluginMode = false) {
1829
1791
  import outdent13 from "outdent";
1830
1792
 
1831
1793
  // src/widgets/generate-widget-hash.ts
1832
- import fs14 from "fs/promises";
1794
+ import fs12 from "fs/promises";
1833
1795
 
1834
1796
  // src/widgets/helpers.ts
1835
1797
  async function getWidgetFilesFromSources(sources) {
@@ -1846,7 +1808,7 @@ async function generateWidgetHash(sources) {
1846
1808
  return generateHash(totalContent);
1847
1809
  }
1848
1810
  async function getWidgetContents(file) {
1849
- const code = await fs14.readFile(file, "utf-8");
1811
+ const code = await fs12.readFile(file, "utf-8");
1850
1812
  let ast;
1851
1813
  try {
1852
1814
  ast = parse(code, getParserOptions(file));
@@ -1863,14 +1825,14 @@ async function getWidgetContents(file) {
1863
1825
  let configContent = null;
1864
1826
  let defaultExportContent = null;
1865
1827
  traverse(ast, {
1866
- ExportNamedDeclaration(path6) {
1867
- const properties = getConfigObjectProperties(path6);
1828
+ ExportNamedDeclaration(path5) {
1829
+ const properties = getConfigObjectProperties(path5);
1868
1830
  if (properties) {
1869
- configContent = code.slice(path6.node.start, path6.node.end);
1831
+ configContent = code.slice(path5.node.start, path5.node.end);
1870
1832
  }
1871
1833
  },
1872
- ExportDefaultDeclaration(path6) {
1873
- defaultExportContent = code.slice(path6.node.start, path6.node.end);
1834
+ ExportDefaultDeclaration(path5) {
1835
+ defaultExportContent = code.slice(path5.node.start, path5.node.end);
1874
1836
  }
1875
1837
  });
1876
1838
  return { config: configContent, defaultExport: defaultExportContent };
@@ -1878,7 +1840,7 @@ async function getWidgetContents(file) {
1878
1840
 
1879
1841
  // src/widgets/generate-widgets.ts
1880
1842
  import { isValidInjectionZone } from "@medusajs/admin-shared";
1881
- import fs15 from "fs/promises";
1843
+ import fs13 from "fs/promises";
1882
1844
  import outdent12 from "outdent";
1883
1845
  async function generateWidgets(sources) {
1884
1846
  const files = await getWidgetFilesFromSources(sources);
@@ -1922,7 +1884,7 @@ function getWidgetId(idOverride, file) {
1922
1884
  return `Widget-${generateHash(relative).slice(0, 4)}`;
1923
1885
  }
1924
1886
  async function parseFile6(file, index) {
1925
- const code = await fs15.readFile(file, "utf-8");
1887
+ const code = await fs13.readFile(file, "utf-8");
1926
1888
  let ast;
1927
1889
  try {
1928
1890
  ast = parse(code, getParserOptions(file));
@@ -1983,10 +1945,10 @@ function generateWidgetConfigName(index) {
1983
1945
  return `WidgetConfig${index}`;
1984
1946
  }
1985
1947
  function generateImport6(file, index) {
1986
- const path6 = normalizePath(file);
1948
+ const path5 = normalizePath(file);
1987
1949
  return `import ${generateWidgetComponentName(
1988
1950
  index
1989
- )}, { config as ${generateWidgetConfigName(index)} } from "${path6}"`;
1951
+ )}, { config as ${generateWidgetConfigName(index)} } from "${path5}"`;
1990
1952
  }
1991
1953
  function generateWidget(zone, index, widgetId) {
1992
1954
  return {
@@ -1998,11 +1960,11 @@ function generateWidget(zone, index, widgetId) {
1998
1960
  function getWidgetIdOverride(ast) {
1999
1961
  let id = null;
2000
1962
  let found = false;
2001
- const readId = (path6) => {
1963
+ const readId = (path5) => {
2002
1964
  if (found) {
2003
1965
  return;
2004
1966
  }
2005
- const properties = getConfigObjectProperties(path6);
1967
+ const properties = getConfigObjectProperties(path5);
2006
1968
  if (!properties) {
2007
1969
  return;
2008
1970
  }
@@ -2031,12 +1993,12 @@ async function getWidgetZone(ast, file) {
2031
1993
  * not be a named export. Instead we look for a `VariableDeclaration` named
2032
1994
  * `config` and extract the `zone` property from it.
2033
1995
  */
2034
- VariableDeclarator(path6) {
1996
+ VariableDeclarator(path5) {
2035
1997
  if (zoneFound) {
2036
1998
  return;
2037
1999
  }
2038
- if (path6.node.id.type === "Identifier" && path6.node.id.name === "config" && path6.node.init?.type === "CallExpression") {
2039
- const arg = path6.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];
2040
2002
  if (arg?.type === "ObjectExpression") {
2041
2003
  const zoneProperty = arg.properties.find(
2042
2004
  (p) => p.type === "ObjectProperty" && p.key.name === "zone"
@@ -2051,11 +2013,11 @@ async function getWidgetZone(ast, file) {
2051
2013
  /**
2052
2014
  * For unbundled files, the `config` will always be a named export.
2053
2015
  */
2054
- ExportNamedDeclaration(path6) {
2016
+ ExportNamedDeclaration(path5) {
2055
2017
  if (zoneFound) {
2056
2018
  return;
2057
2019
  }
2058
- const declaration = path6.node.declaration;
2020
+ const declaration = path5.node.declaration;
2059
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") {
2060
2022
  const arg = declaration.declarations[0].init.arguments[0];
2061
2023
  if (arg?.type === "ObjectExpression") {
@@ -2132,14 +2094,14 @@ async function generateVirtualI18nModule(sources, pluginMode = false) {
2132
2094
 
2133
2095
  // src/virtual-modules/generate-virtual-cell-renderer-module.ts
2134
2096
  import outdent15 from "outdent";
2135
- import fs16 from "fs/promises";
2136
- import path4 from "path";
2097
+ import fs14 from "fs/promises";
2098
+ import path3 from "path";
2137
2099
  async function generateVirtualCellRendererModule(sources, pluginMode = false) {
2138
2100
  const imports = [];
2139
2101
  for (const source of sources) {
2140
- const cellRenderersPath = path4.join(source, "cell-renderers.tsx");
2102
+ const cellRenderersPath = path3.join(source, "cell-renderers.tsx");
2141
2103
  try {
2142
- await fs16.access(cellRenderersPath);
2104
+ await fs14.access(cellRenderersPath);
2143
2105
  imports.push(`import "${cellRenderersPath}"`);
2144
2106
  } catch {
2145
2107
  }
@@ -2152,24 +2114,6 @@ async function generateVirtualCellRendererModule(sources, pluginMode = false) {
2152
2114
  return generateModule(code);
2153
2115
  }
2154
2116
 
2155
- // src/virtual-modules/generate-virtual-search-entity-module.ts
2156
- import outdent16 from "outdent";
2157
- async function generateVirtualSearchEntityModule(sources, pluginMode = false) {
2158
- const imports = [];
2159
- for (const source of sources) {
2160
- const searchEntitiesPath = await findSearchEntityFile(source);
2161
- if (searchEntitiesPath) {
2162
- imports.push(`import "${normalizePath(searchEntitiesPath)}"`);
2163
- }
2164
- }
2165
- const code = outdent16`
2166
- ${imports.join("\n")}
2167
-
2168
- ${pluginMode ? `const searchEntityModule = {}` : `export default {}`}
2169
- `;
2170
- return generateModule(code);
2171
- }
2172
-
2173
2117
  // src/vmod.ts
2174
2118
  import {
2175
2119
  CELL_RENDERER_VIRTUAL_MODULE,
@@ -2180,7 +2124,6 @@ import {
2180
2124
  LINK_VIRTUAL_MODULE,
2181
2125
  MENU_ITEM_VIRTUAL_MODULE,
2182
2126
  ROUTE_VIRTUAL_MODULE,
2183
- SEARCH_ENTITY_VIRTUAL_MODULE,
2184
2127
  WIDGET_VIRTUAL_MODULE
2185
2128
  } from "@medusajs/admin-shared";
2186
2129
  var RESOLVED_LINK_VIRTUAL_MODULE = `\0${LINK_VIRTUAL_MODULE}`;
@@ -2192,7 +2135,6 @@ var RESOLVED_WIDGET_VIRTUAL_MODULE = `\0${WIDGET_VIRTUAL_MODULE}`;
2192
2135
  var RESOLVED_I18N_VIRTUAL_MODULE = `\0${I18N_VIRTUAL_MODULE}`;
2193
2136
  var RESOLVED_CELL_RENDERER_VIRTUAL_MODULE = `\0${CELL_RENDERER_VIRTUAL_MODULE}`;
2194
2137
  var RESOLVED_LAYOUT_VIRTUAL_MODULE = `\0${LAYOUT_VIRTUAL_MODULE}`;
2195
- var RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE = `\0${SEARCH_ENTITY_VIRTUAL_MODULE}`;
2196
2138
  var VIRTUAL_MODULES = [
2197
2139
  LINK_VIRTUAL_MODULE,
2198
2140
  FORM_VIRTUAL_MODULE,
@@ -2202,8 +2144,7 @@ var VIRTUAL_MODULES = [
2202
2144
  WIDGET_VIRTUAL_MODULE,
2203
2145
  I18N_VIRTUAL_MODULE,
2204
2146
  CELL_RENDERER_VIRTUAL_MODULE,
2205
- LAYOUT_VIRTUAL_MODULE,
2206
- SEARCH_ENTITY_VIRTUAL_MODULE
2147
+ LAYOUT_VIRTUAL_MODULE
2207
2148
  ];
2208
2149
  var RESOLVED_VIRTUAL_MODULES = [
2209
2150
  RESOLVED_LINK_VIRTUAL_MODULE,
@@ -2214,8 +2155,7 @@ var RESOLVED_VIRTUAL_MODULES = [
2214
2155
  RESOLVED_WIDGET_VIRTUAL_MODULE,
2215
2156
  RESOLVED_I18N_VIRTUAL_MODULE,
2216
2157
  RESOLVED_CELL_RENDERER_VIRTUAL_MODULE,
2217
- RESOLVED_LAYOUT_VIRTUAL_MODULE,
2218
- RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE
2158
+ RESOLVED_LAYOUT_VIRTUAL_MODULE
2219
2159
  ];
2220
2160
  function resolveVirtualId(id) {
2221
2161
  return `\0${id}`;
@@ -2237,8 +2177,7 @@ var resolvedVirtualModuleIds = {
2237
2177
  widget: RESOLVED_WIDGET_VIRTUAL_MODULE,
2238
2178
  i18n: RESOLVED_I18N_VIRTUAL_MODULE,
2239
2179
  cellRenderer: RESOLVED_CELL_RENDERER_VIRTUAL_MODULE,
2240
- layout: RESOLVED_LAYOUT_VIRTUAL_MODULE,
2241
- searchEntity: RESOLVED_SEARCH_ENTITY_VIRTUAL_MODULE
2180
+ layout: RESOLVED_LAYOUT_VIRTUAL_MODULE
2242
2181
  };
2243
2182
  var virtualModuleIds = {
2244
2183
  link: LINK_VIRTUAL_MODULE,
@@ -2249,8 +2188,7 @@ var virtualModuleIds = {
2249
2188
  widget: WIDGET_VIRTUAL_MODULE,
2250
2189
  i18n: I18N_VIRTUAL_MODULE,
2251
2190
  cellRenderer: CELL_RENDERER_VIRTUAL_MODULE,
2252
- layout: LAYOUT_VIRTUAL_MODULE,
2253
- searchEntity: SEARCH_ENTITY_VIRTUAL_MODULE
2191
+ layout: LAYOUT_VIRTUAL_MODULE
2254
2192
  };
2255
2193
  var vmod = {
2256
2194
  resolved: resolvedVirtualModuleIds,
@@ -2265,7 +2203,7 @@ var medusaVitePlugin = (options) => {
2265
2203
  let watcher;
2266
2204
  function isFileInSources(file) {
2267
2205
  for (const source of _sources) {
2268
- if (file.startsWith(path5.resolve(source))) {
2206
+ if (file.startsWith(path4.resolve(source))) {
2269
2207
  return true;
2270
2208
  }
2271
2209
  }
@@ -2300,7 +2238,6 @@ var medusaVitePlugin = (options) => {
2300
2238
  const i18nModule = await generateVirtualI18nModule(sources, true);
2301
2239
  const cellRendererModule = await generateVirtualCellRendererModule(sources, true);
2302
2240
  const layoutModule = await generateVirtualLayoutModule(sources, true);
2303
- const searchEntityModule = await generateVirtualSearchEntityModule(sources, true);
2304
2241
  return `
2305
2242
  // Auto-generated index file for Medusa Admin UI extensions
2306
2243
  ${widgetModule.code}
@@ -2311,7 +2248,6 @@ var medusaVitePlugin = (options) => {
2311
2248
  ${i18nModule.code}
2312
2249
  ${cellRendererModule.code}
2313
2250
  ${layoutModule.code}
2314
- ${searchEntityModule.code}
2315
2251
 
2316
2252
  const plugin = {
2317
2253
  widgetModule,
@@ -2321,14 +2257,13 @@ var medusaVitePlugin = (options) => {
2321
2257
  displayModule,
2322
2258
  i18nModule,
2323
2259
  cellRendererModule,
2324
- layoutModule,
2325
- searchEntityModule
2260
+ layoutModule
2326
2261
  }
2327
2262
 
2328
2263
  export default plugin
2329
2264
  `;
2330
2265
  }
2331
- const pluginEntryFile = path5.resolve(
2266
+ const pluginEntryFile = path4.resolve(
2332
2267
  process.cwd(),
2333
2268
  "src/admin/__admin-extensions__.js"
2334
2269
  );
@@ -2443,11 +2378,6 @@ var loadConfigs = {
2443
2378
  hashGenerator: async (sources) => generateLayoutHash(sources),
2444
2379
  moduleGenerator: async (sources) => generateVirtualLayoutModule(sources),
2445
2380
  hashKey: vmod.virtual.layout
2446
- },
2447
- [vmod.resolved.searchEntity]: {
2448
- hashGenerator: async (sources) => generateSearchEntityHash(sources),
2449
- moduleGenerator: async (sources) => generateVirtualSearchEntityModule(sources),
2450
- hashKey: vmod.virtual.searchEntity
2451
2381
  }
2452
2382
  };
2453
2383
  var watcherConfigs = [
@@ -2539,22 +2469,7 @@ var watcherConfigs = [
2539
2469
  hashKey: "layoutConfigHash"
2540
2470
  }
2541
2471
  ]
2542
- },
2543
- ...SEARCH_ENTITY_FILES.map(
2544
- (subdirectory) => ({
2545
- subdirectory,
2546
- hashGenerator: async (sources) => ({
2547
- searchEntityHash: await generateSearchEntityHash(sources)
2548
- }),
2549
- modules: [
2550
- {
2551
- virtualModule: vmod.virtual.searchEntity,
2552
- resolvedModule: vmod.resolved.searchEntity,
2553
- hashKey: "searchEntityHash"
2554
- }
2555
- ]
2556
- })
2557
- )
2472
+ }
2558
2473
  ];
2559
2474
 
2560
2475
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/admin-vite-plugin",
3
- "version": "2.19.0-snapshot-20260813102506",
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-20260813102506",
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",