@vendure/dashboard 3.3.7-master-202507150240 → 3.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin/utils/plugin-discovery.js +4 -0
- package/package.json +4 -4
- package/vite/tests/fixtures-path-alias/js-aliased/index.ts +1 -0
- package/vite/tests/fixtures-path-alias/{aliased-plugin/src/aliased.plugin.ts → js-aliased/src/js-aliased.plugin.ts} +1 -1
- package/vite/tests/fixtures-path-alias/star-aliased/index.ts +1 -0
- package/vite/tests/fixtures-path-alias/star-aliased/src/star-aliased.plugin.ts +8 -0
- package/vite/tests/fixtures-path-alias/ts-aliased/index.ts +1 -0
- package/vite/tests/fixtures-path-alias/ts-aliased/src/ts-aliased.plugin.ts +8 -0
- package/vite/tests/fixtures-path-alias/vendure-config.ts +4 -3
- package/vite/tests/path-alias.spec.ts +35 -7
- package/vite/tests/tsconfig.json +19 -9
- package/vite/utils/plugin-discovery.ts +4 -1
- package/vite/tests/fixtures-path-alias/aliased-plugin/index.ts +0 -1
|
@@ -164,7 +164,11 @@ export async function analyzeSourceFiles(vendureConfigPath, logger, transformTsC
|
|
|
164
164
|
importPath + '.js',
|
|
165
165
|
path.join(importPath, 'index.ts'),
|
|
166
166
|
path.join(importPath, 'index.js'),
|
|
167
|
+
importPath,
|
|
167
168
|
];
|
|
169
|
+
if (importPath.endsWith('.js')) {
|
|
170
|
+
possiblePaths.push(importPath.replace(/.js$/, '.ts'));
|
|
171
|
+
}
|
|
168
172
|
// Try each possible path
|
|
169
173
|
let found = false;
|
|
170
174
|
for (const possiblePath of possiblePaths) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/dashboard",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.3.7
|
|
4
|
+
"version": "3.3.7",
|
|
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": "
|
|
90
|
-
"@vendure/core": "
|
|
89
|
+
"@vendure/common": "3.3.7",
|
|
90
|
+
"@vendure/core": "3.3.7",
|
|
91
91
|
"@vitejs/plugin-react": "^4.3.4",
|
|
92
92
|
"acorn": "^8.11.3",
|
|
93
93
|
"acorn-walk": "^8.3.2",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"lightningcss-linux-arm64-musl": "^1.29.3",
|
|
134
134
|
"lightningcss-linux-x64-musl": "^1.29.1"
|
|
135
135
|
},
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "475eb918c9fc95de41e26f91f8eec39cfeeb6dd7"
|
|
137
137
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/js-aliased.plugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/star-aliased.plugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/ts-aliased.plugin';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { JsAliasedPlugin } from '@other/js-aliased';
|
|
2
|
+
import { TsAliasedPlugin } from '@other/ts-aliased';
|
|
3
|
+
import { StarAliasedPlugin } from '@plugins/star-aliased';
|
|
1
4
|
import { VendureConfig } from '@vendure/core';
|
|
2
5
|
|
|
3
|
-
import { AliasedPlugin } from './aliased-plugin';
|
|
4
|
-
|
|
5
6
|
export const config: VendureConfig = {
|
|
6
7
|
apiOptions: {
|
|
7
8
|
port: 3000,
|
|
@@ -15,5 +16,5 @@ export const config: VendureConfig = {
|
|
|
15
16
|
paymentOptions: {
|
|
16
17
|
paymentMethodHandlers: [],
|
|
17
18
|
},
|
|
18
|
-
plugins: [
|
|
19
|
+
plugins: [StarAliasedPlugin, TsAliasedPlugin, JsAliasedPlugin],
|
|
19
20
|
};
|
|
@@ -16,17 +16,45 @@ describe('detecting plugins using tsconfig path aliases', () => {
|
|
|
16
16
|
outputPath: tempDir,
|
|
17
17
|
vendureConfigPath: join(__dirname, 'fixtures-path-alias', 'vendure-config.ts'),
|
|
18
18
|
logger: process.env.LOG ? debugLogger : noopLogger,
|
|
19
|
+
pathAdapter: {
|
|
20
|
+
transformTsConfigPathMappings: ({ phase, patterns }) => {
|
|
21
|
+
if (phase === 'loading') {
|
|
22
|
+
return patterns.map(pattern => {
|
|
23
|
+
return pattern.replace(/\/fixtures-path-alias/, '').replace(/.ts$/, '.js');
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
return patterns;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
},
|
|
19
30
|
});
|
|
20
31
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
expect(
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
const plugins = result.pluginInfo.sort((a, b) => a.name.localeCompare(b.name));
|
|
33
|
+
|
|
34
|
+
expect(plugins).toHaveLength(3);
|
|
35
|
+
|
|
36
|
+
expect(plugins[0].name).toBe('JsAliasedPlugin');
|
|
37
|
+
expect(plugins[0].dashboardEntryPath).toBe('./dashboard/index.tsx');
|
|
38
|
+
expect(plugins[0].sourcePluginPath).toBe(
|
|
39
|
+
join(__dirname, 'fixtures-path-alias', 'js-aliased', 'src', 'js-aliased.plugin.ts'),
|
|
40
|
+
);
|
|
41
|
+
expect(plugins[0].pluginPath).toBe(join(tempDir, 'js-aliased', 'src', 'js-aliased.plugin.js'));
|
|
42
|
+
|
|
43
|
+
expect(plugins[1].name).toBe('StarAliasedPlugin');
|
|
44
|
+
expect(plugins[1].dashboardEntryPath).toBe('./dashboard/index.tsx');
|
|
45
|
+
expect(plugins[1].sourcePluginPath).toBe(
|
|
46
|
+
join(__dirname, 'fixtures-path-alias', 'star-aliased', 'src', 'star-aliased.plugin.ts'),
|
|
47
|
+
);
|
|
48
|
+
expect(plugins[1].pluginPath).toBe(
|
|
49
|
+
join(tempDir, 'star-aliased', 'src', 'star-aliased.plugin.js'),
|
|
26
50
|
);
|
|
27
|
-
|
|
28
|
-
|
|
51
|
+
|
|
52
|
+
expect(plugins[2].name).toBe('TsAliasedPlugin');
|
|
53
|
+
expect(plugins[2].dashboardEntryPath).toBe('./dashboard/index.tsx');
|
|
54
|
+
expect(plugins[2].sourcePluginPath).toBe(
|
|
55
|
+
join(__dirname, 'fixtures-path-alias', 'ts-aliased', 'src', 'ts-aliased.plugin.ts'),
|
|
29
56
|
);
|
|
57
|
+
expect(plugins[2].pluginPath).toBe(join(tempDir, 'ts-aliased', 'src', 'ts-aliased.plugin.js'));
|
|
30
58
|
},
|
|
31
59
|
{ timeout: 10_000 },
|
|
32
60
|
);
|
package/vite/tests/tsconfig.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "NodeNext",
|
|
4
|
+
"sourceMap": true,
|
|
5
|
+
"jsx": "react-jsx",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@plugins/*": [
|
|
8
|
+
"./fixtures-path-alias/*"
|
|
9
|
+
],
|
|
10
|
+
"@other/ts-aliased": [
|
|
11
|
+
"./fixtures-path-alias/ts-aliased/index.ts"
|
|
12
|
+
],
|
|
13
|
+
"@other/js-aliased": [
|
|
14
|
+
"./fixtures-path-alias/js-aliased/index.js"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"exclude": [
|
|
19
|
+
"node_modules"
|
|
20
|
+
]
|
|
11
21
|
}
|
|
@@ -232,8 +232,11 @@ export async function analyzeSourceFiles(
|
|
|
232
232
|
importPath + '.js',
|
|
233
233
|
path.join(importPath, 'index.ts'),
|
|
234
234
|
path.join(importPath, 'index.js'),
|
|
235
|
+
importPath,
|
|
235
236
|
];
|
|
236
|
-
|
|
237
|
+
if (importPath.endsWith('.js')) {
|
|
238
|
+
possiblePaths.push(importPath.replace(/.js$/, '.ts'));
|
|
239
|
+
}
|
|
237
240
|
// Try each possible path
|
|
238
241
|
let found = false;
|
|
239
242
|
for (const possiblePath of possiblePaths) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/aliased.plugin';
|