@vendure/dashboard 3.3.5-master-202506241446 → 3.3.5-master-202506250724

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.
@@ -0,0 +1 @@
1
+ export * from './src/my.plugin';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/my.plugin"), exports);
@@ -0,0 +1,2 @@
1
+ export declare class MyPlugin {
2
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MyPlugin = void 0;
10
+ const core_1 = require("@vendure/core");
11
+ let MyPlugin = class MyPlugin {
12
+ };
13
+ exports.MyPlugin = MyPlugin;
14
+ exports.MyPlugin = MyPlugin = __decorate([
15
+ (0, core_1.VendurePlugin)({
16
+ imports: [core_1.PluginCommonModule],
17
+ providers: [],
18
+ dashboard: './dashboard/index.tsx',
19
+ })
20
+ ], MyPlugin);
@@ -0,0 +1,2 @@
1
+ import { VendureConfig } from '@vendure/core';
2
+ export declare const config: VendureConfig;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = void 0;
4
+ const my_plugin_1 = require("./my-plugin");
5
+ exports.config = {
6
+ apiOptions: {
7
+ port: 3000,
8
+ },
9
+ authOptions: {
10
+ tokenMethod: 'bearer',
11
+ },
12
+ dbConnectionOptions: {
13
+ type: 'postgres',
14
+ },
15
+ paymentOptions: {
16
+ paymentMethodHandlers: [],
17
+ },
18
+ plugins: [my_plugin_1.MyPlugin],
19
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { join } from 'path';
2
+ import { describe, expect, it } from 'vitest';
3
+ import { loadVendureConfig } from '../utils/config-loader.js';
4
+ describe('detecting plugins in barrel exports', () => {
5
+ it('should detect plugins in barrel exports', async () => {
6
+ const result = await loadVendureConfig({
7
+ tempDir: join(__dirname, './__temp'),
8
+ vendureConfigPath: join(__dirname, 'barrel-exports', 'vendure-config.ts'),
9
+ });
10
+ expect(result.pluginInfo).toHaveLength(1);
11
+ expect(result.pluginInfo[0].name).toBe('MyPlugin');
12
+ expect(result.pluginInfo[0].dashboardEntryPath).toBe('./dashboard/index.tsx');
13
+ });
14
+ });
@@ -157,11 +157,14 @@ export async function compileFile({ inputRootDir, inputPath, outputDir, transfor
157
157
  }
158
158
  }
159
159
  async function collectImports(node) {
160
- if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {
160
+ if ((ts.isExportDeclaration(node) || ts.isImportDeclaration(node)) &&
161
+ node.moduleSpecifier &&
162
+ ts.isStringLiteral(node.moduleSpecifier)) {
161
163
  const importPath = node.moduleSpecifier.text;
162
164
  // Handle relative imports
163
165
  if (importPath.startsWith('.')) {
164
166
  const resolvedPath = path.resolve(path.dirname(absoluteInputPath), importPath);
167
+ // TODO: does this handle index files correctly?
165
168
  let resolvedTsPath = resolvedPath + '.ts';
166
169
  // Also check for .tsx if .ts doesn't exist
167
170
  if (!(await fs.pathExists(resolvedTsPath))) {
@@ -209,7 +212,9 @@ export async function compileFile({ inputRootDir, inputPath, outputDir, transfor
209
212
  continue;
210
213
  const potentialPathBase = path.resolve(tsConfigInfo.baseUrl, patternPrefix);
211
214
  const resolvedPath = path.join(potentialPathBase, remainingImportPath);
212
- let resolvedTsPath = resolvedPath + '.ts';
215
+ let resolvedTsPath = resolvedPath.endsWith('.ts')
216
+ ? resolvedPath
217
+ : resolvedPath + '.ts';
213
218
  // Similar existence checks as relative paths
214
219
  if (!(await fs.pathExists(resolvedTsPath))) {
215
220
  const resolvedTsxPath = resolvedPath + '.tsx';
@@ -258,6 +263,7 @@ export async function compileFile({ inputRootDir, inputPath, outputDir, transfor
258
263
  ts.isModuleBlock(child) ||
259
264
  ts.isModuleDeclaration(child) ||
260
265
  ts.isImportDeclaration(child) ||
266
+ ts.isExportDeclaration(child) ||
261
267
  child.kind === ts.SyntaxKind.SyntaxList) {
262
268
  await collectImports(child);
263
269
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vendure/dashboard",
3
3
  "private": false,
4
- "version": "3.3.5-master-202506241446",
4
+ "version": "3.3.5-master-202506250724",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -86,8 +86,8 @@
86
86
  "@types/react-dom": "^19.0.4",
87
87
  "@types/react-grid-layout": "^1.3.5",
88
88
  "@uidotdev/usehooks": "^2.4.1",
89
- "@vendure/common": "^3.3.5-master-202506241446",
90
- "@vendure/core": "^3.3.5-master-202506241446",
89
+ "@vendure/common": "^3.3.5-master-202506250724",
90
+ "@vendure/core": "^3.3.5-master-202506250724",
91
91
  "@vitejs/plugin-react": "^4.3.4",
92
92
  "awesome-graphql-client": "^2.1.0",
93
93
  "class-variance-authority": "^0.7.1",
@@ -130,5 +130,5 @@
130
130
  "lightningcss-linux-arm64-musl": "^1.29.3",
131
131
  "lightningcss-linux-x64-musl": "^1.29.1"
132
132
  },
133
- "gitHead": "87c4cecdb30f3c14ca2935ab3c573ddfcaa826e9"
133
+ "gitHead": "7e19f372f587c6fee551324c9f826eb719b4b3b9"
134
134
  }
package/src/lib/index.ts CHANGED
@@ -162,6 +162,8 @@ export * from './framework/page/use-detail-page.js';
162
162
  export * from './framework/page/use-extended-router.js';
163
163
  export * from './framework/registry/global-registry.js';
164
164
  export * from './framework/registry/registry-types.js';
165
+ export * from './graphql/api.js';
166
+ export * from './graphql/fragments.js';
165
167
  export * from './hooks/use-auth.js';
166
168
  export * from './hooks/use-channel.js';
167
169
  export * from './hooks/use-custom-field-config.js';
@@ -0,0 +1 @@
1
+ export * from './src/my.plugin';
@@ -0,0 +1,8 @@
1
+ import { PluginCommonModule, VendurePlugin } from '@vendure/core';
2
+
3
+ @VendurePlugin({
4
+ imports: [PluginCommonModule],
5
+ providers: [],
6
+ dashboard: './dashboard/index.tsx',
7
+ })
8
+ export class MyPlugin {}
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "commonjs",
3
+ "name": "barrel-exports",
4
+ "version": "0.0.1",
5
+ "main": "index.ts"
6
+ }
@@ -0,0 +1,19 @@
1
+ import { VendureConfig } from '@vendure/core';
2
+
3
+ import { MyPlugin } from './my-plugin';
4
+
5
+ export const config: VendureConfig = {
6
+ apiOptions: {
7
+ port: 3000,
8
+ },
9
+ authOptions: {
10
+ tokenMethod: 'bearer',
11
+ },
12
+ dbConnectionOptions: {
13
+ type: 'postgres',
14
+ },
15
+ paymentOptions: {
16
+ paymentMethodHandlers: [],
17
+ },
18
+ plugins: [MyPlugin],
19
+ };
@@ -0,0 +1,17 @@
1
+ import { join } from 'path';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ import { loadVendureConfig } from '../utils/config-loader.js';
5
+
6
+ describe('detecting plugins in barrel exports', () => {
7
+ it('should detect plugins in barrel exports', async () => {
8
+ const result = await loadVendureConfig({
9
+ tempDir: join(__dirname, './__temp'),
10
+ vendureConfigPath: join(__dirname, 'barrel-exports', 'vendure-config.ts'),
11
+ });
12
+
13
+ expect(result.pluginInfo).toHaveLength(1);
14
+ expect(result.pluginInfo[0].name).toBe('MyPlugin');
15
+ expect(result.pluginInfo[0].dashboardEntryPath).toBe('./dashboard/index.tsx');
16
+ });
17
+ });
@@ -328,12 +328,17 @@ export async function compileFile({
328
328
  }
329
329
 
330
330
  async function collectImports(node: ts.Node) {
331
- if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {
331
+ if (
332
+ (ts.isExportDeclaration(node) || ts.isImportDeclaration(node)) &&
333
+ node.moduleSpecifier &&
334
+ ts.isStringLiteral(node.moduleSpecifier)
335
+ ) {
332
336
  const importPath = node.moduleSpecifier.text;
333
337
 
334
338
  // Handle relative imports
335
339
  if (importPath.startsWith('.')) {
336
340
  const resolvedPath = path.resolve(path.dirname(absoluteInputPath), importPath);
341
+ // TODO: does this handle index files correctly?
337
342
  let resolvedTsPath = resolvedPath + '.ts';
338
343
  // Also check for .tsx if .ts doesn't exist
339
344
  if (!(await fs.pathExists(resolvedTsPath))) {
@@ -384,7 +389,9 @@ export async function compileFile({
384
389
  const potentialPathBase = path.resolve(tsConfigInfo.baseUrl, patternPrefix);
385
390
  const resolvedPath = path.join(potentialPathBase, remainingImportPath);
386
391
 
387
- let resolvedTsPath = resolvedPath + '.ts';
392
+ let resolvedTsPath = resolvedPath.endsWith('.ts')
393
+ ? resolvedPath
394
+ : resolvedPath + '.ts';
388
395
  // Similar existence checks as relative paths
389
396
  if (!(await fs.pathExists(resolvedTsPath))) {
390
397
  const resolvedTsxPath = resolvedPath + '.tsx';
@@ -429,6 +436,7 @@ export async function compileFile({
429
436
  ts.isModuleBlock(child) ||
430
437
  ts.isModuleDeclaration(child) ||
431
438
  ts.isImportDeclaration(child) ||
439
+ ts.isExportDeclaration(child) ||
432
440
  child.kind === ts.SyntaxKind.SyntaxList
433
441
  ) {
434
442
  await collectImports(child);