jiek 2.3.3 → 2.3.4

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.
Files changed (77) hide show
  1. package/dist/.internal/.chunks/{filterSupport.4rM7f6jB.cjs → getWD.Bdo2NGCR.cjs} +30 -30
  2. package/dist/.internal/.chunks/{filterSupport.BXWpLBpT.js → getWD.DGvwAHMY.js} +29 -29
  3. package/dist/.internal/.chunks/{loadConfig.OOKddvHF.cjs → loadConfig.8xhNFEJe.cjs} +30 -12
  4. package/dist/.internal/.chunks/{loadConfig.CFfzkm_p.js → loadConfig.BjzxLOdC.js} +26 -9
  5. package/dist/.internal/bin/common.cjs +90 -97
  6. package/dist/.internal/bin/common.js +91 -98
  7. package/dist/.internal/bin/parseArgv.cjs +2 -2
  8. package/dist/.internal/bin/parseArgv.js +2 -2
  9. package/dist/.internal/commands/utils/createAreaManagement.cjs +108 -0
  10. package/dist/.internal/commands/utils/createAreaManagement.d.cts +18 -0
  11. package/dist/.internal/commands/utils/createAreaManagement.d.ts +18 -0
  12. package/dist/.internal/commands/utils/createAreaManagement.js +106 -0
  13. package/dist/.internal/polyfill.cjs +13 -0
  14. package/dist/.internal/polyfill.d.cts +1 -0
  15. package/dist/.internal/polyfill.d.ts +1 -0
  16. package/dist/.internal/polyfill.js +11 -0
  17. package/dist/.internal/utils/filterSupport.cjs +1 -1
  18. package/dist/.internal/utils/filterSupport.js +2 -2
  19. package/dist/.internal/utils/loadConfig.cjs +3 -3
  20. package/dist/.internal/utils/loadConfig.d.cts +1 -0
  21. package/dist/.internal/utils/loadConfig.d.ts +1 -0
  22. package/dist/.internal/utils/loadConfig.js +4 -4
  23. package/dist/.internal/utils/pascalCase.cjs +5 -0
  24. package/dist/.internal/utils/pascalCase.d.cts +3 -0
  25. package/dist/.internal/utils/pascalCase.d.ts +3 -0
  26. package/dist/.internal/utils/pascalCase.js +3 -0
  27. package/dist/.internal/utils/reveal.cjs +9 -0
  28. package/dist/.internal/utils/reveal.d.cts +3 -0
  29. package/dist/.internal/utils/reveal.d.ts +3 -0
  30. package/dist/.internal/utils/reveal.js +7 -0
  31. package/dist/bin/index.cjs +101 -43
  32. package/dist/index.d.cts +7 -0
  33. package/dist/index.d.ts +7 -0
  34. package/dist/rollup/index.cjs +16 -18
  35. package/dist/rollup/index.js +13 -15
  36. package/package.json +2 -2
  37. package/src/bin/build.cts +0 -5
  38. package/src/bin/common.ts +0 -3
  39. package/src/bin/index.cts +0 -7
  40. package/src/bin/parseArgv.ts +0 -26
  41. package/src/bridge.ts +0 -46
  42. package/src/commands/base.ts +0 -18
  43. package/src/commands/build/analyzer.ts +0 -122
  44. package/src/commands/build/client/analyzer.tsx +0 -121
  45. package/src/commands/build/client/index.ts +0 -26
  46. package/src/commands/build.ts +0 -544
  47. package/src/commands/descriptions.ts +0 -17
  48. package/src/commands/meta.ts +0 -5
  49. package/src/commands/publish.ts +0 -628
  50. package/src/commands/utils/optionParser.ts +0 -4
  51. package/src/index.ts +0 -12
  52. package/src/inner.ts +0 -11
  53. package/src/rollup/base.ts +0 -152
  54. package/src/rollup/bundle-analyzer.ts +0 -62
  55. package/src/rollup/index.ts +0 -893
  56. package/src/rollup/plugins/create-require.ts +0 -23
  57. package/src/rollup/plugins/progress.ts +0 -26
  58. package/src/rollup/plugins/replace.ts +0 -185
  59. package/src/rollup/plugins/skip.ts +0 -21
  60. package/src/rollup/plugins/with-external.ts +0 -23
  61. package/src/rollup/utils/commonOptions.ts +0 -9
  62. package/src/rollup/utils/externalResolver.ts +0 -47
  63. package/src/rollup/utils/globalResolver.ts +0 -13
  64. package/src/rollup/utils/withMinify.ts +0 -18
  65. package/src/rollup-plugin-utils.ts +0 -32
  66. package/src/server.ts +0 -30
  67. package/src/utils/checkDependency.ts +0 -26
  68. package/src/utils/filterSupport.ts +0 -90
  69. package/src/utils/getInternalModuleName.ts +0 -5
  70. package/src/utils/getRoot.ts +0 -14
  71. package/src/utils/getWD.ts +0 -31
  72. package/src/utils/intersection.ts +0 -1
  73. package/src/utils/loadConfig.ts +0 -108
  74. package/src/utils/recursiveListFiles.ts +0 -13
  75. package/src/utils/resolveExports.ts +0 -165
  76. package/src/utils/ts.ts +0 -94
  77. package/src/utils/tsRegister.ts +0 -22
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ const createAreaManagement = (options) => {
4
+ const { outputLines } = options;
5
+ let i = 0;
6
+ const areaSizeList = [];
7
+ function create({
8
+ maxSize: inputMaxSize = options.maxSize ?? 3,
9
+ header,
10
+ footer
11
+ } = {}) {
12
+ const current = i++;
13
+ const hasHeader = header !== void 0;
14
+ const hasFooter = footer !== void 0;
15
+ areaSizeList.push(hasHeader ? 1 : 0);
16
+ const waitLogLines = [];
17
+ let isExited = false;
18
+ const noLogLines = Promise.withResolvers();
19
+ const update = () => {
20
+ if (waitLogLines.length === 0) {
21
+ if (isExited) noLogLines.resolve();
22
+ return;
23
+ }
24
+ const maxSize = inputMaxSize + (hasHeader ? 1 : 0) + (hasFooter ? 1 : 0);
25
+ const offset = areaSizeList.reduce((acc, size, index) => {
26
+ if (index < current) {
27
+ return acc + size;
28
+ }
29
+ return acc;
30
+ }, 0);
31
+ const contentLogLines = waitLogLines.splice(0, maxSize);
32
+ const currentLogLines = [
33
+ ...hasHeader ? [header] : [],
34
+ ...contentLogLines,
35
+ ...hasFooter ? [footer] : []
36
+ ];
37
+ const curLen = currentLogLines.length;
38
+ if (hasFooter && curLen > 0) {
39
+ const prevAreaSize = areaSizeList[current];
40
+ areaSizeList[current] -= outputLines.splice(offset + prevAreaSize - 1, 1).length;
41
+ }
42
+ for (let i2 = 0; i2 < curLen; i2++) {
43
+ const isHeader = hasHeader && i2 === 0;
44
+ const isFooter = hasFooter && i2 === curLen - 1;
45
+ const line = currentLogLines.shift();
46
+ const areaSize = areaSizeList[current];
47
+ let insertIndex = i2;
48
+ if (areaSize < maxSize) {
49
+ insertIndex = areaSize - (hasFooter ? 1 : 0);
50
+ if (!isHeader) {
51
+ areaSizeList[current]++;
52
+ }
53
+ }
54
+ if (areaSize === maxSize) {
55
+ outputLines.splice(
56
+ offset + (hasHeader ? 1 : 0),
57
+ 1
58
+ );
59
+ insertIndex = maxSize - 1;
60
+ if (isFooter) {
61
+ insertIndex = insertIndex - 1;
62
+ }
63
+ }
64
+ if (isHeader) {
65
+ outputLines[offset] = line;
66
+ } else {
67
+ insertIndex += hasHeader ? 1 : 0;
68
+ outputLines.splice(
69
+ offset + insertIndex,
70
+ 0,
71
+ line
72
+ );
73
+ }
74
+ }
75
+ options.onAreaUpdate?.();
76
+ };
77
+ const timer = setInterval(update, 10);
78
+ return {
79
+ exit: async () => {
80
+ if (waitLogLines.length !== 0) {
81
+ isExited = true;
82
+ await noLogLines.promise;
83
+ }
84
+ clearTimeout(timer);
85
+ },
86
+ info: (message) => {
87
+ waitLogLines.push(...message.split("\n").filter((s) => s.trim() !== ""));
88
+ },
89
+ setHeader: (newHeader) => {
90
+ if (header == null) {
91
+ throw new Error('You can only set header when header is already, use create({ header: "header" })');
92
+ }
93
+ header = newHeader;
94
+ update();
95
+ },
96
+ setFooter: (newFooter) => {
97
+ if (footer == null) {
98
+ throw new Error('You can only set footer when footer is already, use create({ footer: "footer" })');
99
+ }
100
+ footer = newFooter;
101
+ update();
102
+ }
103
+ };
104
+ }
105
+ return { create };
106
+ };
107
+
108
+ exports.createAreaManagement = createAreaManagement;
@@ -0,0 +1,18 @@
1
+ declare const createAreaManagement: (options: {
2
+ outputLines: string[];
3
+ onAreaUpdate?: () => void;
4
+ maxSize?: number;
5
+ }) => {
6
+ create: ({ maxSize: inputMaxSize, header, footer }?: {
7
+ maxSize?: number;
8
+ header?: string;
9
+ footer?: string;
10
+ }) => {
11
+ exit: () => Promise<void>;
12
+ info: (message: string) => void;
13
+ setHeader: (newHeader: string) => void;
14
+ setFooter: (newFooter: string) => void;
15
+ };
16
+ };
17
+
18
+ export { createAreaManagement };
@@ -0,0 +1,18 @@
1
+ declare const createAreaManagement: (options: {
2
+ outputLines: string[];
3
+ onAreaUpdate?: () => void;
4
+ maxSize?: number;
5
+ }) => {
6
+ create: ({ maxSize: inputMaxSize, header, footer }?: {
7
+ maxSize?: number;
8
+ header?: string;
9
+ footer?: string;
10
+ }) => {
11
+ exit: () => Promise<void>;
12
+ info: (message: string) => void;
13
+ setHeader: (newHeader: string) => void;
14
+ setFooter: (newFooter: string) => void;
15
+ };
16
+ };
17
+
18
+ export { createAreaManagement };
@@ -0,0 +1,106 @@
1
+ const createAreaManagement = (options) => {
2
+ const { outputLines } = options;
3
+ let i = 0;
4
+ const areaSizeList = [];
5
+ function create({
6
+ maxSize: inputMaxSize = options.maxSize ?? 3,
7
+ header,
8
+ footer
9
+ } = {}) {
10
+ const current = i++;
11
+ const hasHeader = header !== void 0;
12
+ const hasFooter = footer !== void 0;
13
+ areaSizeList.push(hasHeader ? 1 : 0);
14
+ const waitLogLines = [];
15
+ let isExited = false;
16
+ const noLogLines = Promise.withResolvers();
17
+ const update = () => {
18
+ if (waitLogLines.length === 0) {
19
+ if (isExited) noLogLines.resolve();
20
+ return;
21
+ }
22
+ const maxSize = inputMaxSize + (hasHeader ? 1 : 0) + (hasFooter ? 1 : 0);
23
+ const offset = areaSizeList.reduce((acc, size, index) => {
24
+ if (index < current) {
25
+ return acc + size;
26
+ }
27
+ return acc;
28
+ }, 0);
29
+ const contentLogLines = waitLogLines.splice(0, maxSize);
30
+ const currentLogLines = [
31
+ ...hasHeader ? [header] : [],
32
+ ...contentLogLines,
33
+ ...hasFooter ? [footer] : []
34
+ ];
35
+ const curLen = currentLogLines.length;
36
+ if (hasFooter && curLen > 0) {
37
+ const prevAreaSize = areaSizeList[current];
38
+ areaSizeList[current] -= outputLines.splice(offset + prevAreaSize - 1, 1).length;
39
+ }
40
+ for (let i2 = 0; i2 < curLen; i2++) {
41
+ const isHeader = hasHeader && i2 === 0;
42
+ const isFooter = hasFooter && i2 === curLen - 1;
43
+ const line = currentLogLines.shift();
44
+ const areaSize = areaSizeList[current];
45
+ let insertIndex = i2;
46
+ if (areaSize < maxSize) {
47
+ insertIndex = areaSize - (hasFooter ? 1 : 0);
48
+ if (!isHeader) {
49
+ areaSizeList[current]++;
50
+ }
51
+ }
52
+ if (areaSize === maxSize) {
53
+ outputLines.splice(
54
+ offset + (hasHeader ? 1 : 0),
55
+ 1
56
+ );
57
+ insertIndex = maxSize - 1;
58
+ if (isFooter) {
59
+ insertIndex = insertIndex - 1;
60
+ }
61
+ }
62
+ if (isHeader) {
63
+ outputLines[offset] = line;
64
+ } else {
65
+ insertIndex += hasHeader ? 1 : 0;
66
+ outputLines.splice(
67
+ offset + insertIndex,
68
+ 0,
69
+ line
70
+ );
71
+ }
72
+ }
73
+ options.onAreaUpdate?.();
74
+ };
75
+ const timer = setInterval(update, 10);
76
+ return {
77
+ exit: async () => {
78
+ if (waitLogLines.length !== 0) {
79
+ isExited = true;
80
+ await noLogLines.promise;
81
+ }
82
+ clearTimeout(timer);
83
+ },
84
+ info: (message) => {
85
+ waitLogLines.push(...message.split("\n").filter((s) => s.trim() !== ""));
86
+ },
87
+ setHeader: (newHeader) => {
88
+ if (header == null) {
89
+ throw new Error('You can only set header when header is already, use create({ header: "header" })');
90
+ }
91
+ header = newHeader;
92
+ update();
93
+ },
94
+ setFooter: (newFooter) => {
95
+ if (footer == null) {
96
+ throw new Error('You can only set footer when footer is already, use create({ footer: "footer" })');
97
+ }
98
+ footer = newFooter;
99
+ update();
100
+ }
101
+ };
102
+ }
103
+ return { create };
104
+ };
105
+
106
+ export { createAreaManagement };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ if (typeof Promise.withResolvers === "undefined") {
4
+ Promise.withResolvers = () => {
5
+ let resolve;
6
+ let reject;
7
+ const promise = new Promise((res, rej) => {
8
+ resolve = res;
9
+ reject = rej;
10
+ });
11
+ return { promise, resolve, reject };
12
+ };
13
+ }
@@ -0,0 +1 @@
1
+ export { }
@@ -0,0 +1 @@
1
+ export { }
@@ -0,0 +1,11 @@
1
+ if (typeof Promise.withResolvers === "undefined") {
2
+ Promise.withResolvers = () => {
3
+ let resolve;
4
+ let reject;
5
+ const promise = new Promise((res, rej) => {
6
+ resolve = res;
7
+ reject = rej;
8
+ });
9
+ return { promise, resolve, reject };
10
+ };
11
+ }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var filterSupport = require('../.chunks/filterSupport.4rM7f6jB.cjs');
3
+ var filterSupport = require('../.chunks/getWD.Bdo2NGCR.cjs');
4
4
  require('node:fs');
