jiek 2.2.7-alpha.3 → 2.2.7-alpha.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 (58) hide show
  1. package/.jiek-production-tag +0 -0
  2. package/dist/.internal/.chunks/{getWD.ZF0avqDB.cjs → filterSupport.4rM7f6jB.cjs} +38 -29
  3. package/dist/.internal/.chunks/{getWD.D6wq8Qc2.js → filterSupport.BXWpLBpT.js} +37 -28
  4. package/dist/.internal/.chunks/loadConfig.CFfzkm_p.js +110 -0
  5. package/dist/.internal/.chunks/loadConfig.OOKddvHF.cjs +117 -0
  6. package/dist/.internal/bin/common.cjs +743 -0
  7. package/dist/.internal/bin/common.d.cts +18 -0
  8. package/dist/.internal/bin/common.d.ts +18 -0
  9. package/dist/.internal/bin/common.js +736 -0
  10. package/dist/.internal/utils/filterSupport.cjs +1 -3
  11. package/dist/.internal/utils/filterSupport.js +1 -3
  12. package/dist/.internal/utils/loadConfig.cjs +8 -94
  13. package/dist/.internal/utils/loadConfig.js +7 -92
  14. package/dist/bin/build.cjs +2 -507
  15. package/dist/bin/index.cjs +5 -1
  16. package/package.json +1 -1
  17. package/src/bin/build.cts +2 -8
  18. package/src/bin/common.ts +3 -0
  19. package/src/bin/index.cts +2 -1
  20. package/src/commands/publish.ts +5 -0
  21. package/dist/.internal/.chunks/jiek_create-require.CWFWNQHj.cjs +0 -5
  22. package/dist/.internal/.chunks/jiek_create-require.CxSGbkTB.js +0 -5
  23. package/dist/.internal/commands/build/analyzer.cjs +0 -201
  24. package/dist/.internal/commands/build/analyzer.d.cts +0 -30
  25. package/dist/.internal/commands/build/analyzer.d.ts +0 -30
  26. package/dist/.internal/commands/build/analyzer.js +0 -195
  27. package/dist/.internal/commands/descriptions.cjs +0 -21
  28. package/dist/.internal/commands/descriptions.d.cts +0 -5
  29. package/dist/.internal/commands/descriptions.d.ts +0 -5
  30. package/dist/.internal/commands/descriptions.js +0 -17
  31. package/dist/.internal/commands/meta.cjs +0 -16
  32. package/dist/.internal/commands/meta.d.cts +0 -3
  33. package/dist/.internal/commands/meta.d.ts +0 -3
  34. package/dist/.internal/commands/meta.js +0 -15
  35. package/dist/.internal/commands/utils/optionParser.cjs +0 -8
  36. package/dist/.internal/commands/utils/optionParser.d.cts +0 -3
  37. package/dist/.internal/commands/utils/optionParser.d.ts +0 -3
  38. package/dist/.internal/commands/utils/optionParser.js +0 -6
  39. package/dist/.internal/server.cjs +0 -33
  40. package/dist/.internal/server.d.cts +0 -8
  41. package/dist/.internal/server.d.ts +0 -8
  42. package/dist/.internal/server.js +0 -27
  43. package/dist/.internal/utils/checkDependency.cjs +0 -39
  44. package/dist/.internal/utils/checkDependency.d.cts +0 -3
  45. package/dist/.internal/utils/checkDependency.d.ts +0 -3
  46. package/dist/.internal/utils/checkDependency.js +0 -34
  47. package/dist/.internal/utils/getRoot.cjs +0 -17
  48. package/dist/.internal/utils/getRoot.d.cts +0 -3
  49. package/dist/.internal/utils/getRoot.d.ts +0 -3
  50. package/dist/.internal/utils/getRoot.js +0 -11
  51. package/dist/.internal/utils/getWD.cjs +0 -15
  52. package/dist/.internal/utils/getWD.d.cts +0 -6
  53. package/dist/.internal/utils/getWD.d.ts +0 -6
  54. package/dist/.internal/utils/getWD.js +0 -10
  55. package/dist/.internal/utils/tsRegister.cjs +0 -25
  56. package/dist/.internal/utils/tsRegister.d.cts +0 -3
  57. package/dist/.internal/utils/tsRegister.d.ts +0 -3
  58. package/dist/.internal/utils/tsRegister.js +0 -26
