jiek 2.2.6 → 2.2.7-alpha.3
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 +31 -0
- package/bin-helper/index.d.cts +1 -0
- package/bin-helper/index.d.ts +1 -0
- package/bin-helper/package.json +5 -1
- package/dist/.internal/.chunks/getWD.D6wq8Qc2.js +95 -0
- package/dist/.internal/.chunks/getWD.ZF0avqDB.cjs +105 -0
- package/dist/{cli.js → .internal/.chunks/index.B6RQz1DZ.js} +1 -735
- package/dist/{cli.cjs → .internal/.chunks/index.DlHFuTjM.cjs} +1 -757
- package/dist/.internal/.chunks/jiek_create-require.CWFWNQHj.cjs +5 -0
- package/dist/.internal/.chunks/jiek_create-require.CxSGbkTB.js +5 -0
- 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 +12 -0
- package/dist/.internal/bridge.d.cts +39 -0
- package/dist/.internal/bridge.d.ts +39 -0
- package/dist/.internal/bridge.js +9 -0
- package/dist/.internal/commands/build/analyzer.cjs +201 -0
- package/dist/.internal/commands/build/analyzer.d.cts +30 -0
- package/dist/.internal/commands/build/analyzer.d.ts +30 -0
- package/dist/.internal/commands/build/analyzer.js +195 -0
- package/dist/.internal/commands/descriptions.cjs +21 -0
- package/dist/.internal/commands/descriptions.d.cts +5 -0
- package/dist/.internal/commands/descriptions.d.ts +5 -0
- package/dist/.internal/commands/descriptions.js +17 -0
- package/dist/.internal/commands/meta.cjs +16 -0
- package/dist/.internal/commands/meta.d.cts +3 -0
- package/dist/.internal/commands/meta.d.ts +3 -0
- package/dist/.internal/commands/meta.js +15 -0
- package/dist/.internal/commands/utils/optionParser.cjs +8 -0
- package/dist/.internal/commands/utils/optionParser.d.cts +3 -0
- package/dist/.internal/commands/utils/optionParser.d.ts +3 -0
- package/dist/.internal/commands/utils/optionParser.js +6 -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/server.cjs +33 -0
- package/dist/.internal/server.d.cts +8 -0
- package/dist/.internal/server.d.ts +8 -0
- package/dist/.internal/server.js +27 -0
- package/dist/.internal/utils/checkDependency.cjs +39 -0
- package/dist/.internal/utils/checkDependency.d.cts +3 -0
- package/dist/.internal/utils/checkDependency.d.ts +3 -0
- package/dist/.internal/utils/checkDependency.js +34 -0
- package/dist/.internal/utils/filterSupport.cjs +20 -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 +10 -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/getRoot.cjs +17 -0
- package/dist/.internal/utils/getRoot.d.cts +3 -0
- package/dist/.internal/utils/getRoot.d.ts +3 -0
- package/dist/.internal/utils/getRoot.js +11 -0
- package/dist/.internal/utils/getWD.cjs +15 -0
- package/dist/.internal/utils/getWD.d.cts +6 -0
- package/dist/.internal/utils/getWD.d.ts +6 -0
- package/dist/.internal/utils/getWD.js +10 -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 +100 -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 +94 -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 +118 -0
- package/dist/.internal/utils/resolveExports.d.cts +26 -0
- package/dist/.internal/utils/resolveExports.d.ts +26 -0
- package/dist/.internal/utils/resolveExports.js +111 -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/.internal/utils/tsRegister.cjs +25 -0
- package/dist/.internal/utils/tsRegister.d.cts +3 -0
- package/dist/.internal/utils/tsRegister.d.ts +3 -0
- package/dist/.internal/utils/tsRegister.js +26 -0
- package/dist/bin/build.cjs +515 -0
- package/dist/bin/index.cjs +497 -0
- package/dist/index.d.cts +12 -114
- package/dist/index.d.ts +12 -114
- package/dist/rollup/index.cjs +280 -4573
- package/dist/rollup/index.d.cts +7 -1
- package/dist/rollup/index.d.ts +7 -1
- package/dist/rollup/index.js +268 -4558
- package/package.json +20 -26
- package/src/bin/build.cts +11 -0
- package/src/bin/index.cts +6 -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 +226 -211
- package/src/commands/meta.ts +1 -1
- package/src/commands/publish.ts +112 -32
- package/src/index.ts +6 -1
- package/src/rollup/base.ts +2 -2
- package/src/rollup/index.ts +321 -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} +16 -14
- package/bin/jiek-build.js +0 -16
- package/bin/jiek.js +0 -13
- package/bin-helper.cjs +0 -43
- package/cli/package.json +0 -1
- package/cli-only-build/package.json +0 -1
- package/dist/cli-only-build.cjs +0 -977
- package/dist/cli-only-build.js +0 -969
- package/dist/cli.d.cts +0 -14
- package/dist/cli.d.ts +0 -14
- package/src/bin/build.ts +0 -0
- package/src/cli-only-build.ts +0 -11
- package/src/cli.ts +0 -6
- /package/{bin-helper.js → bin-helper/index.js} +0 -0
- /package/src/{parseArgv.ts → bin/parseArgv.ts} +0 -0
package/bin/build.cjs
ADDED
package/bin/index.cjs
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
const fs = require('node:fs')
|
2
|
+
const {
|
3
|
+
basename,
|
4
|
+
dirname,
|
5
|
+
resolve
|
6
|
+
} = require('node:path')
|
7
|
+
const process = require('node:process')
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @type {string | undefined}
|
11
|
+
*/
|
12
|
+
const binFilePath = module.parent.filename ?? require.main.filename
|
13
|
+
|
14
|
+
const packageDir = dirname(dirname(binFilePath))
|
15
|
+
const binFilename = basename(binFilePath)
|
16
|
+
|
17
|
+
process.env.JIEK_PACKAGE_DIR = packageDir
|
18
|
+
process.env.JIEK_BIN__FILENAME = binFilename
|
19
|
+
process.env.JIEK_BIN__FILEPATH = binFilePath
|
20
|
+
|
21
|
+
const resolveByPKG = (...paths) => resolve(packageDir, ...paths)
|
22
|
+
const isProduction = fs.existsSync(resolveByPKG(`./.jiek-production-tag`))
|
23
|
+
|
24
|
+
if (!isProduction) {
|
25
|
+
require('esbuild-register')
|
26
|
+
}
|
27
|
+
|
28
|
+
const binPath = isProduction
|
29
|
+
? resolveByPKG(`./dist/bin/${binFilename}`)
|
30
|
+
: resolveByPKG(`./src/bin/${binFilename.replace(/(\.[cm]?)js$/, '$1ts')}`)
|
31
|
+
require(binPath)
|
@@ -0,0 +1 @@
|
|
1
|
+
export {}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {}
|
package/bin-helper/package.json
CHANGED
@@ -0,0 +1,95 @@
|
|
1
|
+
import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
|
2
|
+
import { r as require } from './jiek_create-require.CxSGbkTB.js';
|
3
|
+
import fs from 'node:fs';
|
4
|
+
import path from 'node:path';
|
5
|
+
import process$1 from 'node:process';
|
6
|
+
import { program } from 'commander';
|
7
|
+
import { load } from 'js-yaml';
|
8
|
+
import { getRoot } from '../utils/getRoot.js';
|
9
|
+
|
10
|
+
let type = "";
|
11
|
+
try {
|
12
|
+
require.resolve("@pnpm/filter-workspace-packages");
|
13
|
+
type = "pnpm";
|
14
|
+
} catch {
|
15
|
+
}
|
16
|
+
async function filterPackagesGraph(filters) {
|
17
|
+
return Promise.all(filters.map(async (filter) => getSelectedProjectsGraph(filter)));
|
18
|
+
}
|
19
|
+
async function getSelectedProjectsGraph(filter = program.getOptionValue("filter")) {
|
20
|
+
const { wd, notWorkspace } = getWD();
|
21
|
+
let root = getRoot();
|
22
|
+
if (notWorkspace) {
|
23
|
+
return {
|
24
|
+
root,
|
25
|
+
value: {
|
26
|
+
[wd]: JSON.parse(fs.readFileSync(path.resolve(wd, "package.json"), "utf-8"))
|
27
|
+
}
|
28
|
+
};
|
29
|
+
}
|
30
|
+
if (type === "pnpm") {
|
31
|
+
const pnpmWorkspaceFilePath = path.resolve(wd, "pnpm-workspace.yaml");
|
32
|
+
const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, "utf-8");
|
33
|
+
const pnpmWorkspace = load(pnpmWorkspaceFileContent);
|
34
|
+
if (root === wd && filter == null) {
|
35
|
+
throw new Error("root path is workspace root, please provide a filter");
|
36
|
+
}
|
37
|
+
if (root === void 0) {
|
38
|
+
root = process$1.cwd();
|
39
|
+
}
|
40
|
+
if (root !== wd && filter == null) {
|
41
|
+
const packageJSONIsExist = fs.existsSync(path.resolve(root, "package.json"));
|
42
|
+
if (!packageJSONIsExist) {
|
43
|
+
throw new Error("root path is not workspace root, please provide a filter");
|
44
|
+
}
|
45
|
+
const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, "package.json"), "utf-8"));
|
46
|
+
if (packageJSON.name == null) {
|
47
|
+
throw new Error("root path is not workspace root, please provide a filter");
|
48
|
+
}
|
49
|
+
filter = packageJSON.name;
|
50
|
+
}
|
51
|
+
const { filterPackagesFromDir } = await import('@pnpm/filter-workspace-packages');
|
52
|
+
const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{
|
53
|
+
filter: filter ?? "",
|
54
|
+
followProdDepsOnly: true
|
55
|
+
}], {
|
56
|
+
prefix: root,
|
57
|
+
workspaceDir: wd,
|
58
|
+
patterns: pnpmWorkspace.packages
|
59
|
+
});
|
60
|
+
return {
|
61
|
+
root,
|
62
|
+
value: Object.entries(selectedProjectsGraph).reduce((acc, [key, value]) => {
|
63
|
+
acc[key] = value.package.manifest;
|
64
|
+
return acc;
|
65
|
+
}, {})
|
66
|
+
};
|
67
|
+
}
|
68
|
+
throw new Error(`not supported package manager ${type}`);
|
69
|
+
}
|
70
|
+
|
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 };
|
@@ -0,0 +1,105 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var getWorkspaceDir = require('@jiek/utils/getWorkspaceDir');
|
4
|
+
var jiek_createRequire = require('./jiek_create-require.CWFWNQHj.cjs');
|
5
|
+
var fs = require('node:fs');
|
6
|
+
var path = require('node:path');
|
7
|
+
var process$1 = require('node:process');
|
8
|
+
var commander = require('commander');
|
9
|
+
var jsYaml = require('js-yaml');
|
10
|
+
var getRoot = require('../utils/getRoot.cjs');
|
11
|
+
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
13
|
+
|
14
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
15
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
16
|
+
var process__default = /*#__PURE__*/_interopDefault(process$1);
|
17
|
+
|
18
|
+
exports.type = "";
|
19
|
+
try {
|
20
|
+
jiek_createRequire.require.resolve("@pnpm/filter-workspace-packages");
|
21
|
+
exports.type = "pnpm";
|
22
|
+
} catch {
|
23
|
+
}
|
24
|
+
async function filterPackagesGraph(filters) {
|
25
|
+
return Promise.all(filters.map(async (filter) => getSelectedProjectsGraph(filter)));
|
26
|
+
}
|
27
|
+
async function getSelectedProjectsGraph(filter = commander.program.getOptionValue("filter")) {
|
28
|
+
const { wd, notWorkspace } = getWD();
|
29
|
+
let root = getRoot.getRoot();
|
30
|
+
if (notWorkspace) {
|
31
|
+
return {
|
32
|
+
root,
|
33
|
+
value: {
|
34
|
+
[wd]: JSON.parse(fs__default.default.readFileSync(path__default.default.resolve(wd, "package.json"), "utf-8"))
|
35
|
+
}
|
36
|
+
};
|
37
|
+
}
|
38
|
+
if (exports.type === "pnpm") {
|
39
|
+
const pnpmWorkspaceFilePath = path__default.default.resolve(wd, "pnpm-workspace.yaml");
|
40
|
+
const pnpmWorkspaceFileContent = fs__default.default.readFileSync(pnpmWorkspaceFilePath, "utf-8");
|
41
|
+
const pnpmWorkspace = jsYaml.load(pnpmWorkspaceFileContent);
|
42
|
+
if (root === wd && filter == null) {
|
43
|
+
throw new Error("root path is workspace root, please provide a filter");
|
44
|
+
}
|
45
|
+
if (root === void 0) {
|
46
|
+
root = process__default.default.cwd();
|
47
|
+
}
|
48
|
+
if (root !== wd && filter == null) {
|
49
|
+
const packageJSONIsExist = fs__default.default.existsSync(path__default.default.resolve(root, "package.json"));
|
50
|
+
if (!packageJSONIsExist) {
|
51
|
+
throw new Error("root path is not workspace root, please provide a filter");
|
52
|
+
}
|
53
|
+
const packageJSON = JSON.parse(fs__default.default.readFileSync(path__default.default.resolve(root, "package.json"), "utf-8"));
|
54
|
+
if (packageJSON.name == null) {
|
55
|
+
throw new Error("root path is not workspace root, please provide a filter");
|
56
|
+
}
|
57
|
+
filter = packageJSON.name;
|
58
|
+
}
|
59
|
+
const { filterPackagesFromDir } = await import('@pnpm/filter-workspace-packages');
|
60
|
+
const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{
|
61
|
+
filter: filter ?? "",
|
62
|
+
followProdDepsOnly: true
|
63
|
+
}], {
|
64
|
+
prefix: root,
|
65
|
+
workspaceDir: wd,
|
66
|
+
patterns: pnpmWorkspace.packages
|
67
|
+
});
|
68
|
+
return {
|
69
|
+
root,
|
70
|
+
value: Object.entries(selectedProjectsGraph).reduce((acc, [key, value]) => {
|
71
|
+
acc[key] = value.package.manifest;
|
72
|
+
return acc;
|
73
|
+
}, {})
|
74
|
+
};
|
75
|
+
}
|
76
|
+
throw new Error(`not supported package manager ${exports.type}`);
|
77
|
+
}
|
78
|
+
|
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
|
+
exports.filterPackagesGraph = filterPackagesGraph;
|
104
|
+
exports.getSelectedProjectsGraph = getSelectedProjectsGraph;
|
105
|
+
exports.getWD = getWD;
|