5
5
  require('node:path');
6
6
  require('node:process');
@@ -1,8 +1,8 @@
1
- export { f as filterPackagesGraph, a as getSelectedProjectsGraph, t as type } from '../.chunks/filterSupport.BXWpLBpT.js';
1
+ export { f as filterPackagesGraph, a as getSelectedProjectsGraph, t as type } from '../.chunks/getWD.DGvwAHMY.js';
2
2
  import 'node:fs';
3
3
  import 'node:path';
4
4
  import 'node:process';
5
5
  import 'commander';
6
6
  import 'js-yaml';
7
- import 'node:module';
8
7
  import '@jiek/utils/getWorkspaceDir';
8
+ import 'node:module';
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- require('../.chunks/filterSupport.4rM7f6jB.cjs');
3
+ require('../.chunks/getWD.Bdo2NGCR.cjs');
4
4
  require('node:fs');
5
5
  require('node:path');
6
+ require('node:process');
6
7
  require('commander');
7
8
  require('js-yaml');
8
- var loadConfig = require('../.chunks/loadConfig.OOKddvHF.cjs');
9
- require('node:process');
9
+ var loadConfig = require('../.chunks/loadConfig.8xhNFEJe.cjs');
10
10
  require('@jiek/utils/getWorkspaceDir');