File without changes
@@ -1,13 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var getWorkspaceDir = require('@jiek/utils/getWorkspaceDir');
4
- var jiek_createRequire = require('./jiek_create-require.CWFWNQHj.cjs');
5
3
  var fs = require('node:fs');
6
4
  var path = require('node:path');
7
5
  var process$1 = require('node:process');
8
6
  var commander = require('commander');
9
7
  var jsYaml = require('js-yaml');
10
- var getRoot = require('../utils/getRoot.cjs');
8
+ var getWorkspaceDir = require('@jiek/utils/getWorkspaceDir');
11
9
 
12
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
11
 
@@ -15,9 +13,43 @@ var fs__default = /*#__PURE__*/_interopDefault(fs);
15
13
  var path__default = /*#__PURE__*/_interopDefault(path);
16
14
  var process__default = /*#__PURE__*/_interopDefault(process$1);
17
15
 
16
+ var require$1 = require;
17
+
18
+ let root;
19
+ function getRoot() {
20
+ if (root) return root;
21
+ const rootOption = process.env.JIEK_ROOT;
22
+ root = rootOption ? path__default.default.isAbsolute(rootOption) ? rootOption : path__default.default.resolve(process.cwd(), rootOption) : void 0;
23
+ return root;
24
+ }
25
+
26
+ let wd;
27
+ let notWorkspace = false;
28
+ function getWD() {
29
+ if (wd) return { wd, notWorkspace };
30
+ const root = getRoot();
31
+ if (root !== void 0) {
32
+ const isWorkspace = getWorkspaceDir.isWorkspaceDir(root, exports.type);
33
+ notWorkspace = !isWorkspace;
34
+ wd = root;
35
+ return { wd, notWorkspace };
36
+ }
37
+ try {
38
+ wd = getWorkspaceDir.getWorkspaceDir(exports.type);
39
+ } catch (e) {
40
+ if ("message" in e && e.message === "workspace root not found") {
41
+ wd = root ?? process.cwd();
42
+ notWorkspace = true;
43
+ } else {
44
+ throw e;
45
+ }
46
+ }
47
+ return { wd, notWorkspace };
48
+ }
49
+
18
50
  exports.type = "";
19
51
  try {
20
- jiek_createRequire.require.resolve("@pnpm/filter-workspace-packages");
52
+ require$1.resolve("@pnpm/filter-workspace-packages");
21
53
  exports.type = "pnpm";
22
54
  } catch {
23
55
  }
@@ -26,7 +58,7 @@ async function filterPackagesGraph(filters) {
26
58
  }
