jiek 2.2.7 → 2.3.1
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.
- package/bin/build.cjs +2 -0
- package/bin/index.cjs +2 -0
- package/bin-helper/index.cjs +19 -31
- package/dist/.internal/.chunks/filterSupport.4rM7f6jB.cjs +114 -0
- package/dist/.internal/.chunks/filterSupport.BXWpLBpT.js +104 -0
- package/dist/{cli.js → .internal/.chunks/index.B6RQz1DZ.js} +1 -737
- package/dist/.internal/.chunks/index.BHuJRlvZ.js +9059 -0
- package/dist/.internal/.chunks/index.Daihq2aI.cjs +9071 -0
- package/dist/{cli.cjs → .internal/.chunks/index.DlHFuTjM.cjs} +1 -759
- package/dist/.internal/.chunks/loadConfig.CFfzkm_p.js +110 -0
- package/dist/.internal/.chunks/loadConfig.OOKddvHF.cjs +117 -0
- package/dist/{cli-only-build.cjs → .internal/bin/common.cjs} +229 -445
- package/dist/.internal/bin/common.d.cts +22 -0
- package/dist/.internal/bin/common.d.ts +22 -0
- package/dist/{cli-only-build.js → .internal/bin/common.js} +224 -439
- package/dist/.internal/bin/parseArgv.cjs +33 -0
- package/dist/.internal/bin/parseArgv.d.cts +5 -0
- package/dist/.internal/bin/parseArgv.d.ts +5 -0
- package/dist/.internal/bin/parseArgv.js +27 -0
- package/dist/.internal/bridge.cjs +30 -0
- package/dist/.internal/bridge.d.cts +39 -0
- package/dist/.internal/bridge.d.ts +39 -0
- package/dist/.internal/bridge.js +27 -0
- package/dist/.internal/rollup/base.cjs +10 -0
- package/dist/{cli-only-build.d.cts → .internal/rollup/base.d.cts} +8 -15
- package/dist/{cli-only-build.d.ts → .internal/rollup/base.d.ts} +8 -15
- package/dist/.internal/rollup/base.js +7 -0
- package/dist/.internal/rollup/bundle-analyzer.cjs +51 -0
- package/dist/.internal/rollup/bundle-analyzer.d.cts +92 -0
- package/dist/.internal/rollup/bundle-analyzer.d.ts +92 -0
- package/dist/.internal/rollup/bundle-analyzer.js +45 -0
- package/dist/.internal/utils/filterSupport.cjs +18 -0
- package/dist/.internal/utils/filterSupport.d.cts +15 -0
- package/dist/.internal/utils/filterSupport.d.ts +15 -0
- package/dist/.internal/utils/filterSupport.js +8 -0
- package/dist/.internal/utils/getInternalModuleName.cjs +5 -0
- package/dist/.internal/utils/getInternalModuleName.d.cts +3 -0
- package/dist/.internal/utils/getInternalModuleName.d.ts +3 -0
- package/dist/.internal/utils/getInternalModuleName.js +3 -0
- package/dist/.internal/utils/intersection.cjs +5 -0
- package/dist/.internal/utils/intersection.d.cts +3 -0
- package/dist/.internal/utils/intersection.d.ts +3 -0
- package/dist/.internal/utils/intersection.js +3 -0
- package/dist/.internal/utils/loadConfig.cjs +14 -0
- package/dist/.internal/utils/loadConfig.d.cts +10 -0
- package/dist/.internal/utils/loadConfig.d.ts +10 -0
- package/dist/.internal/utils/loadConfig.js +9 -0
- package/dist/.internal/utils/recursiveListFiles.cjs +19 -0
- package/dist/.internal/utils/recursiveListFiles.d.cts +3 -0
- package/dist/.internal/utils/recursiveListFiles.d.ts +3 -0
- package/dist/.internal/utils/recursiveListFiles.js +13 -0
- package/dist/.internal/utils/resolveExports.cjs +124 -0
- package/dist/.internal/utils/resolveExports.d.cts +27 -0
- package/dist/.internal/utils/resolveExports.d.ts +27 -0
- package/dist/.internal/utils/resolveExports.js +117 -0
- package/dist/.internal/utils/ts.cjs +68 -0
- package/dist/.internal/utils/ts.d.cts +3 -0
- package/dist/.internal/utils/ts.d.ts +3 -0
- package/dist/.internal/utils/ts.js +62 -0
- package/dist/bin/build.cjs +10 -0
- package/dist/bin/index.cjs +522 -0
- package/dist/index.d.cts +16 -114
- package/dist/index.d.ts +16 -114
- package/dist/rollup/index.cjs +310 -4573
- package/dist/rollup/index.d.cts +7 -1
- package/dist/rollup/index.d.ts +7 -1
- package/dist/rollup/index.js +298 -4558
- package/package.json +16 -24
- package/src/bin/build.cts +5 -0
- package/src/bin/common.ts +3 -0
- package/src/bin/index.cts +7 -0
- package/src/bridge.ts +1 -1
- package/src/commands/base.ts +3 -3
- package/src/commands/build/analyzer.ts +5 -5
- package/src/commands/build/client/analyzer.tsx +1 -1
- package/src/commands/build/client/index.ts +5 -7
- package/src/commands/build.ts +244 -213
- package/src/commands/meta.ts +1 -1
- package/src/commands/publish.ts +190 -78
- package/src/index.ts +6 -1
- package/src/rollup/base.ts +2 -2
- package/src/rollup/index.ts +361 -124
- package/src/rollup/plugins/with-external.ts +23 -0
- package/src/rollup/utils/externalResolver.ts +20 -8
- package/src/utils/checkDependency.ts +1 -1
- package/src/utils/filterSupport.ts +17 -16
- package/src/utils/getInternalModuleName.ts +5 -0
- package/src/utils/intersection.ts +1 -0
- package/src/utils/{recusiveListFiles.ts → recursiveListFiles.ts} +2 -2
- package/src/utils/{getExports.ts → resolveExports.ts} +28 -19
- package/bin/jiek-build.js +0 -16
- package/bin/jiek.js +0 -13
- package/cli/package.json +0 -1
- package/cli-only-build/package.json +0 -1
- package/dist/cli.d.cts +0 -14
- package/dist/cli.d.ts +0 -14
- package/src/cli-only-build.ts +0 -11
- package/src/cli.ts +0 -6
- /package/{src/bin/build.ts → .jiek-production-tag} +0 -0
- /package/src/{parseArgv.ts → bin/parseArgv.ts} +0 -0
@@ -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;
|