11
11
 
12
12
 
@@ -3,6 +3,7 @@ import { Config } from 'jiek';
3
3
  interface LoadConfigOptions {
4
4
  dir?: string;
5
5
  root?: string;
6
+ configPath?: string;
6
7
  }
7
8
  declare function loadConfig(options?: LoadConfigOptions): Config;
8
9
  declare function loadConfig(dir?: string): Config;
@@ -3,6 +3,7 @@ import { Config } from 'jiek';
3
3
  interface LoadConfigOptions {
4
4
  dir?: string;
5
5
  root?: string;
6
+ configPath?: string;
6
7
  }
7
8
  declare function loadConfig(options?: LoadConfigOptions): Config;
8
9
  declare function loadConfig(dir?: string): Config;
@@ -1,9 +1,9 @@
1
- import '../.chunks/filterSupport.BXWpLBpT.js';
1
+ import '../.chunks/getWD.DGvwAHMY.js';
2
2
  import 'node:fs';
3
3
  import 'node:path';
4
+ import 'node:process';
4
5
  import 'commander';
5
6
  import 'js-yaml';
6
- export { l as loadConfig } from '../.chunks/loadConfig.CFfzkm_p.js';
7
- import 'node:module';
8
- import 'node:process';
7
+ export { l as loadConfig } from '../.chunks/loadConfig.BjzxLOdC.js';
9
8
  import '@jiek/utils/getWorkspaceDir';
