@syncbridge/syncbuild 0.6.12 → 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.
@@ -44,14 +44,7 @@ export async function buildSources(context) {
44
44
  plugins: [],
45
45
  };
46
46
  if (context.tsconfig) {
47
- esbuildConfig.plugins?.push(esbuildTsc({
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: path.resolve(packageDir, config.outDir ?? './'),
25
- tmpDir: config.tempDir || fs.mkdtempSync(path.join(packageDir, 'tmp-')),
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 require = createRequire(path.join(context.tmpDir, 'index.js'));
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;
@@ -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 = false;
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.rmSync(context.tmpDir, {
33
- recursive: true,
34
- });
32
+ if (fs.existsSync(context.tmpDir))
33
+ fs.rmSync(context.tmpDir, {
34
+ recursive: true,
35
+ });
35
36
  }
36
37
  }
package/constants.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import process from 'node:process';
2
- export const version = '0.6.12';
2
+ export const version = '0.6.14';
3
3
  // Environment variables
4
4
  export const NODE_ENV = process.env.NODE_ENV === 'test'
5
5
  ? 'test'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncbridge/syncbuild",
3
- "version": "0.6.12",
3
+ "version": "0.6.14",
4
4
  "description": "SyncBridge Extension Package Builder",
5
5
  "author": "Panates Inc",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "typescript": "^6.0.2"
21
21
  },
22
22
  "peerDependencies": {
23
- "@syncbridge/common": "^0.6.12"
23
+ "@syncbridge/common": "^0.6.14"
24
24
  },
25
25
  "type": "module",
26
26
  "module": "./index.js",