jiek 2.2.6 → 2.2.7-alpha.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 +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/+/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/.internal/getWD-BRJ3PK1S.js +105 -0
- package/dist/.internal/getWD-Cmxzjf-f.js +95 -0
- package/dist/{cli.js → .internal/index-B6RQz1DZ.js} +1 -735
- package/dist/{cli.cjs → .internal/index-DlHFuTjM.js} +1 -757
- package/dist/.internal/jiek_create-require-CWFWNQHj.js +5 -0
- package/dist/.internal/jiek_create-require-CxSGbkTB.js +5 -0
- package/dist/.internal/package.json +10 -0
- package/dist/bin/build.cjs +505 -0
- package/dist/bin/index.cjs +488 -0
- package/dist/index.d.cts +1 -113
- package/dist/index.d.ts +1 -113
- package/dist/rollup/index.cjs +282 -4569
- package/dist/rollup/index.d.cts +7 -1
- package/dist/rollup/index.d.ts +7 -1
- package/dist/rollup/index.js +270 -4554
- package/package.json +25 -28
- 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 +218 -209
- package/src/commands/meta.ts +1 -1
- package/src/commands/publish.ts +87 -25
- package/src/rollup/base.ts +2 -2
- package/src/rollup/index.ts +309 -115
- 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
@@ -0,0 +1,92 @@
|
|
1
|
+
import * as rollup from 'rollup';
|
2
|
+
import { AnalyzerPluginInternalAPI } from 'vite-bundle-analyzer';
|
3
|
+
|
4
|
+
type Module = ReturnType<AnalyzerPluginInternalAPI['processModule']>[number];
|
5
|
+
declare function bundleAnalyzer(modulesResolved: (modules: Module[]) => void): never[] | readonly [Promise<{
|
6
|
+
name: string;
|
7
|
+
closeBundle(this: rollup.PluginContext): Promise<void>;
|
8
|
+
}>, Promise<{
|
9
|
+
name: string;
|
10
|
+
api?: any;
|
11
|
+
cacheKey?: string;
|
12
|
+
version?: string;
|
13
|
+
augmentChunkHash?: rollup.ObjectHook<(this: rollup.PluginContext, chunk: rollup.RenderedChunk) => string | void, {}> | undefined;
|
14
|
+
generateBundle?: rollup.ObjectHook<(this: rollup.PluginContext, options: rollup.NormalizedOutputOptions, bundle: rollup.OutputBundle, isWrite: boolean) => void | Promise<void>, {}> | undefined;
|
15
|
+
outputOptions?: rollup.ObjectHook<(this: rollup.PluginContext, options: rollup.OutputOptions) => rollup.OutputOptions | rollup.NullValue, {}> | undefined;
|
16
|
+
renderChunk?: rollup.ObjectHook<(this: rollup.PluginContext, code: string, chunk: rollup.RenderedChunk, options: rollup.NormalizedOutputOptions, meta: {
|
17
|
+
chunks: Record<string, rollup.RenderedChunk>;
|
18
|
+
}) => string | rollup.NullValue | {
|
19
|
+
code: string;
|
20
|
+
map?: rollup.SourceMapInput;
|
21
|
+
} | Promise<string | rollup.NullValue | {
|
22
|
+
code: string;
|
23
|
+
map?: rollup.SourceMapInput;
|
24
|
+
}>, {}> | undefined;
|
25
|
+
renderDynamicImport?: rollup.ObjectHook<(this: rollup.PluginContext, options: {
|
26
|
+
customResolution: string | null;
|
27
|
+
format: rollup.InternalModuleFormat;
|
28
|
+
moduleId: string;
|
29
|
+
targetModuleId: string | null;
|
30
|
+
}) => {
|
31
|
+
left: string;
|
32
|
+
right: string;
|
33
|
+
} | rollup.NullValue, {}> | undefined;
|
34
|
+
renderError?: rollup.ObjectHook<(this: rollup.PluginContext, error?: Error | undefined) => void | Promise<void>, {
|
35
|
+
sequential?: boolean;
|
36
|
+
}> | undefined;
|
37
|
+
renderStart?: rollup.ObjectHook<(this: rollup.PluginContext, outputOptions: rollup.NormalizedOutputOptions, inputOptions: rollup.NormalizedInputOptions) => void | Promise<void>, {
|
38
|
+
sequential?: boolean;
|
39
|
+
}> | undefined;
|
40
|
+
resolveFileUrl?: rollup.ObjectHook<rollup.ResolveFileUrlHook, {}> | undefined;
|
41
|
+
resolveImportMeta?: rollup.ObjectHook<rollup.ResolveImportMetaHook, {}> | undefined;
|
42
|
+
writeBundle?: rollup.ObjectHook<(this: rollup.PluginContext, options: rollup.NormalizedOutputOptions, bundle: rollup.OutputBundle) => void | Promise<void>, {
|
43
|
+
sequential?: boolean;
|
44
|
+
}> | undefined;
|
45
|
+
banner?: rollup.ObjectHook<rollup.AddonHook, {}> | undefined;
|
46
|
+
footer?: rollup.ObjectHook<rollup.AddonHook, {}> | undefined;
|
47
|
+
intro?: rollup.ObjectHook<rollup.AddonHook, {}> | undefined;
|
48
|
+
outro?: rollup.ObjectHook<rollup.AddonHook, {}> | undefined;
|
49
|
+
buildEnd?: rollup.ObjectHook<(this: rollup.PluginContext, error?: Error | undefined) => void | Promise<void>, {
|
50
|
+
sequential?: boolean;
|
51
|
+
}> | undefined;
|
52
|
+
buildStart?: rollup.ObjectHook<(this: rollup.PluginContext, options: rollup.NormalizedInputOptions) => void | Promise<void>, {
|
53
|
+
sequential?: boolean;
|
54
|
+
}> | undefined;
|
55
|
+
closeBundle?: rollup.ObjectHook<(this: rollup.PluginContext) => void | Promise<void>, {
|
56
|
+
sequential?: boolean;
|
57
|
+
}> | undefined;
|
58
|
+
closeWatcher?: rollup.ObjectHook<(this: rollup.PluginContext) => void | Promise<void>, {
|
59
|
+
sequential?: boolean;
|
60
|
+
}> | undefined;
|
61
|
+
load?: rollup.ObjectHook<(this: rollup.PluginContext, id: string) => rollup.LoadResult | Promise<rollup.LoadResult>, {}> | undefined;
|
62
|
+
moduleParsed?: rollup.ObjectHook<(this: rollup.PluginContext, info: rollup.ModuleInfo) => void | Promise<void>, {
|
63
|
+
sequential?: boolean;
|
64
|
+
}> | undefined;
|
65
|
+
onLog?: rollup.ObjectHook<(this: rollup.MinimalPluginContext, level: rollup.LogLevel, log: rollup.RollupLog) => boolean | rollup.NullValue, {}> | undefined;
|
66
|
+
options?: rollup.ObjectHook<(this: rollup.MinimalPluginContext, options: rollup.InputOptions) => rollup.NullValue | rollup.InputOptions | Promise<rollup.NullValue | rollup.InputOptions>, {}> | undefined;
|
67
|
+
resolveDynamicImport?: rollup.ObjectHook<(this: rollup.PluginContext, specifier: string | rollup.AstNode, importer: string, options: {
|
68
|
+
attributes: Record<string, string>;
|
69
|
+
}) => rollup.ResolveIdResult | Promise<rollup.ResolveIdResult>, {}> | undefined;
|
70
|
+
resolveId?: rollup.ObjectHook<(this: rollup.PluginContext, source: string, importer: string | undefined, options: {
|
71
|
+
attributes: Record<string, string>;
|
72
|
+
custom?: rollup.CustomPluginOptions;
|
73
|
+
isEntry: boolean;
|
74
|
+
}) => rollup.ResolveIdResult | Promise<rollup.ResolveIdResult>, {}> | undefined;
|
75
|
+
shouldTransformCachedModule?: rollup.ObjectHook<(this: rollup.PluginContext, options: {
|
76
|
+
ast: rollup.ProgramNode;
|
77
|
+
code: string;
|
78
|
+
id: string;
|
79
|
+
meta: rollup.CustomPluginOptions;
|
80
|
+
moduleSideEffects: boolean | "no-treeshake";
|
81
|
+
resolvedSources: rollup.ResolvedIdMap;
|
82
|
+
syntheticNamedExports: boolean | string;
|
83
|
+
}) => boolean | rollup.NullValue | Promise<boolean | rollup.NullValue>, {}> | undefined;
|
84
|
+
transform?: rollup.ObjectHook<(this: rollup.TransformPluginContext, code: string, id: string) => rollup.TransformResult | Promise<rollup.TransformResult>, {}> | undefined;
|
85
|
+
watchChange?: rollup.ObjectHook<(this: rollup.PluginContext, id: string, change: {
|
86
|
+
event: rollup.ChangeEvent;
|
87
|
+
}) => void | Promise<void>, {
|
88
|
+
sequential?: boolean;
|
89
|
+
}> | undefined;
|
90
|
+
}>];
|
91
|
+
|
92
|
+
export { type Module, bundleAnalyzer };
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import process from 'node:process';
|
2
|
+
|
3
|
+
const {
|
4
|
+
JIEK_ANALYZER
|
5
|
+
} = process.env;
|
6
|
+
const ANALYZER = JIEK_ANALYZER != null && JSON.parse(JIEK_ANALYZER);
|
7
|
+
function bundleAnalyzer(modulesResolved) {
|
8
|
+
if (!ANALYZER) {
|
9
|
+
return [];
|
10
|
+
}
|
11
|
+
const defaultSizes = {
|
12
|
+
parsed: "parsed",
|
13
|
+
stat: "stat",
|
14
|
+
gzip: "gzip"
|
15
|
+
}[ANALYZER.size ?? "stat"] ?? "parsed";
|
16
|
+
let ana;
|
17
|
+
async function initAna() {
|
18
|
+
const { adapter, analyzer } = await import('vite-bundle-analyzer');
|
19
|
+
ana = ana ?? adapter(analyzer({
|
20
|
+
defaultSizes,
|
21
|
+
analyzerMode: modulesResolved
|
22
|
+
}));
|
23
|
+
}
|
24
|
+
return [
|
25
|
+
(async () => {
|
26
|
+
await initAna();
|
27
|
+
return {
|
28
|
+
name: "jiek:bundle-analyzer",
|
29
|
+
async closeBundle(...args) {
|
30
|
+
if (typeof ana.closeBundle !== "function") return;
|
31
|
+
return ana.closeBundle?.call(this, ...args);
|
32
|
+
}
|
33
|
+
};
|
34
|
+
})(),
|
35
|
+
(async () => {
|
36
|
+
await initAna();
|
37
|
+
return {
|
38
|
+
...ana,
|
39
|
+
name: "jiek:bundle-analyzer-output"
|
40
|
+
};
|
41
|
+
})()
|
42
|
+
];
|
43
|
+
}
|
44
|
+
|
45
|
+
export { bundleAnalyzer };
|
@@ -0,0 +1,33 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var Koa = require('koa');
|
4
|
+
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
6
|
+
|
7
|
+
var Koa__default = /*#__PURE__*/_interopDefault(Koa);
|
8
|
+
|
9
|
+
const createServer = (port, host) => {
|
10
|
+
const app = new Koa__default.default();
|
11
|
+
app.listen(port, host);
|
12
|
+
const streams = /* @__PURE__ */ new Map();
|
13
|
+
app.use(async (ctx) => {
|
14
|
+
let stream = streams.get(ctx.path);
|
15
|
+
if (stream == null) {
|
16
|
+
const maybeKey = streams.keys().find((p) => ctx.path.startsWith(p));
|
17
|
+
stream = maybeKey != null ? streams.get(maybeKey) : void 0;
|
18
|
+
}
|
19
|
+
if (stream != null) {
|
20
|
+
ctx.body = stream;
|
21
|
+
}
|
22
|
+
});
|
23
|
+
return {
|
24
|
+
port,
|
25
|
+
host,
|
26
|
+
rootUrl: `http://${host}:${port}`,
|
27
|
+
renderTo: async (path, stream) => {
|
28
|
+
streams.set(path, stream);
|
29
|
+
}
|
30
|
+
};
|
31
|
+
};
|
32
|
+
|
33
|
+
exports.createServer = createServer;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import Koa from 'koa';
|
2
|
+
|
3
|
+
const createServer = (port, host) => {
|
4
|
+
const app = new Koa();
|
5
|
+
app.listen(port, host);
|
6
|
+
const streams = /* @__PURE__ */ new Map();
|
7
|
+
app.use(async (ctx) => {
|
8
|
+
let stream = streams.get(ctx.path);
|
9
|
+
if (stream == null) {
|
10
|
+
const maybeKey = streams.keys().find((p) => ctx.path.startsWith(p));
|
11
|
+
stream = maybeKey != null ? streams.get(maybeKey) : void 0;
|
12
|
+
}
|
13
|
+
if (stream != null) {
|
14
|
+
ctx.body = stream;
|
15
|
+
}
|
16
|
+
});
|
17
|
+
return {
|
18
|
+
port,
|
19
|
+
host,
|
20
|
+
rootUrl: `http://${host}:${port}`,
|
21
|
+
renderTo: async (path, stream) => {
|
22
|
+
streams.set(path, stream);
|
23
|
+
}
|
24
|
+
};
|
25
|
+
};
|
26
|
+
|
27
|
+
export { createServer };
|
@@ -0,0 +1,39 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var jiek_createRequire = require('../../jiek_create-require-CWFWNQHj.js');
|
4
|
+
var node_child_process = require('node:child_process');
|
5
|
+
var process = require('node:process');
|
6
|
+
var prompts = require('@inquirer/prompts');
|
7
|
+
var filterSupport = require('../../getWD-BRJ3PK1S.js');
|
8
|
+
require('@jiek/utils/getWorkspaceDir');
|
9
|
+
require('node:fs');
|
10
|
+
require('node:path');
|
11
|
+
require('commander');
|
12
|
+
require('js-yaml');
|
13
|
+
require('./getRoot.cjs');
|
14
|
+
|
15
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
16
|
+
|
17
|
+
var process__default = /*#__PURE__*/_interopDefault(process);
|
18
|
+
|
19
|
+
async function checkDependency(dependency) {
|
20
|
+
try {
|
21
|
+
jiek_createRequire.require.resolve(dependency);
|
22
|
+
} catch {
|
23
|
+
console.error(`The package '${dependency}' is not installed, please install it first.`);
|
24
|
+
const { notWorkspace } = filterSupport.getWD();
|
25
|
+
const command = `pnpm add -${notWorkspace ? "" : "w"}D ${dependency}`;
|
26
|
+
if (await prompts.confirm({ message: `Do you want to add it now? (${command})` })) {
|
27
|
+
node_child_process.execSync(command, {
|
28
|
+
stdio: "inherit",
|
29
|
+
cwd: process__default.default.cwd(),
|
30
|
+
env: process__default.default.env
|
31
|
+
});
|
32
|
+
} else {
|
33
|
+
console.warn(`You can run the command '${command}' to install it manually.`);
|
34
|
+
process__default.default.exit(1);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
exports.checkDependency = checkDependency;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { r as require } from '../../jiek_create-require-CxSGbkTB.js';
|
2
|
+
import { execSync } from 'node:child_process';
|
3
|
+
import process from 'node:process';
|
4
|
+
import { confirm } from '@inquirer/prompts';
|
5
|
+
import { g as getWD } from '../../getWD-Cmxzjf-f.js';
|
6
|
+
import 'node:module';
|
7
|
+
import '@jiek/utils/getWorkspaceDir';
|
8
|
+
import 'node:fs';
|
9
|
+
import 'node:path';
|
10
|
+
import 'commander';
|
11
|
+
import 'js-yaml';
|
12
|
+
import './getRoot.js';
|
13
|
+
|
14
|
+
async function checkDependency(dependency) {
|
15
|
+
try {
|
16
|
+
require.resolve(dependency);
|
17
|
+
} catch {
|
18
|
+
console.error(`The package '${dependency}' is not installed, please install it first.`);
|
19
|
+
const { notWorkspace } = getWD();
|
20
|
+
const command = `pnpm add -${notWorkspace ? "" : "w"}D ${dependency}`;
|
21
|
+
if (await confirm({ message: `Do you want to add it now? (${command})` })) {
|
22
|
+
execSync(command, {
|
23
|
+
stdio: "inherit",
|
24
|
+
cwd: process.cwd(),
|
25
|
+
env: process.env
|
26
|
+
});
|
27
|
+
} else {
|
28
|
+
console.warn(`You can run the command '${command}' to install it manually.`);
|
29
|
+
process.exit(1);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
export { checkDependency };
|
@@ -0,0 +1,20 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
require('../../jiek_create-require-CWFWNQHj.js');
|
4
|
+
require('node:fs');
|
5
|
+
require('node:path');
|
6
|
+
require('node:process');
|
7
|
+
require('commander');
|
8
|
+
require('js-yaml');
|
9
|
+
require('./getRoot.cjs');
|
10
|
+
var filterSupport = require('../../getWD-BRJ3PK1S.js');
|
11
|
+
require('@jiek/utils/getWorkspaceDir');
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
exports.filterPackagesGraph = filterSupport.filterPackagesGraph;
|
16
|
+
exports.getSelectedProjectsGraph = filterSupport.getSelectedProjectsGraph;
|
17
|
+
Object.defineProperty(exports, "type", {
|
18
|
+
enumerable: true,
|
19
|
+
get: function () { return filterSupport.type; }
|
20
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
declare let type: string;
|
2
|
+
interface Manifest {
|
3
|
+
name?: string;
|
4
|
+
type?: string;
|
5
|
+
exports?: string | string[] | Record<string, unknown>;
|
6
|
+
imports?: Record<string, unknown>;
|
7
|
+
}
|
8
|
+
interface ProjectsGraph {
|
9
|
+
root?: string;
|
10
|
+
value?: Record<string, Manifest>;
|
11
|
+
}
|
12
|
+
declare function filterPackagesGraph(filters: string[]): Promise<ProjectsGraph[]>;
|
13
|
+
declare function getSelectedProjectsGraph(filter?: string | undefined): Promise<ProjectsGraph>;
|
14
|
+
|
15
|
+
export { type Manifest, type ProjectsGraph, filterPackagesGraph, getSelectedProjectsGraph, type };
|
@@ -0,0 +1,15 @@
|
|
1
|
+
declare let type: string;
|
2
|
+
interface Manifest {
|
3
|
+
name?: string;
|
4
|
+
type?: string;
|
5
|
+
exports?: string | string[] | Record<string, unknown>;
|
6
|
+
imports?: Record<string, unknown>;
|
7
|
+
}
|
8
|
+
interface ProjectsGraph {
|
9
|
+
root?: string;
|
10
|
+
value?: Record<string, Manifest>;
|
11
|
+
}
|
12
|
+
declare function filterPackagesGraph(filters: string[]): Promise<ProjectsGraph[]>;
|
13
|
+
declare function getSelectedProjectsGraph(filter?: string | undefined): Promise<ProjectsGraph>;
|
14
|
+
|
15
|
+
export { type Manifest, type ProjectsGraph, filterPackagesGraph, getSelectedProjectsGraph, type };
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import '../../jiek_create-require-CxSGbkTB.js';
|
2
|
+
import 'node:fs';
|
3
|
+
import 'node:path';
|
4
|
+
import 'node:process';
|
5
|
+
import 'commander';
|
6
|
+
import 'js-yaml';
|
7
|
+
import './getRoot.js';
|
8
|
+
export { f as filterPackagesGraph, a as getSelectedProjectsGraph, t as type } from '../../getWD-Cmxzjf-f.js';
|
9
|
+
import 'node:module';
|
10
|
+
import '@jiek/utils/getWorkspaceDir';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var path = require('node:path');
|
4
|
+
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
6
|
+
|
7
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
8
|
+
|
9
|
+
let root;
|
10
|
+
function getRoot() {
|
11
|
+
if (root) return root;
|
12
|
+
const rootOption = process.env.JIEK_ROOT;
|
13
|
+
root = rootOption ? path__default.default.isAbsolute(rootOption) ? rootOption : path__default.default.resolve(process.cwd(), rootOption) : void 0;
|
14
|
+
return root;
|
15
|
+
}
|
16
|
+
|
17
|
+
exports.getRoot = getRoot;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import path from 'node:path';
|
2
|
+
|
3
|
+
let root;
|
4
|
+
function getRoot() {
|
5
|
+
if (root) return root;
|
6
|
+
const rootOption = process.env.JIEK_ROOT;
|
7
|
+
root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
|
8
|
+
return root;
|
9
|
+
}
|
10
|
+
|
11
|
+
export { getRoot };
|
@@ -0,0 +1,15 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
require('@jiek/utils/getWorkspaceDir');
|
4
|
+
var filterSupport = require('../../getWD-BRJ3PK1S.js');
|
5
|
+
require('./getRoot.cjs');
|
6
|
+
require('../../jiek_create-require-CWFWNQHj.js');
|
7
|
+
require('node:fs');
|
8
|
+
require('node:path');
|
9
|
+
require('node:process');
|
10
|
+
require('commander');
|
11
|
+
require('js-yaml');
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
exports.getWD = filterSupport.getWD;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import '@jiek/utils/getWorkspaceDir';
|
2
|
+
export { g as getWD } from '../../getWD-Cmxzjf-f.js';
|
3
|
+
import './getRoot.js';
|
4
|
+
import '../../jiek_create-require-CxSGbkTB.js';
|
5
|
+
import 'node:module';
|
6
|
+
import 'node:fs';
|
7
|
+
import 'node:path';
|
8
|
+
import 'node:process';
|
9
|
+
import 'commander';
|
10
|
+
import 'js-yaml';
|
@@ -0,0 +1,100 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var jiek_createRequire = require('../../jiek_create-require-CWFWNQHj.js');
|
4
|
+
var fs = require('node:fs');
|
5
|
+
var path = require('node:path');
|
6
|
+
var commander = require('commander');
|
7
|
+
var jsYaml = require('js-yaml');
|
8
|
+
var filterSupport = require('../../getWD-BRJ3PK1S.js');
|
9
|
+
var tsRegister = require('./tsRegister.cjs');
|
10
|
+
require('@jiek/utils/getWorkspaceDir');
|
11
|
+
require('node:process');
|
12
|
+
require('./getRoot.cjs');
|
13
|
+
|
14
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
15
|
+
|
16
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
17
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
18
|
+
|
19
|
+
let configName = "jiek.config";
|
20
|
+
function getConfigPath(root, dir) {
|
21
|
+
const isSupportTsLoader = !!tsRegister.tsRegisterName;
|
22
|
+
function configWithExtIsExist(ext) {
|
23
|
+
const filenames = [
|
24
|
+
path__default.default.resolve(process.cwd(), `${configName}.${ext}`),
|
25
|
+
path__default.default.resolve(process.cwd(), `.${configName}.${ext}`),
|
26
|
+
path__default.default.resolve(root, `${configName}.${ext}`),
|
27
|
+
path__default.default.resolve(root, `.${configName}.${ext}`)
|
28
|
+
];
|
29
|
+
if (dir) {
|
30
|
+
filenames.unshift(...[
|
31
|
+
path__default.default.resolve(dir, `${configName}.${ext}`),
|
32
|
+
path__default.default.resolve(dir, `.${configName}.${ext}`)
|
33
|
+
]);
|
34
|
+
}
|
35
|
+
for (const filename of filenames) {
|
36
|
+
if (fs__default.default.existsSync(filename) && fs__default.default.lstatSync(filename).isFile()) {
|
37
|
+
return filename;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
configName = configWithExtIsExist("js") ?? configName;
|
43
|
+
configName = configWithExtIsExist("json") ?? configName;
|
44
|
+
configName = configWithExtIsExist("yaml") ?? configName;
|
45
|
+
if (isSupportTsLoader) {
|
46
|
+
configName = configWithExtIsExist("ts") ?? configName;
|
47
|
+
}
|
48
|
+
return path__default.default.resolve(root, configName);
|
49
|
+
}
|
50
|
+
function loadConfig(dirOrOptions) {
|
51
|
+
let dir;
|
52
|
+
let root;
|
53
|
+
if (typeof dirOrOptions === "object") {
|
54
|
+
dir = dirOrOptions.dir;
|
55
|
+
root = dirOrOptions.root ?? filterSupport.getWD().wd;
|
56
|
+
} else {
|
57
|
+
dir = dirOrOptions;
|
58
|
+
root = filterSupport.getWD().wd;
|
59
|
+
}
|
60
|
+
let configPath = commander.program.getOptionValue("configPath");
|
61
|
+
if (!configPath) {
|
62
|
+
configPath = getConfigPath(root, dir);
|
63
|
+
} else {
|
64
|
+
if (!fs__default.default.existsSync(configPath)) {
|
65
|
+
throw new Error(`config file not found: ${configPath}`);
|
66
|
+
}
|
67
|
+
if (!path__default.default.isAbsolute(configPath)) {
|
68
|
+
configPath = path__default.default.resolve(root, configPath);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
const ext = path__default.default.extname(configPath);
|
72
|
+
let module;
|
73
|
+
switch (ext) {
|
74
|
+
case ".js":
|
75
|
+
module = jiek_createRequire.require(configPath);
|
76
|
+
break;
|
77
|
+
case ".json":
|
78
|
+
return jiek_createRequire.require(configPath);
|
79
|
+
case ".yaml":
|
80
|
+
return jsYaml.load(fs__default.default.readFileSync(configPath, "utf-8"));
|
81
|
+
case ".ts":
|
82
|
+
if (tsRegister.tsRegisterName) {
|
83
|
+
jiek_createRequire.require(tsRegister.tsRegisterName);
|
84
|
+
module = jiek_createRequire.require(configPath);
|
85
|
+
break;
|
86
|
+
}
|
87
|
+
throw new Error(
|
88
|
+
"ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register"
|
89
|
+
);
|
90
|
+
case ".config":
|
91
|
+
module = {};
|
92
|
+
break;
|
93
|
+
default:
|
94
|
+
throw new Error(`unsupported config file type: ${ext}`);
|
95
|
+
}
|
96
|
+
if (!module) throw new Error("config file is empty");
|
97
|
+
return module.default ?? module;
|
98
|
+
}
|
99
|
+
|
100
|
+
exports.loadConfig = loadConfig;
|