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
@@ -0,0 +1,17 @@
|
|
1
|
+
const entriesDescription = `
|
2
|
+
Specify the build entry-points of the package.json's 'exports' field.
|
3
|
+
Support glob pattern and array.
|
4
|
+
.e.g. '.', './*', './sub/*', './a,./b'.
|
5
|
+
`.trim();
|
6
|
+
const filterDescription = `
|
7
|
+
Filter the packages from the workspace.
|
8
|
+
Support fuzzy match and array.
|
9
|
+
.e.g. 'core,utils'.
|
10
|
+
`.trim();
|
11
|
+
const outdirDescription = `
|
12
|
+
The output directory of the build, which relative to the target subpackage root directory.
|
13
|
+
Support with variables: 'PKG_NAME',
|
14
|
+
.e.g. 'dist/{{PKG_NAME}}'.
|
15
|
+
`.trim();
|
16
|
+
|
17
|
+
export { entriesDescription, filterDescription, outdirDescription };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var filterSupport = require('../.chunks/getWD.ZF0avqDB.cjs');
|
4
|
+
require('@jiek/utils/getWorkspaceDir');
|
5
|
+
require('../.chunks/jiek_create-require.CWFWNQHj.cjs');
|
6
|
+
require('node:fs');
|
7
|
+
require('node:path');
|
8
|
+
require('node:process');
|
9
|
+
require('commander');
|
10
|
+
require('js-yaml');
|
11
|
+
require('../utils/getRoot.cjs');
|
12
|
+
|
13
|
+
const { notWorkspace } = filterSupport.getWD();
|
14
|
+
const IS_WORKSPACE = !notWorkspace;
|
15
|
+
|
16
|
+
exports.IS_WORKSPACE = IS_WORKSPACE;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { g as getWD } from '../.chunks/getWD.D6wq8Qc2.js';
|
2
|
+
import '@jiek/utils/getWorkspaceDir';
|
3
|
+
import '../.chunks/jiek_create-require.CxSGbkTB.js';
|
4
|
+
import 'node:module';
|
5
|
+
import 'node:fs';
|
6
|
+
import 'node:path';
|
7
|
+
import 'node:process';
|
8
|
+
import 'commander';
|
9
|
+
import 'js-yaml';
|
10
|
+
import '../utils/getRoot.js';
|
11
|
+
|
12
|
+
const { notWorkspace } = getWD();
|
13
|
+
const IS_WORKSPACE = !notWorkspace;
|
14
|
+
|
15
|
+
export { IS_WORKSPACE };
|
@@ -0,0 +1,10 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const BUILDER_TYPES = ["esbuild", "swc"];
|
4
|
+
const BUILDER_TYPE_PACKAGE_NAME_MAP = {
|
5
|
+
esbuild: "rollup-plugin-esbuild",
|
6
|
+
swc: "rollup-plugin-swc3"
|
7
|
+
};
|
8
|
+
|
9
|
+
exports.BUILDER_TYPES = BUILDER_TYPES;
|
10
|
+
exports.BUILDER_TYPE_PACKAGE_NAME_MAP = BUILDER_TYPE_PACKAGE_NAME_MAP;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as _rollup_plugin_terser from '@rollup/plugin-terser';
|
2
2
|
import * as rollup_plugin_swc3 from 'rollup-plugin-swc3';
|
3
3
|
import * as rollup_plugin_esbuild from 'rollup-plugin-esbuild';
|
4
|
-
import {
|
4
|
+
import { OutputOptions, InputPluginOption } from 'rollup';
|
5
5
|
|
6
6
|
type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
|
7
7
|
js?: OutputOptions[K];
|
@@ -18,6 +18,10 @@ interface ConfigGenerateContext {
|
|
18
18
|
}
|
19
19
|
type OutputControl = boolean | ((context: ConfigGenerateContext) => boolean);
|
20
20
|
declare const BUILDER_TYPES: readonly ["esbuild", "swc"];
|
21
|
+
declare const BUILDER_TYPE_PACKAGE_NAME_MAP: {
|
22
|
+
esbuild: string;
|
23
|
+
swc: string;
|
24
|
+
};
|
21
25
|
interface TemplateOptions {
|
22
26
|
/**
|
23
27
|
* When the user configures type: module, the generated output from entry points that don't
|
@@ -45,9 +49,9 @@ interface TemplateOptions {
|
|
45
49
|
* When use esbuild type builder, it will inject `supported.import-attributes` option.
|
46
50
|
* When use swc type builder, it will inject `jsc.experimental.keepImportAttributes` option.
|
47
51
|
*
|
48
|
-
* And it will auto set the rollup output externalImportAttributes and importAttributesKey options.
|
52
|
+
* And it will auto set the rollup output `externalImportAttributes` and `importAttributesKey` options.
|
49
53
|
*
|
50
|
-
* @default
|
54
|
+
* @default false
|
51
55
|
*/
|
52
56
|
keepImportAttributes?: boolean | 'assert';
|
53
57
|
};
|
@@ -112,15 +116,4 @@ interface TemplateOptions {
|
|
112
116
|
injects?: Record<string, string | [string, string]>;
|
113
117
|
}
|
114
118
|
|
115
|
-
|
116
|
-
interface Config {
|
117
|
-
build?: TemplateOptions & {
|
118
|
-
/**
|
119
|
-
* Whether to run in silent mode, only active when configured in the workspace root or cwd.
|
120
|
-
*
|
121
|
-
* @default false
|
122
|
-
*/
|
123
|
-
silent?: boolean;
|
124
|
-
};
|
125
|
-
}
|
126
|
-
}
|
119
|
+
export { BUILDER_TYPES, BUILDER_TYPE_PACKAGE_NAME_MAP, type ConfigGenerateContext, type Mapping2ROO, type OutputControl, type TemplateOptions };
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as _rollup_plugin_terser from '@rollup/plugin-terser';
|
2
2
|
import * as rollup_plugin_swc3 from 'rollup-plugin-swc3';
|
3
3
|
import * as rollup_plugin_esbuild from 'rollup-plugin-esbuild';
|
4
|
-
import {
|
4
|
+
import { OutputOptions, InputPluginOption } from 'rollup';
|
5
5
|
|
6
6
|
type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
|
7
7
|
js?: OutputOptions[K];
|
@@ -18,6 +18,10 @@ interface ConfigGenerateContext {
|
|
18
18
|
}
|
19
19
|
type OutputControl = boolean | ((context: ConfigGenerateContext) => boolean);
|
20
20
|
declare const BUILDER_TYPES: readonly ["esbuild", "swc"];
|
21
|
+
declare const BUILDER_TYPE_PACKAGE_NAME_MAP: {
|
22
|
+
esbuild: string;
|
23
|
+
swc: string;
|
24
|
+
};
|
21
25
|
interface TemplateOptions {
|
22
26
|
/**
|
23
27
|
* When the user configures type: module, the generated output from entry points that don't
|
@@ -45,9 +49,9 @@ interface TemplateOptions {
|
|
45
49
|
* When use esbuild type builder, it will inject `supported.import-attributes` option.
|
46
50
|
* When use swc type builder, it will inject `jsc.experimental.keepImportAttributes` option.
|
47
51
|
*
|
48
|
-
* And it will auto set the rollup output externalImportAttributes and importAttributesKey options.
|
52
|
+
* And it will auto set the rollup output `externalImportAttributes` and `importAttributesKey` options.
|
49
53
|
*
|
50
|
-
* @default
|
54
|
+
* @default false
|
51
55
|
*/
|
52
56
|
keepImportAttributes?: boolean | 'assert';
|
53
57
|
};
|
@@ -112,15 +116,4 @@ interface TemplateOptions {
|
|
112
116
|
injects?: Record<string, string | [string, string]>;
|
113
117
|
}
|
114
118
|
|
115
|
-
|
116
|
-
interface Config {
|
117
|
-
build?: TemplateOptions & {
|
118
|
-
/**
|
119
|
-
* Whether to run in silent mode, only active when configured in the workspace root or cwd.
|
120
|
-
*
|
121
|
-
* @default false
|
122
|
-
*/
|
123
|
-
silent?: boolean;
|
124
|
-
};
|
125
|
-
}
|
126
|
-
}
|
119
|
+
export { BUILDER_TYPES, BUILDER_TYPE_PACKAGE_NAME_MAP, type ConfigGenerateContext, type Mapping2ROO, type OutputControl, type TemplateOptions };
|
@@ -0,0 +1,51 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var process = require('node:process');
|
4
|
+
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
6
|
+
|
7
|
+
var process__default = /*#__PURE__*/_interopDefault(process);
|
8
|
+
|
9
|
+
const {
|
10
|
+
JIEK_ANALYZER
|
11
|
+
} = process__default.default.env;
|
12
|
+
const ANALYZER = JIEK_ANALYZER != null && JSON.parse(JIEK_ANALYZER);
|
13
|
+
function bundleAnalyzer(modulesResolved) {
|
14
|
+
if (!ANALYZER) {
|
15
|
+
return [];
|
16
|
+
}
|
17
|
+
const defaultSizes = {
|
18
|
+
parsed: "parsed",
|
19
|
+
stat: "stat",
|
20
|
+
gzip: "gzip"
|
21
|
+
}[ANALYZER.size ?? "stat"] ?? "parsed";
|
22
|
+
let ana;
|
23
|
+
async function initAna() {
|
24
|
+
const { adapter, analyzer } = await import('vite-bundle-analyzer');
|
25
|
+
ana = ana ?? adapter(analyzer({
|
26
|
+
defaultSizes,
|
27
|
+
analyzerMode: modulesResolved
|
28
|
+
}));
|
29
|
+
}
|
30
|
+
return [
|
31
|
+
(async () => {
|
32
|
+
await initAna();
|
33
|
+
return {
|
34
|
+
name: "jiek:bundle-analyzer",
|
35
|
+
async closeBundle(...args) {
|
36
|
+
if (typeof ana.closeBundle !== "function") return;
|
37
|
+
return ana.closeBundle?.call(this, ...args);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
})(),
|
41
|
+
(async () => {
|
42
|
+
await initAna();
|
43
|
+
return {
|
44
|
+
...ana,
|
45
|
+
name: "jiek:bundle-analyzer-output"
|
46
|
+
};
|
47
|
+
})()
|
48
|
+
];
|
49
|
+
}
|
50
|
+
|
51
|
+
exports.bundleAnalyzer = bundleAnalyzer;
|
@@ -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,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('../.chunks/jiek_create-require.CWFWNQHj.cjs');
|
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('../.chunks/getWD.ZF0avqDB.cjs');
|
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 '../.chunks/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 '../.chunks/getWD.D6wq8Qc2.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 };
|