9
+ import 'node:module';
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const pascalCase = (str) => str.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase()).replace(/(?:^|-)(\w)/g, (_, $1) => $1.toUpperCase());
4
+
5
+ exports.pascalCase = pascalCase;
@@ -0,0 +1,3 @@
1
+ declare const pascalCase: (str: string) => string;
2
+
3
+ export { pascalCase };
@@ -0,0 +1,3 @@
1
+ declare const pascalCase: (str: string) => string;
2
+
3
+ export { pascalCase };
@@ -0,0 +1,3 @@
1
+ const pascalCase = (str) => str.replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase()).replace(/(?:^|-)(\w)/g, (_, $1) => $1.toUpperCase());
2
+
3
+ export { pascalCase };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const reveal = (obj, keys) => keys.reduce((acc, key) => {
4
+ if (typeof acc === "string") throw new Error("key not found in exports");
5
+ if (!(key in acc)) throw new Error(`key ${key} not found in exports`);
6
+ return acc[key];
7
+ }, obj);
8
+
9
+ exports.reveal = reveal;
@@ -0,0 +1,3 @@
1
+ declare const reveal: (obj: string | Record<string, unknown>, keys: string[]) => string | Record<string, unknown>;
2
+
3
+ export { reveal };
@@ -0,0 +1,3 @@
1
+ declare const reveal: (obj: string | Record<string, unknown>, keys: string[]) => string | Record<string, unknown>;
2
+
3
+ export { reveal };
@@ -0,0 +1,7 @@
1
+ const reveal = (obj, keys) => keys.reduce((acc, key) => {
2
+ if (typeof acc === "string") throw new Error("key not found in exports");
3
+ if (!(key in acc)) throw new Error(`key ${key} not found in exports`);
4
+ return acc[key];
5
+ }, obj);
6
+
7
+ export { reveal };
@@ -1,41 +1,25 @@
1
1
  'use strict';
