jiek 2.0.2-alpha.1 → 2.0.2-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/README.md +78 -0
  2. package/bin/jiek-build.js +16 -0
  3. package/bin/jiek.js +13 -0
  4. package/dist/cli-only-build.cjs +701 -0
  5. package/dist/cli-only-build.d.cts +91 -0
  6. package/dist/cli-only-build.d.ts +91 -0
  7. package/dist/cli-only-build.js +693 -0
  8. package/dist/cli.cjs +4638 -0
  9. package/dist/cli.d.cts +14 -0
  10. package/dist/cli.d.ts +14 -0
  11. package/dist/cli.js +4608 -0
  12. package/dist/index.cjs +5 -0
  13. package/dist/index.d.cts +112 -0
  14. package/dist/index.d.ts +112 -0
  15. package/dist/index.js +3 -0
  16. package/dist/package.json +125 -0
  17. package/dist/rollup/index.cjs +4893 -0
  18. package/dist/rollup/index.d.cts +10 -0
  19. package/dist/rollup/index.d.ts +10 -0
  20. package/dist/rollup/index.js +4880 -0
  21. package/package.json +7 -39
  22. package/src/cli-only-build.ts +7 -0
  23. package/src/cli.ts +2 -0
  24. package/src/commands/base.ts +18 -0
  25. package/src/commands/build.ts +459 -0
  26. package/src/commands/descriptions.ts +17 -0
  27. package/src/commands/meta.ts +5 -0
  28. package/src/commands/publish.ts +242 -0
  29. package/src/index.ts +8 -0
  30. package/src/inner.ts +11 -0
  31. package/src/rollup/base.ts +137 -0
  32. package/src/rollup/index.ts +565 -0
  33. package/src/rollup/plugins/progress.ts +26 -0
  34. package/src/rollup/plugins/skip.ts +21 -0
  35. package/src/rollup/utils/commonOptions.ts +9 -0
  36. package/src/rollup/utils/externalResolver.ts +35 -0
  37. package/src/rollup/utils/globalResolver.ts +13 -0
  38. package/src/rollup/utils/withMinify.ts +18 -0
  39. package/src/utils/filterSupport.ts +91 -0
  40. package/src/utils/getExports.ts +140 -0
  41. package/src/utils/getRoot.ts +16 -0
  42. package/src/utils/getWD.ts +31 -0
  43. package/src/utils/loadConfig.ts +111 -0
  44. package/src/utils/recusiveListFiles.ts +13 -0
  45. package/src/utils/ts.ts +94 -0
  46. package/src/utils/tsRegister.ts +26 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const defineConfig = (config) => config;