27
59
  async function getSelectedProjectsGraph(filter = commander.program.getOptionValue("filter")) {
28
60
  const { wd, notWorkspace } = getWD();
29
- let root = getRoot.getRoot();
61
+ let root = getRoot();
30
62
  if (notWorkspace) {
31
63
  return {
32
64
  root,
@@ -76,30 +108,7 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu
76
108
  throw new Error(`not supported package manager ${exports.type}`);
77
109
  }
78
110
 
79
- let wd;
80
- let notWorkspace = false;
81
- function getWD() {
82
- if (wd) return { wd, notWorkspace };
83
- const root = getRoot.getRoot();
84
- if (root !== void 0) {
85
- const isWorkspace = getWorkspaceDir.isWorkspaceDir(root, exports.type);
86
- notWorkspace = !isWorkspace;
87
- wd = root;
88
- return { wd, notWorkspace };
89
- }
90
- try {
91
- wd = getWorkspaceDir.getWorkspaceDir(exports.type);
92
- } catch (e) {
93
- if ("message" in e && e.message === "workspace root not found") {
94
- wd = root ?? process.cwd();
95
- notWorkspace = true;
96
- } else {
97
- throw e;
98
- }
99
- }
100
- return { wd, notWorkspace };
101
- }
102
-
103
111
  exports.filterPackagesGraph = filterPackagesGraph;
104
112
  exports.getSelectedProjectsGraph = getSelectedProjectsGraph;
105
113
  exports.getWD = getWD;
114
+ exports.require = require$1;
@@ -1,11 +1,44 @@
1
- import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
2
- import { r as require } from './jiek_create-require.CxSGbkTB.js';
1
+ import { createRequire } from 'node:module';
3
2
  import fs from 'node:fs';
4
3
  import path from 'node:path';
5
4
  import process$1 from 'node:process';
6
5
  import { program } from 'commander';
7
6
  import { load } from 'js-yaml';
8
- import { getRoot } from '../utils/getRoot.js';
7
+ import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
8
+
9
+ var require = /* @__PURE__ */ createRequire(import.meta.url);
10
+
11
+ let root;
12
+ function getRoot() {
13
+ if (root) return root;
14
+ const rootOption = process.env.JIEK_ROOT;
15
+ root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
16
+ return root;
17
+ }
18
+
19
+ let wd;
20
+ let notWorkspace = false;
21
+ function getWD() {
22
+ if (wd) return { wd, notWorkspace };
23
+ const root = getRoot();
24
+ if (root !== void 0) {
25
+ const isWorkspace = isWorkspaceDir(root, type);
26
+ notWorkspace = !isWorkspace;
27
+ wd = root;
28
+ return { wd, notWorkspace };
29
+ }
30
+ try {
31
+ wd = getWorkspaceDir(type);
32
+ } catch (e) {
33
+ if ("message" in e && e.message === "workspace root not found") {
34
+ wd = root ?? process.cwd();
35
+ notWorkspace = true;
36
+ } else {
37
+ throw e;
38
+ }
39
+ }
40
+ return { wd, notWorkspace };
41
+ }
9
42
 
10
43
  let type = "";
11
44
  try {
@@ -68,28 +101,4 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
68
101
  throw new Error(`not supported package manager ${type}`);
69
102
  }
70
103
 
71
- let wd;
72
- let notWorkspace = false;
73
- function getWD() {
74
- if (wd) return { wd, notWorkspace };
75
- const root = getRoot();
76
- if (root !== void 0) {
77
- const isWorkspace = isWorkspaceDir(root, type);
78
- notWorkspace = !isWorkspace;
79
- wd = root;
80
- return { wd, notWorkspace };
81
- }
82
- try {
83
- wd = getWorkspaceDir(type);
84
- } catch (e) {
85
- if ("message" in e && e.message === "workspace root not found") {
86
- wd = root ?? process.cwd();
87
- notWorkspace = true;
88
- } else {
89
- throw e;
90
- }
91
- }
92
- return { wd, notWorkspace };
93
- }
94
-
95
- export { getSelectedProjectsGraph as a, filterPackagesGraph as f, getWD as g, type as t };
104
+ export { getSelectedProjectsGraph as a, filterPackagesGraph as f, getWD as g, require as r, type as t };
@@ -0,0 +1,110 @@
1
+ import { r as require, g as getWD } from './filterSupport.BXWpLBpT.js';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { program } from 'commander';
5
+ import { load } from 'js-yaml';
6
+
7
+ function packageIsExist(name) {
8
+ try {
9
+ require.resolve(name);
10
+ return true;
11
+ } catch (e) {
12
+ return false;
13
+ }
14
+ }
15
+ let tsRegisterName;
16
+ const registers = [
17
+ process.env.JIEK_TS_REGISTER,
18
+ "esbuild-register",
19
+ "@swc-node/register",
20
+ "ts-node/register"
21
+ ].filter(Boolean);
22
+ for (const register of registers) {
23
+ if (packageIsExist(register)) {
24
+ tsRegisterName = register;
25
+ break;
26
+ }
27
+ }
28
+
29
+ let configName = "jiek.config";
30
+ function getConfigPath(root, dir) {
31
+ const isSupportTsLoader = !!tsRegisterName;
32
+ function configWithExtIsExist(ext) {
33
+ const filenames = [
34
+ path.resolve(process.cwd(), `${configName}.${ext}`),
35
+ path.resolve(process.cwd(), `.${configName}.${ext}`),
36
+ path.resolve(root, `${configName}.${ext}`),
37
+ path.resolve(root, `.${configName}.${ext}`)
38
+ ];
39
+ if (dir) {
40
+ filenames.unshift(...[
41
+ path.resolve(dir, `${configName}.${ext}`),
42
+ path.resolve(dir, `.${configName}.${ext}`)
43
+ ]);
44
+ }
45
+ for (const filename of filenames) {
46
+ if (fs.existsSync(filename) && fs.lstatSync(filename).isFile()) {
47
+ return filename;
48
+ }
49
+ }
50
+ return;
51
+ }
52
+ configName = configWithExtIsExist("js") ?? configName;
53
+ configName = configWithExtIsExist("json") ?? configName;
54
+ configName = configWithExtIsExist("yaml") ?? configName;
55
+ if (isSupportTsLoader) {
56
+ configName = configWithExtIsExist("ts") ?? configName;
57
+ }
58
+ return path.resolve(root, configName);
59
+ }
60
+ function loadConfig(dirOrOptions) {
61
+ let dir;
62
+ let root;
63
+ if (typeof dirOrOptions === "object") {
64
+ dir = dirOrOptions.dir;
65
+ root = dirOrOptions.root ?? getWD().wd;
66
+ } else {
67
+ dir = dirOrOptions;
68
+ root = getWD().wd;
69
+ }
70
+ let configPath = program.getOptionValue("configPath");
71
+ if (!configPath) {
72
+ configPath = getConfigPath(root, dir);
73
+ } else {
74
+ if (!fs.existsSync(configPath)) {
75
+ throw new Error(`config file not found: ${configPath}`);
76
+ }
77
+ if (!path.isAbsolute(configPath)) {
78
+ configPath = path.resolve(root, configPath);
79
+ }
80
+ }
81
+ const ext = path.extname(configPath);
82
+ let module;
83
+ switch (ext) {
84
+ case ".js":
85
+ module = require(configPath);
86
+ break;
87
+ case ".json":
88
+ return require(configPath);
89
+ case ".yaml":
90
+ return load(fs.readFileSync(configPath, "utf-8"));
91
+ case ".ts":
92
+ if (tsRegisterName) {
93
+ require(tsRegisterName);
94
+ module = require(configPath);
95
+ break;
96
+ }
97
+ throw new Error(
98
+ "ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register"
99
+ );
100
+ case ".config":
101
+ module = {};
102
+ break;
103
+ default:
104
+ throw new Error(`unsupported config file type: ${ext}`);
105
+ }
106
+ if (!module) throw new Error("config file is empty");
107
+ return module.default ?? module;
108
+ }
109
+
110
+ export { loadConfig as l, tsRegisterName as t };
@@ -0,0 +1,117 @@
1
+ 'use strict';
2
+
3
+ var filterSupport = require('./filterSupport.4rM7f6jB.cjs');
4
+ var fs = require('node:fs');
5
+ var path = require('node:path');
6
+ var commander = require('commander');
7
+ var jsYaml = require('js-yaml');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
12
+ var path__default = /*#__PURE__*/_interopDefault(path);
13
+
14
+ function packageIsExist(name) {
15
+ try {
16
+ filterSupport.require.resolve(name);
17
+ return true;
18
+ } catch (e) {
19
+ return false;
20
+ }
21
+ }
22
+ exports.tsRegisterName = void 0;
23
+ const registers = [
24
+ process.env.JIEK_TS_REGISTER,
25
+ "esbuild-register",
26
+ "@swc-node/register",
27
+ "ts-node/register"
28
+ ].filter(Boolean);
29
+ for (const register of registers) {
30
+ if (packageIsExist(register)) {
31
+ exports.tsRegisterName = register;
32
+ break;
33
+ }
34
+ }
35
+
36
+ let configName = "jiek.config";
37
+ function getConfigPath(root, dir) {
38
+ const isSupportTsLoader = !!exports.tsRegisterName;
39
+ function configWithExtIsExist(ext) {
40
+ const filenames = [
41
+ path__default.default.resolve(process.cwd(), `${configName}.${ext}`),
42
+ path__default.default.resolve(process.cwd(), `.${configName}.${ext}`),
43
+ path__default.default.resolve(root, `${configName}.${ext}`),
44
+ path__default.default.resolve(root, `.${configName}.${ext}`)
45
+ ];
46
+ if (dir) {
47
+ filenames.unshift(...[
48
+ path__default.default.resolve(dir, `${configName}.${ext}`),
49
+ path__default.default.resolve(dir, `.${configName}.${ext}`)
50
+ ]);
51
+ }
52
+ for (const filename of filenames) {
53
+ if (fs__default.default.existsSync(filename) && fs__default.default.lstatSync(filename).isFile()) {
54
+ return filename;
55
+ }
56
+ }
57
+ return;
58
+ }
59
+ configName = configWithExtIsExist("js") ?? configName;
60
+ configName = configWithExtIsExist("json") ?? configName;
61
+ configName = configWithExtIsExist("yaml") ?? configName;
62
+ if (isSupportTsLoader) {
63
+ configName = configWithExtIsExist("ts") ?? configName;
64
+ }
65
+ return path__default.default.resolve(root, configName);
66
+ }
67
+ function loadConfig(dirOrOptions) {
68
+ let dir;
69
+ let root;
70
+ if (typeof dirOrOptions === "object") {
71
+ dir = dirOrOptions.dir;
72
+ root = dirOrOptions.root ?? filterSupport.getWD().wd;
73
+ } else {
74
+ dir = dirOrOptions;
75
+ root = filterSupport.getWD().wd;
76
+ }
77
+ let configPath = commander.program.getOptionValue("configPath");
78
+ if (!configPath) {
79
+ configPath = getConfigPath(root, dir);
80
+ } else {
81
+ if (!fs__default.default.existsSync(configPath)) {
82
+ throw new Error(`config file not found: ${configPath}`);
83
+ }
84
+ if (!path__default.default.isAbsolute(configPath)) {
85
+ configPath = path__default.default.resolve(root, configPath);
86
+ }
87
+ }
88
+ const ext = path__default.default.extname(configPath);
89
+ let module;
90
+ switch (ext) {
91
+ case ".js":
92
+ module = filterSupport.require(configPath);
93
+ break;
94
+ case ".json":
95
+ return filterSupport.require(configPath);
96
+ case ".yaml":
97
+ return jsYaml.load(fs__default.default.readFileSync(configPath, "utf-8"));
98
+ case ".ts":
99
+ if (exports.tsRegisterName) {
100
+ filterSupport.require(exports.tsRegisterName);
101
+ module = filterSupport.require(configPath);
102
+ break;
103
+ }
104
+ throw new Error(
105
+ "ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register"
106
+ );
107
+ case ".config":
108
+ module = {};
109
+ break;
110
+ default:
111
+ throw new Error(`unsupported config file type: ${ext}`);
112
+ }
113
+ if (!module) throw new Error("config file is empty");
114
+ return module.default ?? module;
115
+ }
116
+
117
+ exports.loadConfig = loadConfig;