Skip to content

Commit a2e2850

Browse files
committed
Fix CDS extractor esbuild for shell-quote
1 parent d396a94 commit a2e2850

File tree

3 files changed

+37
-16
lines changed

3 files changed

+37
-16
lines changed

extractors/cds/tools/dist/cds-extractor.bundle.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extractors/cds/tools/dist/cds-extractor.bundle.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extractors/cds/tools/esbuild.config.mjs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
import { statSync } from 'fs';
2+
import { resolve } from 'path';
23

34
import { build as esbuildFunc } from 'esbuild';
45

56
const NODE_VERSION_TARGET = 'node18';
67

8+
// Plugin to handle shell-quote module resolution
9+
const shellQuotePlugin = {
10+
name: 'shell-quote-fix',
11+
setup(build) {
12+
// Handle shell-quote internal module resolution
13+
build.onResolve({ filter: /^\.\/quote$/ }, args => {
14+
if (args.importer.includes('shell-quote')) {
15+
return { path: resolve(args.resolveDir, 'quote.js') };
16+
}
17+
});
18+
19+
build.onResolve({ filter: /^\.\/parse$/ }, args => {
20+
if (args.importer.includes('shell-quote')) {
21+
return { path: resolve(args.resolveDir, 'parse.js') };
22+
}
23+
});
24+
},
25+
};
26+
727
const buildOptions = {
828
banner: {
929
js: '#!/usr/bin/env node',
@@ -27,7 +47,6 @@ const buildOptions = {
2747
'path',
2848
'process',
2949
'readline',
30-
'shell-quote',
3150
'stream',
3251
'tls',
3352
'url',
@@ -46,8 +65,10 @@ const buildOptions = {
4665
minify: true,
4766
outfile: 'dist/cds-extractor.bundle.js',
4867
platform: 'node',
68+
// Plugin to handle shell-quote module resolution
69+
plugins: [shellQuotePlugin],
4970
// Resolve TypeScript paths
50-
resolveExtensions: ['.ts'],
71+
resolveExtensions: ['.ts', '.js'],
5172
sourcemap: true,
5273
target: NODE_VERSION_TARGET,
5374
};

0 commit comments

Comments
 (0)