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
@@ -1,52 +1,28 @@
1
1
  'use strict';
2
2
 
3
+ var process = require('node:process');
4
+ var getWorkspaceDir = require('@jiek/utils/getWorkspaceDir');
3
5
  var fs = require('node:fs');
4
6
  var path = require('node:path');
5
- var process$1 = require('node:process');
6
7
  var commander = require('commander');
7
8
  var jsYaml = require('js-yaml');
8
- var getWorkspaceDir = require('@jiek/utils/getWorkspaceDir');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
12
+ var process__default = /*#__PURE__*/_interopDefault(process);
12
13
  var fs__default = /*#__PURE__*/_interopDefault(fs);
13
14
  var path__default = /*#__PURE__*/_interopDefault(path);
14
- var process__default = /*#__PURE__*/_interopDefault(process$1);
15
15
 
16
16
  var require$1 = require;
17
17
 
18
18
  let root;
19
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;
20
+ if (root != null) return root;
21
+ const rootOption = process__default.default.env.JIEK_ROOT;
22
+ root = rootOption != null ? path__default.default.isAbsolute(rootOption) ? rootOption : path__default.default.resolve(process__default.default.cwd(), rootOption) : void 0;
23
23
  return root;
24
24
  }
25
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
-
50
26
  exports.type = "";
51
27
  try {
52
28
  require$1.resolve("@pnpm/filter-workspace-packages");
@@ -108,6 +84,30 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu
108
84
  throw new Error(`not supported package manager ${exports.type}`);
109
85
  }
110
86
 
87
+ let wd;
88
+ let notWorkspace = false;
89
+ function getWD() {
90
+ if (wd) return { wd, notWorkspace };
91
+ const root = getRoot();
92
+ if (root !== void 0) {
93
+ const isWorkspace = getWorkspaceDir.isWorkspaceDir(root, exports.type);
94
+ notWorkspace = !isWorkspace;
95
+ wd = root;
96
+ return { wd, notWorkspace };
97
+ }
98
+ try {
99
+ wd = getWorkspaceDir.getWorkspaceDir(exports.type);
100
+ } catch (e) {
101
+ if ("message" in e && e.message === "workspace root not found") {
102
+ wd = root ?? process__default.default.cwd();
103
+ notWorkspace = true;
104
+ } else {
105
+ throw e;
106
+ }
107
+ }
108
+ return { wd, notWorkspace };
109
+ }
110
+
111
111
  exports.filterPackagesGraph = filterPackagesGraph;
112
112
  exports.getSelectedProjectsGraph = getSelectedProjectsGraph;
113
113
  exports.getWD = getWD;
@@ -1,45 +1,21 @@
1
+ import process from 'node:process';
2
+ import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
1
3
  import { createRequire } from 'node:module';
2
4
  import fs from 'node:fs';
3
5
  import path from 'node:path';
4
- import process$1 from 'node:process';
5
6
  import { program } from 'commander';
6
7
  import { load } from 'js-yaml';
7
- import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
8
8
 
9
9
  var require = /* @__PURE__ */ createRequire(import.meta.url);
10
10
 
11
11
  let root;
12
12
  function getRoot() {
13
- if (root) return root;
13
+ if (root != null) return root;
14
14
  const rootOption = process.env.JIEK_ROOT;
15
- root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
15
+ root = rootOption != null ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
16
16
  return root;
17
17
  }
18
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
- }
42
-
43
19
  let type = "";
44
20
  try {
45
21
  require.resolve("@pnpm/filter-workspace-packages");
@@ -68,7 +44,7 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
68
44
  throw new Error("root path is workspace root, please provide a filter");
69
45
  }
70
46
  if (root === void 0) {
71
- root = process$1.cwd();
47
+ root = process.cwd();
72
48
  }
73
49
  if (root !== wd && filter == null) {
74
50
  const packageJSONIsExist = fs.existsSync(path.resolve(root, "package.json"));
@@ -101,4 +77,28 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
101
77
  throw new Error(`not supported package manager ${type}`);
102
78
  }
103
79
 