2
2
 
3
- require('#~/bin/common');
4
- var childProcess = require('node:child_process');
3
+ require('#~/polyfill');
4
+ var node_child_process = require('node:child_process');
5
5
  var fs = require('node:fs');
6
6
  var path = require('node:path');
7
7
  var process = require('node:process');
8
- var bumper = require('@jiek/utils/bumper');
8
+ var cliProgress = require('cli-progress');
9
9
  var commander = require('commander');
10
10
  var detectIndent = require('detect-indent');
11
11
  var jsoncParser = require('jsonc-parser');
12
+ var bumper = require('@jiek/utils/bumper');
13
+ var createAreaManagement = require('#~/commands/utils/createAreaManagement');
12
14
  var filterSupport = require('#~/utils/filterSupport');
15
+ var getInternalModuleName = require('#~/utils/getInternalModuleName');
13
16
  var loadConfig = require('#~/utils/loadConfig');
14
17
  var resolveExports = require('#~/utils/resolveExports');
15
- var getInternalModuleName = require('#~/utils/getInternalModuleName');
18
+ require('#~/bin/common');
16
19
  var parseArgv = require('#~/bin/parseArgv');
17
20
 
18
21
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
22
 
20
- function _interopNamespace(e) {
21
- if (e && e.__esModule) return e;
22
- var n = Object.create(null);
23
- if (e) {
24
- Object.keys(e).forEach(function (k) {
25
- if (k !== 'default') {
26
- var d = Object.getOwnPropertyDescriptor(e, k);
27
- Object.defineProperty(n, k, d.get ? d : {
28
- enumerable: true,
29
- get: function () { return e[k]; }
30
- });
31
- }
32
- });
33
- }
34
- n.default = e;
35
- return Object.freeze(n);
36
- }
37
-
38
- var childProcess__namespace = /*#__PURE__*/_interopNamespace(childProcess);
39
23
  var fs__default = /*#__PURE__*/_interopDefault(fs);