4
+
5
+ exports.defineConfig = defineConfig;
@@ -0,0 +1,112 @@
1
+ import * as _rollup_plugin_terser from '@rollup/plugin-terser';
2
+ import * as rollup_plugin_swc3 from 'rollup-plugin-swc3';
3
+ import * as rollup_plugin_esbuild from 'rollup-plugin-esbuild';
4
+ import { InputPluginOption, OutputOptions } from 'rollup';
5
+
6
+ type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
7
+ js?: OutputOptions[K];
8
+ dts?: OutputOptions[K];
9
+ };
10
+ interface ConfigGenerateContext {
11
+ path: string;
12
+ name: string;
13
+ input: string;
14
+ output: string;
15
+ external: (string | RegExp)[];
16
+ pkgIsModule: boolean;
17
+ conditionals: string[];
18
+ }
19
+ type OutputControl = boolean | ((context: ConfigGenerateContext) => boolean);
20
+ declare const BUILDER_TYPES: readonly ["esbuild", "swc"];
21
+ interface TemplateOptions {
22
+ /**
23
+ * When the user configures type: module, the generated output from entry points that don't
24
+ * have cts as a suffix will automatically include the CJS version.
25
+ * if it is not configured, and the generated output from entry points that do not have mts
26
+ * as a suffix will automatically include the ESM version.
27
+ *
28
+ * @default true
29
+ */
30
+ crossModuleConvertor?: boolean;
31
+ /**
32
+ * Auto-detect the builder from the installed dependencies.
33
+ * If the builder is not installed, it will prompt the user to install it.
34
+ * If exists multiple builders, it will fall back to the 'esbuild'.
35
+ *
36
+ * @default 'esbuild'
37
+ */
38
+ builder?: typeof BUILDER_TYPES[number] | ({
39
+ type: 'esbuild';
40
+ } & rollup_plugin_esbuild.Options) | ({
41
+ type: 'swc';
42
+ } & rollup_plugin_swc3.PluginOptions);
43
+ output?: {
44
+ /**
45
+ * @default true
46
+ *
47
+ * When minify is set to true, the output will with minified files.
48
+ * When minify is set to 'only-minify', the output will direct output minified files.
49
+ */
50
+ minify?: boolean | 'only-minify';
51
+ minifyOptions?: typeof BUILDER_TYPES[number] | 'terser' | ({
52
+ type: 'terser';
53
+ } & _rollup_plugin_terser.Options) | ({
54
+ type: 'esbuild';
55
+ } & Parameters<typeof rollup_plugin_esbuild.minify>[0]) | ({
56
+ type: 'swc';
57
+ } & Parameters<typeof rollup_plugin_swc3.minify>[0]);
58
+ /**
59
+ * @default 'dist'
60
+ */
61
+ dir?: Mapping2ROO<'dir'>;
62
+ sourcemap?: Mapping2ROO<'sourcemap'>;
63
+ strict?: Mapping2ROO<'strict'>;
64
+ js?: OutputControl;
65
+ dts?: OutputControl;
66
+ };
67
+ /**
68
+ * Set the external dependencies of the package.
69
+ */
70
+ external?: (string | RegExp)[];
71
+ plugins?: InputPluginOption | ((type: 'js' | 'dts', context: ConfigGenerateContext) => InputPluginOption) | {
72
+ js: InputPluginOption;
73
+ dts?: InputPluginOption;
74
+ } | {
75
+ js?: InputPluginOption;
76
+ dts: InputPluginOption;
77
+ };
78
+ }
79
+
80
+ declare module 'jiek' {
81
+ interface Config {
82
+ build?: TemplateOptions & {
83
+ /**
84
+ * Whether to run in silent mode, only active when configured in the workspace root or cwd.
85
+ *
86
+ * @default false
87
+ */
88
+ silent?: boolean;
89
+ };
90
+ }
91
+ }
92
+
93
+ declare module 'jiek' {
94
+ interface Config {
95
+ publish?: {
96
+ /**
97
+ * @default false
98
+ */
99
+ withSuffix?: boolean;
100
+ /**
101
+ * @default true
102
+ */
103
+ withSource?: boolean;
104
+ };
105
+ }
106
+ }
107
+
108
+ interface Config {
109
+ }
110
+ declare const defineConfig: (config: Config) => Config;
111
+
112
+ export { type Config, defineConfig };
@@ -0,0 +1,112 @@
1
+ import * as _rollup_plugin_terser from '@rollup/plugin-terser';
2
+ import * as rollup_plugin_swc3 from 'rollup-plugin-swc3';
3
+ import * as rollup_plugin_esbuild from 'rollup-plugin-esbuild';
4
+ import { InputPluginOption, OutputOptions } from 'rollup';
5
+
6
+ type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
7
+ js?: OutputOptions[K];
8
+ dts?: OutputOptions[K];
9
+ };
10
+ interface ConfigGenerateContext {
11
+ path: string;
12
+ name: string;
13
+ input: string;
14
+ output: string;
15
+ external: (string | RegExp)[];
16
+ pkgIsModule: boolean;
17
+ conditionals: string[];
18
+ }
19
+ type OutputControl = boolean | ((context: ConfigGenerateContext) => boolean);
20
+ declare const BUILDER_TYPES: readonly ["esbuild", "swc"];
21
+ interface TemplateOptions {
22
+ /**
23
+ * When the user configures type: module, the generated output from entry points that don't
24
+ * have cts as a suffix will automatically include the CJS version.
25
+ * if it is not configured, and the generated output from entry points that do not have mts
26
+ * as a suffix will automatically include the ESM version.
27
+ *
28
+ * @default true
29
+ */
30
+ crossModuleConvertor?: boolean;
31
+ /**
32
+ * Auto-detect the builder from the installed dependencies.
33
+ * If the builder is not installed, it will prompt the user to install it.
34
+ * If exists multiple builders, it will fall back to the 'esbuild'.
35
+ *
36
+ * @default 'esbuild'
37
+ */
38
+ builder?: typeof BUILDER_TYPES[number] | ({
39
+ type: 'esbuild';
40
+ } & rollup_plugin_esbuild.Options) | ({
41
+ type: 'swc';
42
+ } & rollup_plugin_swc3.PluginOptions);
43
+ output?: {
44
+ /**
45
+ * @default true
46
+ *
47
+ * When minify is set to true, the output will with minified files.
48
+ * When minify is set to 'only-minify', the output will direct output minified files.
49
+ */
50
+ minify?: boolean | 'only-minify';
51
+ minifyOptions?: typeof BUILDER_TYPES[number] | 'terser' | ({
52
+ type: 'terser';
53
+ } & _rollup_plugin_terser.Options) | ({
54
+ type: 'esbuild';
55
+ } & Parameters<typeof rollup_plugin_esbuild.minify>[0]) | ({
56
+ type: 'swc';
57
+ } & Parameters<typeof rollup_plugin_swc3.minify>[0]);
58
+ /**
59
+ * @default 'dist'
60
+ */
61
+ dir?: Mapping2ROO<'dir'>;
62
+ sourcemap?: Mapping2ROO<'sourcemap'>;
63
+ strict?: Mapping2ROO<'strict'>;
64
+ js?: OutputControl;
65
+ dts?: OutputControl;
66
+ };
67
+ /**
68
+ * Set the external dependencies of the package.
69
+ */
70
+ external?: (string | RegExp)[];
71
+ plugins?: InputPluginOption | ((type: 'js' | 'dts', context: ConfigGenerateContext) => InputPluginOption) | {
72
+ js: InputPluginOption;
73
+ dts?: InputPluginOption;
74
+ } | {
75
+ js?: InputPluginOption;
76
+ dts: InputPluginOption;
77
+ };
78
+ }
79
+
80
+ declare module 'jiek' {
81
+ interface Config {
82
+ build?: TemplateOptions & {
83
+ /**
84
+ * Whether to run in silent mode, only active when configured in the workspace root or cwd.
85
+ *
86
+ * @default false
87
+ */
88
+ silent?: boolean;
89
+ };
90
+ }
91
+ }
92
+
93
+ declare module 'jiek' {
94
+ interface Config {
95
+ publish?: {
96
+ /**
97
+ * @default false
98
+ */
99
+ withSuffix?: boolean;
100
+ /**
101
+ * @default true
102
+ */
103
+ withSource?: boolean;
104
+ };
105
+ }
106
+ }
107
+
108
+ interface Config {
109
+ }
110
+ declare const defineConfig: (config: Config) => Config;
111
+
112
+ export { type Config, defineConfig };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ const defineConfig = (config) => config;
2
+
3
+ export { defineConfig };
@@ -0,0 +1,125 @@
1
+ {
2
+ "name": "jiek",
3
+ "type": "module",
4
+ "version": "2.0.2-alpha.2",
5
+ "description": "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.",
6
+ "author": "YiJie <yijie4188@gmail.com>",
7
+ "repository": {
8
+ "url": "nwylzw/jiek",
9
+ "directory": "packages/jiek"
10
+ },
11
+ "homepage": "https://github.com/NWYLZW/jiek/tree/master/packages/jiek#readme",
12
+ "bugs": "https://github.com/NWYLZW/jiek/issues?q=is%3Aissue+is%3Aopen+jiek",
13
+ "bin": {
14
+ "jiek": "bin/jiek.js",
15
+ "jk": "bin/jiek.js",
16
+ "jiek-build": "bin/jiek-build.js",
17
+ "jb": "bin/jiek-build.js"
18
+ },
19
+ "files": ["dist", "src", "bin", "LICENSE", "README.md"],
20
+ "scripts": {
21
+ "prepublish": "jb -nm -nc"
22
+ },
23
+ "exports": {
24
+ "./package.json": "./package.json",
25
+ ".": "./src/index.ts",
26
+ "./cli": "./src/cli.ts",
27
+ "./cli-only-build": "./src/cli-only-build.ts",
28
+ "./rollup": "./src/rollup/index.ts"
29
+ },
30
+ "imports": {
31
+ "#~/*": "./src/*"
32
+ },
33
+ "dependencies": {
34
+ "@jiek/pkger": "workspace:^",
35
+ "@jiek/rollup-plugin-dts": "^6.2.1",
36
+ "@jiek/utils": "workspace:^",
37
+ "@inquirer/prompts": "^7.1.0",
38
+ "@rollup/plugin-commonjs": "^28.0.0",
39
+ "@rollup/plugin-json": "^6.0.1",
40
+ "@rollup/plugin-node-resolve": "^15.3.0",
41
+ "cli-progress": "^3.12.0",
42
+ "commander": "^12.0.0",
43
+ "detect-indent": "^6.1.0",
44
+ "execa": "9.3.1",
45
+ "js-yaml": "^4.1.0",
46
+ "jsonc-parser": "^3.2.1",
47
+ "rollup": "4.13.2"
48
+ },
49
+ "peerDependencies": {
50
+ "@rollup/plugin-terser": "^0.4.4",
51
+ "@pnpm/filter-workspace-packages": "^7.2.13",
52
+ "esbuild-register": "^3.5.0",
53
+ "postcss": "^8.4.47",
54
+ "rollup-plugin-postcss": "^4.0.2",
55
+ "rollup-plugin-esbuild": "^6.1.0",
56
+ "rollup-plugin-swc3": "^0.12.1",
57
+ "typescript": "^4.0.0||^5.0.0"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "@rollup/plugin-terser": { "optional": true },
61
+ "@pnpm/filter-workspace-packages": { "optional": true },
62
+ "esbuild-register": { "optional": true },
63
+ "postcss": { "optional": true },
64
+ "rollup-plugin-postcss": { "optional": true },
65
+ "rollup-plugin-esbuild": { "optional": true },
66
+ "rollup-plugin-swc3": { "optional": true },
67
+ "typescript": { "optional": true }
68
+ },
69
+ "devDependencies": {
70
+ "@npm/types": "^1.0.2",
71
+ "@pnpm/filter-workspace-packages": "^7.2.13",
72
+ "@pnpm/workspace.pkgs-graph": "^2.0.15",
73
+ "@rollup/plugin-terser": "^0.4.4",
74
+ "@types/cli-progress": "^3.11.5",
75
+ "@types/inquirer": "^9.0.7",
76
+ "@types/js-yaml": "^4.0.9",
77
+ "@types/micromatch": "^4.0.6",
78
+ "esbuild-register": "^3.5.0",
79
+ "micromatch": "^4.0.5",
80
+ "node-sass": "^9.0.0",
81
+ "postcss": "^8.4.47",
82
+ "rollup-plugin-postcss": "^4.0.2",
83
+ "rollup-plugin-esbuild": "^6.1.0",
84
+ "rollup-plugin-swc3": "^0.12.1"
85
+ },
86
+ "publishConfig": {
87
+ "exports": {
88
+ "./package.json": "./package.json",
89
+ ".": {
90
+ "source": "./src/index.ts",
91
+ "require": "./dist/index.cjs",
92
+ "default": "./dist/index.js"
93
+ },
94
+ "./cli": {
95
+ "source": "./src/cli.ts",
96
+ "require": "./dist/cli.cjs",
97
+ "default": "./dist/cli.js"
98
+ },
99
+ "./cli-only-build": {
100
+ "source": "./src/cli-only-build.ts",
101
+ "require": "./dist/cli-only-build.cjs",
102
+ "default": "./dist/cli-only-build.js"
103
+ },
104
+ "./rollup": {
105
+ "source": "./src/rollup/index.ts",
106
+ "require": "./dist/rollup/index.cjs",
107
+ "default": "./dist/rollup/index.js"
108
+ }
109
+ },
110
+ "main": "./dist/index.cjs",
111
+ "module": "./dist/index.js",
112
+ "typesVersions": {
113
+ "<5.0": {
114
+ "*": [
115
+ "*",
116
+ "./dist/*",
117
+ "./dist/*/index.d.ts",
118
+ "./dist/*/index.d.mts",
119
+ "./dist/*/index.d.cts"
120
+ ]
121
+ }
122
+ },
123
+ "directory": "./dist"
124
+ }
125
+ }