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,33 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var commander = require('commander');
|
4
|
+
var process = require('node:process');
|
5
|
+
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
7
|
+
|
8
|
+
var process__default = /*#__PURE__*/_interopDefault(process);
|
9
|
+
|
10
|
+
const { argv } = process__default.default;
|
11
|
+
const env = {};
|
12
|
+
let isPassThrough = false;
|
13
|
+
const newArgv = argv.filter((arg) => {
|
14
|
+
if (isPassThrough) {
|
15
|
+
return true;
|
16
|
+
}
|
17
|
+
if (arg === "--") {
|
18
|
+
isPassThrough = true;
|
19
|
+
return false;
|
20
|
+
}
|
21
|
+
const m = /^--env\.(\w+)=(.*)$/.exec(arg);
|
22
|
+
if (m) {
|
23
|
+
env[m[1]] = m[2];
|
24
|
+
return false;
|
25
|
+
}
|
26
|
+
return true;
|
27
|
+
});
|
28
|
+
for (const [key, value] of Object.entries(env)) {
|
29
|
+
process__default.default.env[key] = value;
|
30
|
+
}
|
31
|
+
var parseArgv = () => commander.program.parse(newArgv);
|
32
|
+
|
33
|
+
module.exports = parseArgv;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { program } from 'commander';
|
2
|
+
import process from 'node:process';
|
3
|
+
|
4
|
+
const { argv } = process;
|
5
|
+
const env = {};
|
6
|
+
let isPassThrough = false;
|
7
|
+
const newArgv = argv.filter((arg) => {
|
8
|
+
if (isPassThrough) {
|
9
|
+
return true;
|
10
|
+
}
|
11
|
+
if (arg === "--") {
|
12
|
+
isPassThrough = true;
|
13
|
+
return false;
|
14
|
+
}
|
15
|
+
const m = /^--env\.(\w+)=(.*)$/.exec(arg);
|
16
|
+
if (m) {
|
17
|
+
env[m[1]] = m[2];
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
return true;
|
21
|
+
});
|
22
|
+
for (const [key, value] of Object.entries(env)) {
|
23
|
+
process.env[key] = value;
|
24
|
+
}
|
25
|
+
var parseArgv = () => program.parse(newArgv);
|
26
|
+
|
27
|
+
export { parseArgv as default };
|
@@ -0,0 +1,30 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var index = require('./.chunks/index.Daihq2aI.cjs');
|
4
|
+
require('node:url');
|
5
|
+
require('node:child_process');
|
6
|
+
require('node:string_decoder');
|
7
|
+
require('node:util');
|
8
|
+
require('node:process');
|
9
|
+
require('node:fs');
|
10
|
+
require('node:tty');
|
11
|
+
require('node:path');
|
12
|
+
require('child_process');
|
13
|
+
require('path');
|
14
|
+
require('fs');
|
15
|
+
require('node:timers/promises');
|
16
|
+
require('node:os');
|
17
|
+
require('node:events');
|
18
|
+
require('node:v8');
|
19
|
+
require('node:stream');
|
20
|
+
require('node:buffer');
|
21
|
+
require('node:stream/promises');
|
22
|
+
|
23
|
+
const bridgeDisabledRef = { value: false };
|
24
|
+
const publish = async (type, data) => {
|
25
|
+
if (bridgeDisabledRef.value) return Promise.resolve();
|
26
|
+
return index.sendMessage({ type, data });
|
27
|
+
};
|
28
|
+
|
29
|
+
exports.bridgeDisabledRef = bridgeDisabledRef;
|
30
|
+
exports.publish = publish;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Module } from './rollup/bundle-analyzer.cjs';
|
2
|
+
import 'rollup';
|
3
|
+
import 'vite-bundle-analyzer';
|
4
|
+
|
5
|
+
declare const bridgeDisabledRef: {
|
6
|
+
value: boolean;
|
7
|
+
};
|
8
|
+
interface RollupBuildEntryCtx {
|
9
|
+
type: 'esm' | 'cjs';
|
10
|
+
name: string;
|
11
|
+
path: string;
|
12
|
+
exportConditions: string[];
|
13
|
+
input: string;
|
14
|
+
}
|
15
|
+
interface RollupBuildEventMap {
|
16
|
+
init: {
|
17
|
+
leafMap: Map<string, string[][]>;
|
18
|
+
targetsLength: number;
|
19
|
+
};
|
20
|
+
progress: RollupBuildEntryCtx & {
|
21
|
+
tags?: string[];
|
22
|
+
event?: string;
|
23
|
+
message?: string;
|
24
|
+
};
|
25
|
+
watchChange: RollupBuildEntryCtx & {
|
26
|
+
id: string;
|
27
|
+
};
|
28
|
+
modulesAnalyze: RollupBuildEntryCtx & {
|
29
|
+
modules: Module[];
|
30
|
+
};
|
31
|
+
debug: unknown;
|
32
|
+
}
|
33
|
+
type RollupBuildEvent = keyof RollupBuildEventMap extends infer K ? K extends infer Item extends keyof RollupBuildEventMap ? {
|
34
|
+
type: Item;
|
35
|
+
data: RollupBuildEventMap[Item];
|
36
|
+
} : never : never;
|
37
|
+
declare const publish: <K extends keyof RollupBuildEventMap>(type: K, data: RollupBuildEventMap[K]) => Promise<void>;
|
38
|
+
|
39
|
+
export { type RollupBuildEntryCtx, type RollupBuildEvent, type RollupBuildEventMap, bridgeDisabledRef, publish };
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Module } from './rollup/bundle-analyzer.js';
|
2
|
+
import 'rollup';
|
3
|
+
import 'vite-bundle-analyzer';
|
4
|
+
|
5
|
+
declare const bridgeDisabledRef: {
|
6
|
+
value: boolean;
|
7
|
+
};
|
8
|
+
interface RollupBuildEntryCtx {
|
9
|
+
type: 'esm' | 'cjs';
|
10
|
+
name: string;
|
11
|
+
path: string;
|
12
|
+
exportConditions: string[];
|
13
|
+
input: string;
|
14
|
+
}
|
15
|
+
interface RollupBuildEventMap {
|
16
|
+
init: {
|
17
|
+
leafMap: Map<string, string[][]>;
|
18
|
+
targetsLength: number;
|
19
|
+
};
|
20
|
+
progress: RollupBuildEntryCtx & {
|
21
|
+
tags?: string[];
|
22
|
+
event?: string;
|
23
|
+
message?: string;
|
24
|
+
};
|
25
|
+
watchChange: RollupBuildEntryCtx & {
|
26
|
+
id: string;
|
27
|
+
};
|
28
|
+
modulesAnalyze: RollupBuildEntryCtx & {
|
29
|
+
modules: Module[];
|
30
|
+
};
|
31
|
+
debug: unknown;
|
32
|
+
}
|
33
|
+
type RollupBuildEvent = keyof RollupBuildEventMap extends infer K ? K extends infer Item extends keyof RollupBuildEventMap ? {
|
34
|
+
type: Item;
|
35
|
+
data: RollupBuildEventMap[Item];
|
36
|
+
} : never : never;
|
37
|
+
declare const publish: <K extends keyof RollupBuildEventMap>(type: K, data: RollupBuildEventMap[K]) => Promise<void>;
|
38
|
+
|
39
|
+
export { type RollupBuildEntryCtx, type RollupBuildEvent, type RollupBuildEventMap, bridgeDisabledRef, publish };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { s as sendMessage } from './.chunks/index.BHuJRlvZ.js';
|
2
|
+
import 'node:url';
|
3
|
+
import 'node:child_process';
|
4
|
+
import 'node:string_decoder';
|
5
|
+
import 'node:util';
|
6
|
+
import 'node:process';
|
7
|
+
import 'node:fs';
|
8
|
+
import 'node:tty';
|
9
|
+
import 'node:path';
|
10
|
+
import 'child_process';
|
11
|
+
import 'path';
|
12
|
+
import 'fs';
|
13
|
+
import 'node:timers/promises';
|
14
|
+
import 'node:os';
|
15
|
+
import 'node:events';
|
16
|
+
import 'node:v8';
|
17
|
+
import 'node:stream';
|
18
|
+
import 'node:buffer';
|
19
|
+
import 'node:stream/promises';
|
20
|
+
|
21
|
+
const bridgeDisabledRef = { value: false };
|
22
|
+
const publish = async (type, data) => {
|
23
|
+
if (bridgeDisabledRef.value) return Promise.resolve();
|
24
|
+
return sendMessage({ type, data });
|
25
|
+
};
|
26
|
+
|
27
|
+
export { bridgeDisabledRef, publish };
|
@@ -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,18 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var filterSupport = require('../.chunks/filterSupport.4rM7f6jB.cjs');
|
4
|
+
require('node:fs');
|
5
|
+
require('node:path');
|
6
|
+
require('node:process');
|
7
|
+
require('commander');
|
8
|
+
require('js-yaml');
|
9
|
+
require('@jiek/utils/getWorkspaceDir');
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
exports.filterPackagesGraph = filterSupport.filterPackagesGraph;
|
14
|
+
exports.getSelectedProjectsGraph = filterSupport.getSelectedProjectsGraph;
|
15
|
+
Object.defineProperty(exports, "type", {
|
16
|
+
enumerable: true,
|
17
|
+
get: function () { return filterSupport.type; }
|
18
|
+
});
|
@@ -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 };
|