40
24
  var path__default = /*#__PURE__*/_interopDefault(path);
41
25
  var process__default = /*#__PURE__*/_interopDefault(process);
@@ -52,23 +36,31 @@ const description = `
52
36
  Publish package to npm registry, and auto generate exports field and other fields in published package.json.
53
37
  If you want to through the options to the \`pnpm publish\` command, you can pass the options after '--'.
54
38
  `.trim();
55
- async function forEachSelectedProjectsGraphEntries(callback) {
39
+ async function forEachSelectedProjectsGraphEntries(callback, selectedProjectsGraphEntriesCallback) {
56
40
  const { value = {} } = await filterSupport.getSelectedProjectsGraph() ?? {};
57
41
  const selectedProjectsGraphEntries = Object.entries(value);
58
42
  if (selectedProjectsGraphEntries.length === 0) {
59
43
  throw new Error("no packages selected");
60
44
  }
61
- for (const [dir, manifest] of selectedProjectsGraphEntries) {
62
- callback(dir, manifest);
63
- }
45
+ await selectedProjectsGraphEntriesCallback?.(selectedProjectsGraphEntries);
46
+ const tasks = selectedProjectsGraphEntries.map(
47
+ async ([dir, manifest], index, entries) => callback(
48
+ dir,
49
+ manifest,
50
+ index,
51
+ entries
52
+ )
53
+ );
54
+ await Promise.all(tasks);
64
55
  }
65
56
  const attachPublishOptions = (command) => command.option("-b, --bumper <bumper>", "bump version", "patch").option("-no-b, --no-bumper", "no bump version").option("-o, --outdir <OUTDIR>", outdirDescription, String, "dist").option("--skipJS", 'skip entries which end with ".js"');
66
57
  attachPublishOptions(
67
58
  commander.program.command("publish").description(description).aliases(["pub", "p"])
68
- ).action(async ({
59
+ ).option("--no-parallel", "Disable parallel publish").action(async ({
69
60
  outdir,
70
- bumper: bumper$1,
71
- skipJS
61
+ bumper,
62
+ skipJS,
63
+ parallel
72
64
  }) => {
73
65
  let shouldPassThrough = false;
74
66
  const passThroughOptions = process__default.default.argv.reduce(
@@ -83,23 +75,89 @@ attachPublishOptions(
83
75
  },
84
76
  []
85
77
  );
86
- await forEachSelectedProjectsGraphEntries((dir) => {
87
- const args = ["pnpm", "publish", "--access", "public", "--no-git-checks"];
88
- if (bumper$1 && bumper.TAGS.includes(bumper$1)) {
89
- args.push("--tag", bumper$1);
78
+ const mb = new cliProgress.MultiBar({
79
+ hideCursor: true,
80
+ format: "{message}"
81
+ });
82
+ const bars = {};
83
+ const outputLines = [];
84
+ function render() {
85
+ let i;
86
+ for (i = 0; i < outputLines.length; i++) {
87
+ let bar = bars[i];
88
+ if (!bar) {
89
+ bars[i] = bar = mb.create(0, 0, { message: "" });
90
+ }
91
+ bar.update({ message: outputLines[i] });
92
+ }
93
+ for (; i < Object.keys(bars).length; i++) {
94
+ mb.remove(bars[i]);
90
95
  }
96
+ }
97
+ const areaManagement = parallel ? createAreaManagement.createAreaManagement({
98
+ maxSize: 5,
99
+ outputLines,
100
+ onAreaUpdate: render
101
+ }) : void 0;
102
+ await forEachSelectedProjectsGraphEntries(async (dir, { name }) => {
103
+ const relativePath = path__default.default.relative(process__default.default.cwd(), dir);
104
+ const config = loadConfig.loadConfig(dir);
105
+ const { parallel: genParallelConfig } = config.publish ?? {};
106
+ const args = ["pnpm", "publish"];
91
107
  args.push(...passThroughOptions);
92
- childProcess__namespace.execSync(args.join(" "), {
93
- cwd: dir,
94
- stdio: "inherit",
95
- env: {
96
- ...process__default.default.env,
97
- JIEK_PUBLISH_OUTDIR: JSON.stringify(outdir),
98
- JIEK_PUBLISH_BUMPER: JSON.stringify(bumper$1),
99
- JIEK_PUBLISH_SKIP_JS: JSON.stringify(skipJS)
108
+ const env = {
109
+ ...process__default.default.env,
110
+ JIEK_PUBLISH_OUTDIR: JSON.stringify(outdir),
111
+ JIEK_PUBLISH_BUMPER: JSON.stringify(bumper),
112
+ JIEK_PUBLISH_SKIP_JS: JSON.stringify(skipJS)
113
+ };
114
+ const tag = bumper === false || ["minor", "major", "patch"].includes(bumper) ? "latest" : bumper;
115
+ const parallelConfig = parallel ? genParallelConfig?.(tag) : {};
116
+ async function pubByPnpm(type, attachArgs = [], isReady = false) {
117
+ const area = areaManagement?.create({
118
+ header: `\u250C publishing [${name}${type ? `@${type}` : ""}] ./${relativePath}`,
119
+ footer: "\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
120
+ });
121
+ const info = (message) => area?.info(
122
+ message.trim().split("\n").map((s) => `\u2502 ${s}`).join("\n")
123
+ );
124
+ area && info("waiting for ready...");
125
+ isReady && await isReady;
126
+ const child = node_child_process.exec(
127
+ [...args, ...attachArgs, "--tag", type ?? tag].join(" "),
128
+ { cwd: dir, windowsHide: true, env }
129
+ );
130
+ try {
131
+ if (area) {
132
+ child.stdout?.on("data", (data) => info(data));
133
+ child.stderr?.on("data", (data) => info(data));
134
+ } else {
135
+ child.stdout?.pipe(process__default.default.stdout);
136
+ child.stderr?.pipe(process__default.default.stderr);
137
+ }
138
+ } finally {
139
+ await new Promise((resolve) => {
140
+ child.once("exit", (code) => {
141
+ if (code === 0) {
142
+ resolve();
143
+ } else {
144
+ info(`pnpm publish exited with code ${code}`);
145
+ resolve();
146
+ }
147
+ });
148
+ });
149
+ await area?.exit();
100
150
  }
101
- });
151
+ }
152
+ const buildEnd = Promise.withResolvers();
153
+ await Promise.all([
154
+ pubByPnpm().then(() => buildEnd.resolve()).catch((e) => buildEnd.reject(e)),
155
+ ...Object.entries(parallelConfig ?? {}).map(async ([type]) => {
156
+ await pubByPnpm(type, ["--ignore-scripts"], buildEnd.promise);
157
+ })
158
+ ]);
102
159
  });
160
+ mb.stop();
103
161
  });
104
162
  async function prepublish({
105
163
  bumper: bumper$1,
package/dist/index.d.cts CHANGED
@@ -35,6 +35,12 @@ declare module 'jiek' {
35
35
  * @default true
36
36
  */
37
37
  withSource?: boolean;
38
+ parallel?: (tag: string) => false | void | null | Record<string, {
39
+ include?: string[];
40
+ overrideInclude?: string[];
41
+ exclude?: string[];
42
+ overrideExclude?: string[];
43
+ }>;
38
44
  };
39
45
  }
40
46
  }
@@ -42,6 +48,7 @@ declare module 'jiek' {
42
48
  interface ConfigExperimental {
43
49
  }
44
50
  interface Config {
51
+ extends?: string;
45
52
  experimental?: ConfigExperimental;
46
53
  }
47
54
  declare const defineConfig: (config: Config) => Config;
package/dist/index.d.ts CHANGED
@@ -35,6 +35,12 @@ declare module 'jiek' {
35
35
  * @default true
36
36
  */
37
37
  withSource?: boolean;
38
+ parallel?: (tag: string) => false | void | null | Record<string, {
39
+ include?: string[];
40
+ overrideInclude?: string[];
41
+ exclude?: string[];
42
+ overrideExclude?: string[];
43
+ }>;
38
44
  };
39
45
  }
40
46
  }
@@ -42,6 +48,7 @@ declare module 'jiek' {
42
48
  interface ConfigExperimental {
43
49
  }
44
50
  interface Config {
51
+ extends?: string;
45
52
  experimental?: ConfigExperimental;
46
53
  }
47
54
  declare const defineConfig: (config: Config) => Config;