@syncbridge/syncbuild 0.6.10 → 0.6.14
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/builder/build-sources.js
CHANGED
|
@@ -44,14 +44,7 @@ export async function buildSources(context) {
|
|
|
44
44
|
plugins: [],
|
|
45
45
|
};
|
|
46
46
|
if (context.tsconfig) {
|
|
47
|
-
esbuildConfig.plugins
|
|
48
|
-
tsconfig: context.tsconfig,
|
|
49
|
-
overwriteConfig: cfg => {
|
|
50
|
-
cfg.compilerOptions = cfg.compilerOptions || {};
|
|
51
|
-
cfg.compilerOptions.declaration = true;
|
|
52
|
-
cfg.declarationDir = path.join(context.tmpDir, 'typings');
|
|
53
|
-
},
|
|
54
|
-
}));
|
|
47
|
+
esbuildConfig.plugins.push(esbuildTsc({ tsconfig: context.tsconfig }));
|
|
55
48
|
}
|
|
56
49
|
try {
|
|
57
50
|
await esbuild.build(esbuildConfig);
|
|
@@ -14,6 +14,8 @@ export function createContext(config) {
|
|
|
14
14
|
catch {
|
|
15
15
|
throw new SbError('package.json not found');
|
|
16
16
|
}
|
|
17
|
+
const outDir = path.resolve(packageDir, config.outDir ?? './');
|
|
18
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
17
19
|
const context = {
|
|
18
20
|
logger: config.logger,
|
|
19
21
|
config,
|
|
@@ -21,8 +23,8 @@ export function createContext(config) {
|
|
|
21
23
|
outPkgJson: deepClone(pkgJson),
|
|
22
24
|
cwd: process.cwd(),
|
|
23
25
|
packageDir,
|
|
24
|
-
outDir
|
|
25
|
-
tmpDir: config.tempDir || fs.mkdtempSync(path.join(
|
|
26
|
+
outDir,
|
|
27
|
+
tmpDir: config.tempDir || fs.mkdtempSync(path.join(outDir, 'tmp-')),
|
|
26
28
|
outEntryPoint: 'index.js',
|
|
27
29
|
entryPoint: pkgJson.module ?? pkgJson.main ?? 'index.js',
|
|
28
30
|
outFile: pkgJson.name.replace(/^@/, '').replace(/\//g, '-') +
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
-
import { createRequire } from 'node:module';
|
|
4
3
|
import path from 'node:path';
|
|
5
4
|
import { COMPONENT_OPTIONS, PROCESSOR_OPTIONS } from '@syncbridge/common';
|
|
6
5
|
import { resolvePromisesDeep } from './utils/resolve-promises.js';
|
|
7
6
|
export async function extractExports(context) {
|
|
8
7
|
const { outPkgJson } = context;
|
|
9
|
-
const
|
|
10
|
-
const pkgGlobal = await require('./' + context.outEntryPoint);
|
|
8
|
+
const pkgGlobal = await import(path.join(context.tmpDir, context.outEntryPoint));
|
|
11
9
|
for (const [k, v] of Object.entries(pkgGlobal)) {
|
|
12
10
|
if (typeof v !== 'function')
|
|
13
11
|
continue;
|
package/builder/read-tsconfig.js
CHANGED
|
@@ -8,11 +8,13 @@ export function readTsconfig(context) {
|
|
|
8
8
|
context.tsconfig = esbuildTsc.parseTsConfig(tsconfigPath, {
|
|
9
9
|
overwriteConfig: cfg => {
|
|
10
10
|
cfg.compilerOptions = cfg.compilerOptions || {};
|
|
11
|
-
cfg.compilerOptions.sourceMap =
|
|
11
|
+
cfg.compilerOptions.sourceMap = true;
|
|
12
|
+
cfg.compilerOptions.module = 'ESNext';
|
|
13
|
+
cfg.compilerOptions.target = 'ESNext';
|
|
12
14
|
cfg.compilerOptions.declarationDir = path.join(context.tmpDir, 'typings');
|
|
13
15
|
},
|
|
14
16
|
});
|
|
15
17
|
const dtsRoot = path.join(context.packageDir, context.entryPoint.replace(/\.ts$/, '.d.ts'));
|
|
16
|
-
context.outPkgJson.types = path.relative(context.tsconfig.options.rootDir, dtsRoot);
|
|
18
|
+
context.outPkgJson.types = path.relative(context.tsconfig.options.rootDir || tsconfigPath, dtsRoot);
|
|
17
19
|
}
|
|
18
20
|
}
|
package/bundle-package.js
CHANGED
|
@@ -29,8 +29,9 @@ export async function bundlePackage(config) {
|
|
|
29
29
|
context.logger?.(`Generated ${colors.magenta(path.basename(zipFileName))}`);
|
|
30
30
|
}
|
|
31
31
|
finally {
|
|
32
|
-
fs.
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (fs.existsSync(context.tmpDir))
|
|
33
|
+
fs.rmSync(context.tmpDir, {
|
|
34
|
+
recursive: true,
|
|
35
|
+
});
|
|
35
36
|
}
|
|
36
37
|
}
|
package/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncbridge/syncbuild",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14",
|
|
4
4
|
"description": "SyncBridge Extension Package Builder",
|
|
5
5
|
"author": "Panates Inc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
"ansi-colors": "^4.1.3",
|
|
11
11
|
"commander": "^14.0.3",
|
|
12
12
|
"cross-dirname": "^0.1.0",
|
|
13
|
-
"esbuild": "^0.27.
|
|
13
|
+
"esbuild": "^0.27.4",
|
|
14
14
|
"fast-glob": "^3.3.3",
|
|
15
15
|
"jsonc-parser": "^3.3.1",
|
|
16
16
|
"putil-varhelpers": "^1.7.0",
|
|
17
17
|
"reflect-metadata": "^0.2.2",
|
|
18
18
|
"rimraf": "^6.1.3",
|
|
19
|
-
"ts-gems": "^3.11.
|
|
20
|
-
"typescript": "^
|
|
19
|
+
"ts-gems": "^3.11.5",
|
|
20
|
+
"typescript": "^6.0.2"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@syncbridge/common": "^0.6.
|
|
23
|
+
"@syncbridge/common": "^0.6.14"
|
|
24
24
|
},
|
|
25
25
|
"type": "module",
|
|
26
26
|
"module": "./index.js",
|