80
+ let wd;
81
+ let notWorkspace = false;
82
+ function getWD() {
83
+ if (wd) return { wd, notWorkspace };
84
+ const root = getRoot();
85
+ if (root !== void 0) {
86
+ const isWorkspace = isWorkspaceDir(root, type);
87
+ notWorkspace = !isWorkspace;
88
+ wd = root;
89
+ return { wd, notWorkspace };
90
+ }
91
+ try {
92
+ wd = getWorkspaceDir(type);
93
+ } catch (e) {
94
+ if ("message" in e && e.message === "workspace root not found") {
95
+ wd = root ?? process.cwd();
96
+ notWorkspace = true;
97
+ } else {
98
+ throw e;
99
+ }
100
+ }
101
+ return { wd, notWorkspace };
102
+ }
103
+
104
104
  export { getSelectedProjectsGraph as a, filterPackagesGraph as f, getWD as g, require as r, type as t };
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var filterSupport = require('./filterSupport.4rM7f6jB.cjs');
3
+ var filterSupport = require('./getWD.Bdo2NGCR.cjs');
4
4
  var fs = require('node:fs');
5
5
  var path = require('node:path');
6
+ var process = require('node:process');
6
7
  var commander = require('commander');
7
8
  var jsYaml = require('js-yaml');
8
9
 
@@ -10,18 +11,19 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
11
 
11
12
  var fs__default = /*#__PURE__*/_interopDefault(fs);
12
13
  var path__default = /*#__PURE__*/_interopDefault(path);
14
+ var process__default = /*#__PURE__*/_interopDefault(process);
13
15
 
14
16
  function packageIsExist(name) {
15
17
  try {
16
18
  filterSupport.require.resolve(name);
17
19
  return true;
18
- } catch (e) {
20
+ } catch {
19
21
  return false;
20
22
  }
21
23
  }
22
24
  exports.tsRegisterName = void 0;
