@granite-js/cli 0.0.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.
@@ -0,0 +1,161 @@
1
+ import * as esbuild from 'esbuild';
2
+ import { AdditionalMetroConfig, Config, Preset } from '@granite-js/mpack';
3
+ import { PluginInput } from '@granite-js/plugin-core';
4
+ import { HandleFunction } from 'connect';
5
+ import { z } from 'zod';
6
+
7
+ declare const graniteConfigSchema: z.ZodObject<{
8
+ appName: z.ZodString;
9
+ scheme: z.ZodString;
10
+ plugins: z.ZodType<PluginInput, z.ZodTypeDef, PluginInput>;
11
+ outdir: z.ZodDefault<z.ZodString>;
12
+ entryFile: z.ZodDefault<z.ZodString>;
13
+ cwd: z.ZodDefault<z.ZodString>;
14
+ mpack: z.ZodOptional<z.ZodOptional<z.ZodObject<{
15
+ devServer: z.ZodDefault<z.ZodOptional<z.ZodObject<{
16
+ middlewares: z.ZodDefault<z.ZodType<HandleFunction[], z.ZodTypeDef, HandleFunction[]>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ middlewares: HandleFunction[];
19
+ }, {
20
+ middlewares?: HandleFunction[] | undefined;
21
+ }>>>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ devServer: {
24
+ middlewares: HandleFunction[];
25
+ };
26
+ }, {
27
+ devServer?: {
28
+ middlewares?: HandleFunction[] | undefined;
29
+ } | undefined;
30
+ }>>>;
31
+ babel: z.ZodOptional<z.ZodObject<{
32
+ configFile: z.ZodOptional<z.ZodString>;
33
+ presets: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
34
+ plugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
35
+ conditions: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodBoolean>, "many">>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ plugins?: any[] | undefined;
38
+ configFile?: string | undefined;
39
+ conditions?: ((...args: unknown[]) => boolean)[] | undefined;
40
+ presets?: any[] | undefined;
41
+ }, {
42
+ plugins?: any[] | undefined;
43
+ configFile?: string | undefined;
44
+ conditions?: ((...args: unknown[]) => boolean)[] | undefined;
45
+ presets?: any[] | undefined;
46
+ }>>;
47
+ esbuild: z.ZodOptional<z.ZodType<esbuild.BuildOptions & {
48
+ prelude?: string[];
49
+ }, z.ZodTypeDef, esbuild.BuildOptions & {
50
+ prelude?: string[];
51
+ }>>;
52
+ metro: z.ZodOptional<z.ZodType<Partial<AdditionalMetroConfig>, z.ZodTypeDef, Partial<AdditionalMetroConfig>>>;
53
+ INTERNAL__useSharedPreset: z.ZodOptional<z.ZodBoolean>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ appName: string;
56
+ scheme: string;
57
+ plugins: PluginInput;
58
+ outdir: string;
59
+ entryFile: string;
60
+ cwd: string;
61
+ mpack?: {
62
+ devServer: {
63
+ middlewares: HandleFunction[];
64
+ };
65
+ } | undefined;
66
+ babel?: {
67
+ plugins?: any[] | undefined;
68
+ configFile?: string | undefined;
69
+ conditions?: ((...args: unknown[]) => boolean)[] | undefined;
70
+ presets?: any[] | undefined;
71
+ } | undefined;
72
+ esbuild?: (esbuild.BuildOptions & {
73
+ prelude?: string[];
74
+ }) | undefined;
75
+ metro?: Partial<AdditionalMetroConfig> | undefined;
76
+ INTERNAL__useSharedPreset?: boolean | undefined;
77
+ }, {
78
+ appName: string;
79
+ scheme: string;
80
+ plugins: PluginInput;
81
+ mpack?: {
82
+ devServer?: {
83
+ middlewares?: HandleFunction[] | undefined;
84
+ } | undefined;
85
+ } | undefined;
86
+ outdir?: string | undefined;
87
+ entryFile?: string | undefined;
88
+ cwd?: string | undefined;
89
+ babel?: {
90
+ plugins?: any[] | undefined;
91
+ configFile?: string | undefined;
92
+ conditions?: ((...args: unknown[]) => boolean)[] | undefined;
93
+ presets?: any[] | undefined;
94
+ } | undefined;
95
+ esbuild?: (esbuild.BuildOptions & {
96
+ prelude?: string[];
97
+ }) | undefined;
98
+ metro?: Partial<AdditionalMetroConfig> | undefined;
99
+ INTERNAL__useSharedPreset?: boolean | undefined;
100
+ }>;
101
+ type GraniteConfigInput = z.input<typeof graniteConfigSchema> & {};
102
+ interface GraniteConfigResponse extends z.infer<typeof graniteConfigSchema> {
103
+ mpack: {
104
+ devServer: {
105
+ middlewares: HandleFunction[];
106
+ config: Config;
107
+ };
108
+ build: {
109
+ config: Config;
110
+ };
111
+ };
112
+ }
113
+ declare const defineConfig: (config: GraniteConfigInput) => Promise<GraniteConfigResponse>;
114
+
115
+ declare const loadConfig: () => Promise<GraniteConfigResponse>;
116
+
117
+ declare function getGlobalVariables({ dev }: {
118
+ dev?: boolean;
119
+ }): {
120
+ global: string;
121
+ __DEV__: string;
122
+ 'process.env.NODE_ENV': string;
123
+ };
124
+
125
+ interface ServicePresetOptions {
126
+ /**
127
+ * 최적화 구성
128
+ */
129
+ optimization?: ServiceOptimizeOptions;
130
+ }
131
+ interface ServiceOptimizeOptions {
132
+ /**
133
+ * tslib 트리셰이킹 최적화 활성화 (기본값: false)
134
+ */
135
+ 'tslib-esm'?: boolean;
136
+ }
137
+ declare function commonResolver({ optimization }: ServicePresetOptions): {
138
+ alias: ({
139
+ from: string;
140
+ to: ({ resolve, args }: {
141
+ resolve: esbuild.PluginBuild["resolve"];
142
+ args: esbuild.OnResolveArgs;
143
+ }) => Promise<string>;
144
+ exact: boolean;
145
+ } | {
146
+ from: string;
147
+ to: string;
148
+ exact: boolean;
149
+ })[];
150
+ protocols: {
151
+ 'granite-require': {
152
+ resolve?: (args: esbuild.OnResolveArgs) => string | Promise<string>;
153
+ load: (args: esbuild.OnLoadArgs) => esbuild.OnLoadResult | Promise<esbuild.OnLoadResult>;
154
+ };
155
+ };
156
+ };
157
+ declare const service: (options?: ServicePresetOptions) => Preset;
158
+
159
+ declare function initialize(): Promise<void>;
160
+
161
+ export { type GraniteConfigInput, type GraniteConfigResponse, commonResolver, defineConfig, getGlobalVariables, initialize, loadConfig, service };
@@ -0,0 +1,161 @@
1
+ import * as esbuild from 'esbuild';
2
+ import { AdditionalMetroConfig, Config, Preset } from '@granite-js/mpack';
3
+ import { PluginInput } from '@granite-js/plugin-core';
4
+ import { HandleFunction } from 'connect';
5
+ import { z } from 'zod';
6
+
7
+ declare const graniteConfigSchema: z.ZodObject<{
8
+ appName: z.ZodString;
9
+ scheme: z.ZodString;
10
+ plugins: z.ZodType<PluginInput, z.ZodTypeDef, PluginInput>;
11
+ outdir: z.ZodDefault<z.ZodString>;
12
+ entryFile: z.ZodDefault<z.ZodString>;
13
+ cwd: z.ZodDefault<z.ZodString>;
14
+ mpack: z.ZodOptional<z.ZodOptional<z.ZodObject<{
15
+ devServer: z.ZodDefault<z.ZodOptional<z.ZodObject<{
16
+ middlewares: z.ZodDefault<z.ZodType<HandleFunction[], z.ZodTypeDef, HandleFunction[]>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ middlewares: HandleFunction[];
19
+ }, {
20
+ middlewares?: HandleFunction[] | undefined;
21
+ }>>>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ devServer: {
24
+ middlewares: HandleFunction[];
25
+ };
26
+ }, {
27
+ devServer?: {
28
+ middlewares?: HandleFunction[] | undefined;
29
+ } | undefined;
30
+ }>>>;
31
+ babel: z.ZodOptional<z.ZodObject<{
32
+ configFile: z.ZodOptional<z.ZodString>;
33
+ presets: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
34
+ plugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
35
+ conditions: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodBoolean>, "many">>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ plugins?: any[] | undefined;
38
+ configFile?: string | undefined;
39
+ conditions?: ((...args: unknown[]) => boolean)[] | undefined;
40
+ presets?: any[] | undefined;
41
+ }, {
42
+ plugins?: any[] | undefined;
43
+ configFile?: string | undefined;
44
+ conditions?: ((...args: unknown[]) => boolean)[] | undefined;
45
+ presets?: any[] | undefined;
46
+ }>>;
47
+ esbuild: z.ZodOptional<z.ZodType<esbuild.BuildOptions & {
48
+ prelude?: string[];
49
+ }, z.ZodTypeDef, esbuild.BuildOptions & {
50
+ prelude?: string[];
51
+ }>>;
52
+ metro: z.ZodOptional<z.ZodType<Partial<AdditionalMetroConfig>, z.ZodTypeDef, Partial<AdditionalMetroConfig>>>;
53
+ INTERNAL__useSharedPreset: z.ZodOptional<z.ZodBoolean>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ appName: string;
56
+ scheme: string;
57
+ plugins: PluginInput;
58
+ outdir: string;
59
+ entryFile: string;
60
+ cwd: string;
61
+ mpack?: {
62
+ devServer: {
63
+ middlewares: HandleFunction[];
64
+ };
65
+ } | undefined;
66
+ babel?: {
67
+ plugins?: any[] | undefined;
68
+ configFile?: string | undefined;
69
+ conditions?: ((...args: unknown[]) => boolean)[] | undefined;
70
+ presets?: any[] | undefined;
71
+ } | undefined;
72
+ esbuild?: (esbuild.BuildOptions & {
73
+ prelude?: string[];
74
+ }) | undefined;
75
+ metro?: Partial<AdditionalMetroConfig> | undefined;
76
+ INTERNAL__useSharedPreset?: boolean | undefined;
77
+ }, {
78
+ appName: string;
79
+ scheme: string;
80
+ plugins: PluginInput;
81
+ mpack?: {
82
+ devServer?: {
83
+ middlewares?: HandleFunction[] | undefined;
84
+ } | undefined;
85
+ } | undefined;
86
+ outdir?: string | undefined;
87
+ entryFile?: string | undefined;
88
+ cwd?: string | undefined;
89
+ babel?: {
90
+ plugins?: any[] | undefined;
91
+ configFile?: string | undefined;
92
+ conditions?: ((...args: unknown[]) => boolean)[] | undefined;
93
+ presets?: any[] | undefined;
94
+ } | undefined;
95
+ esbuild?: (esbuild.BuildOptions & {
96
+ prelude?: string[];
97
+ }) | undefined;
98
+ metro?: Partial<AdditionalMetroConfig> | undefined;
99
+ INTERNAL__useSharedPreset?: boolean | undefined;
100
+ }>;
101
+ type GraniteConfigInput = z.input<typeof graniteConfigSchema> & {};
102
+ interface GraniteConfigResponse extends z.infer<typeof graniteConfigSchema> {
103
+ mpack: {
104
+ devServer: {
105
+ middlewares: HandleFunction[];
106
+ config: Config;
107
+ };
108
+ build: {
109
+ config: Config;
110
+ };
111
+ };
112
+ }
113
+ declare const defineConfig: (config: GraniteConfigInput) => Promise<GraniteConfigResponse>;
114
+
115
+ declare const loadConfig: () => Promise<GraniteConfigResponse>;
116
+
117
+ declare function getGlobalVariables({ dev }: {
118
+ dev?: boolean;
119
+ }): {
120
+ global: string;
121
+ __DEV__: string;
122
+ 'process.env.NODE_ENV': string;
123
+ };
124
+
125
+ interface ServicePresetOptions {
126
+ /**
127
+ * 최적화 구성
128
+ */
129
+ optimization?: ServiceOptimizeOptions;
130
+ }
131
+ interface ServiceOptimizeOptions {
132
+ /**
133
+ * tslib 트리셰이킹 최적화 활성화 (기본값: false)
134
+ */
135
+ 'tslib-esm'?: boolean;
136
+ }
137
+ declare function commonResolver({ optimization }: ServicePresetOptions): {
138
+ alias: ({
139
+ from: string;
140
+ to: ({ resolve, args }: {
141
+ resolve: esbuild.PluginBuild["resolve"];
142
+ args: esbuild.OnResolveArgs;
143
+ }) => Promise<string>;
144
+ exact: boolean;
145
+ } | {
146
+ from: string;
147
+ to: string;
148
+ exact: boolean;
149
+ })[];
150
+ protocols: {
151
+ 'granite-require': {
152
+ resolve?: (args: esbuild.OnResolveArgs) => string | Promise<string>;
153
+ load: (args: esbuild.OnLoadArgs) => esbuild.OnLoadResult | Promise<esbuild.OnLoadResult>;
154
+ };
155
+ };
156
+ };
157
+ declare const service: (options?: ServicePresetOptions) => Preset;
158
+
159
+ declare function initialize(): Promise<void>;
160
+
161
+ export { type GraniteConfigInput, type GraniteConfigResponse, commonResolver, defineConfig, getGlobalVariables, initialize, loadConfig, service };