@astral/pack 1.4.2 → 1.5.0

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.
@@ -13,10 +13,11 @@ const compileTs = (config) => {
13
13
  const execTs = (childProcess) => {
14
14
  const { promise, resolve, reject } = Promise.withResolvers();
15
15
  promises.push(promise);
16
- childProcess.on('error', (err) => {
17
- reject(err);
18
- });
19
- childProcess.on('exit', () => {
16
+ childProcess.on('exit', (code) => {
17
+ if (code !== 0) {
18
+ reject(new Error('Сборка ts файлов не удалась'));
19
+ return;
20
+ }
20
21
  resolve();
21
22
  });
22
23
  };
@@ -46,6 +46,9 @@ const initExportsGenerator = ({ packageExports, format, lang }) => (originPackag
46
46
  return packageJson;
47
47
  }
48
48
  const rootExports = {};
49
+ if (typeof rootExports === 'string') {
50
+ return originPackageJson;
51
+ }
49
52
  if (format.includes('esm')) {
50
53
  rootExports.module = './index.js';
51
54
  }
@@ -57,11 +57,16 @@ exports.validateConfig = v.object({
57
57
  return objectError;
58
58
  }
59
59
  const errors = Object.values(value)
60
- .map((exportValue) => v.object({
61
- require: v.string(),
62
- module: v.string(),
63
- types: v.string(),
64
- })(exportValue))
60
+ .map((exportValue) => {
61
+ if (typeof exportValue === 'string') {
62
+ return;
63
+ }
64
+ return v.object({
65
+ require: v.string(),
66
+ module: v.string(),
67
+ types: v.string(),
68
+ })(exportValue);
69
+ })
65
70
  .filter(Boolean);
66
71
  return errors[0];
67
72
  },
package/config/types.d.ts CHANGED
@@ -25,7 +25,7 @@ export type PackageExportsItem = {
25
25
  module: string;
26
26
  require: string;
27
27
  types: string;
28
- };
28
+ } | string;
29
29
  export type PackageExports = Record<string, PackageExportsItem>;
30
30
  export type PackConfig = {
31
31
  target: 'node' | 'web';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/pack",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "main": "./index.js",
5
5
  "bin": {
6
6
  "pack": "bin.js"