23
25
  const registers = [
24
- process.env.JIEK_TS_REGISTER,
26
+ process__default.default.env.JIEK_TS_REGISTER,
25
27
  "esbuild-register",
26
28
  "@swc-node/register",
27
29
  "ts-node/register"
@@ -35,15 +37,15 @@ for (const register of registers) {
35
37
 
36
38
  let configName = "jiek.config";
37
39
  function getConfigPath(root, dir) {
38
- const isSupportTsLoader = !!exports.tsRegisterName;
40
+ const isSupportTsLoader = exports.tsRegisterName != null;
39
41
  function configWithExtIsExist(ext) {
40
42
  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(process__default.default.cwd(), `${configName}.${ext}`),
44
+ path__default.default.resolve(process__default.default.cwd(), `.${configName}.${ext}`),
43
45
  path__default.default.resolve(root, `${configName}.${ext}`),
44
46
  path__default.default.resolve(root, `.${configName}.${ext}`)
45
47
  ];
46
- if (dir) {
48
+ if (dir != null) {
47
49
  filenames.unshift(...[
48
50
  path__default.default.resolve(dir, `${configName}.${ext}`),
49
51
  path__default.default.resolve(dir, `.${configName}.${ext}`)
@@ -54,7 +56,6 @@ function getConfigPath(root, dir) {
54
56
  return filename;
55
57
  }
56
58
  }
57
- return;
58
59
  }
59
60
  configName = configWithExtIsExist("js") ?? configName;
60
61
  configName = configWithExtIsExist("json") ?? configName;
@@ -67,14 +68,15 @@ function getConfigPath(root, dir) {
67
68
  function loadConfig(dirOrOptions) {
68
69
  let dir;
69
70
  let root;
71
+ let configPath = commander.program.getOptionValue("configPath");
70
72
  if (typeof dirOrOptions === "object") {
71
73
  dir = dirOrOptions.dir;
72
74
  root = dirOrOptions.root ?? filterSupport.getWD().wd;
75
+ configPath = dirOrOptions.configPath ?? configPath;
73
76
  } else {
74
77
  dir = dirOrOptions;
75
78
  root = filterSupport.getWD().wd;
76
79
  }
77
- let configPath = commander.program.getOptionValue("configPath");
78
80
  if (!configPath) {
79
81
  configPath = getConfigPath(root, dir);
80
82
  } else {
@@ -96,7 +98,7 @@ function loadConfig(dirOrOptions) {
96
98
  case ".yaml":
97
99
  return jsYaml.load(fs__default.default.readFileSync(configPath, "utf-8"));
98
100
  case ".ts":
99
- if (exports.tsRegisterName) {
101
+ if (exports.tsRegisterName != null) {
100
102
  filterSupport.require(exports.tsRegisterName);
101
103
  module = filterSupport.require(configPath);
102
104
  break;
@@ -110,8 +112,24 @@ function loadConfig(dirOrOptions) {
110
112
  default:
111
113
  throw new Error(`unsupported config file type: ${ext}`);
112
114
  }
113
- if (!module) throw new Error("config file is empty");
114
- return module.default ?? module;
115
+ if (module == null) {
116
+ throw new Error("config file is empty");
117
+ }
118
+ if ("default" in module) {
119
+ if (module.default == null) {
120
+ throw new Error("config file is empty");
121
+ }
122
+ module = module.default;
123
+ }
124
+ if ("extends" in module && module.extends != null) {
125
+ const extendConfigPath = path__default.default.resolve(path__default.default.dirname(configPath), module.extends);
126
+ const extendConfig = loadConfig({ configPath: extendConfigPath });
127
+ module = {
128
+ ...extendConfig,
129
+ ...module
130
+ };
131
+ }
132
+ return module;
115
133
  }
116
134
 
117
135
  exports.loadConfig = loadConfig;
@@ -1,6 +1,7 @@
1
- import { r as require, g as getWD } from './filterSupport.BXWpLBpT.js';
1
+ import { r as require, g as getWD } from './getWD.DGvwAHMY.js';
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
+ import process from 'node:process';
4
5
  import { program } from 'commander';
5
6
  import { load } from 'js-yaml';
6
7
 
@@ -8,7 +9,7 @@ function packageIsExist(name) {
8
9
  try {
9
10
  require.resolve(name);
10
11
  return true;
11
- } catch (e) {
12
+ } catch {
12
13
  return false;
13
14
  }
14
15
  }
@@ -28,7 +29,7 @@ for (const register of registers) {
28
29
 
29
30
  let configName = "jiek.config";
30
31
  function getConfigPath(root, dir) {
31
- const isSupportTsLoader = !!tsRegisterName;
32
+ const isSupportTsLoader = tsRegisterName != null;
32
33
  function configWithExtIsExist(ext) {
33
34
  const filenames = [
34
35
  path.resolve(process.cwd(), `${configName}.${ext}`),
@@ -36,7 +37,7 @@ function getConfigPath(root, dir) {
36
37
  path.resolve(root, `${configName}.${ext}`),
37
38
  path.resolve(root, `.${configName}.${ext}`)
38
39
  ];
39
- if (dir) {
40
+ if (dir != null) {
40
41
  filenames.unshift(...[
41
42
  path.resolve(dir, `${configName}.${ext}`),
42
43
  path.resolve(dir, `.${configName}.${ext}`)
@@ -47,7 +48,6 @@ function getConfigPath(root, dir) {
47
48
  return filename;
48
49
  }
49
50
  }
50
- return;
51
51
  }
52
52
  configName = configWithExtIsExist("js") ?? configName;
53
53
  configName = configWithExtIsExist("json") ?? configName;
@@ -60,14 +60,15 @@ function getConfigPath(root, dir) {
60
60
  function loadConfig(dirOrOptions) {
61
61
  let dir;
62
62
  let root;
63
+ let configPath = program.getOptionValue("configPath");
63
64
  if (typeof dirOrOptions === "object") {
64
65
  dir = dirOrOptions.dir;
65
66
  root = dirOrOptions.root ?? getWD().wd;
67
+ configPath = dirOrOptions.configPath ?? configPath;
66
68
  } else {
67
69
  dir = dirOrOptions;
68
70
  root = getWD().wd;
69
71
  }
70
- let configPath = program.getOptionValue("configPath");
71
72
  if (!configPath) {
72
73
  configPath = getConfigPath(root, dir);
73
74
  } else {
@@ -89,7 +90,7 @@ function loadConfig(dirOrOptions) {
89
90
  case ".yaml":
90
91
  return load(fs.readFileSync(configPath, "utf-8"));
91
92
  case ".ts":
92
- if (tsRegisterName) {
93
+ if (tsRegisterName != null) {
93
94
  require(tsRegisterName);
94
95
  module = require(configPath);
95
96
  break;
@@ -103,8 +104,24 @@ function loadConfig(dirOrOptions) {
103
104
  default:
104
105
  throw new Error(`unsupported config file type: ${ext}`);
105
106
  }
106
- if (!module) throw new Error("config file is empty");
107
- return module.default ?? module;
107
+ if (module == null) {
108
+ throw new Error("config file is empty");
109
+ }
110
+ if ("default" in module) {
111
+ if (module.default == null) {
112
+ throw new Error("config file is empty");
113
+ }
114
+ module = module.default;
115
+ }
116
+ if ("extends" in module && module.extends != null) {
117
+ const extendConfigPath = path.resolve(path.dirname(configPath), module.extends);
118
+ const extendConfig = loadConfig({ configPath: extendConfigPath });
119
+ module = {
120
+ ...extendConfig,
121
+ ...module
122
+ };
123
+ }
124
+ return module;
108
125
  }
109
126
 
110
127
  export { loadConfig as l, tsRegisterName as t };