@granite-js/cli 0.1.6 → 0.1.8
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/CHANGELOG.md +19 -0
- package/dist/index.cjs +83 -469
- package/dist/index.d.cts +8 -161
- package/dist/index.d.ts +8 -161
- package/dist/index.js +85 -467
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,115 +1,5 @@
|
|
|
1
|
-
import
|
|
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';
|
|
1
|
+
import { GraniteConfig, CompleteGraniteConfig } from '@granite-js/plugin-core';
|
|
6
2
|
|
|
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
3
|
/**
|
|
114
4
|
* @public
|
|
115
5
|
* @category Configuration
|
|
@@ -125,16 +15,15 @@ interface GraniteConfigResponse extends z.infer<typeof graniteConfigSchema> {
|
|
|
125
15
|
* - Additional functionality through Granite plugins
|
|
126
16
|
*
|
|
127
17
|
* @param config - Configuration options
|
|
18
|
+
* @param config.cwd - Working directory for build process (defaults to process.cwd())
|
|
128
19
|
* @param config.appName - Your app's unique identifier
|
|
129
20
|
* @param config.scheme - URL scheme for launching your app (e.g. 'granite')
|
|
130
|
-
* @param config.plugins - Granite plugins to enhance functionality
|
|
131
21
|
* @param config.outdir - Where to output build files (defaults to 'dist')
|
|
132
22
|
* @param config.entryFile - Your app's entry point (defaults to './src/_app.tsx')
|
|
133
|
-
* @param config.
|
|
134
|
-
* @param config.mpack - Fine-tune mpack bundler behavior
|
|
135
|
-
* @param config.babel - Customize Babel transpilation
|
|
136
|
-
* @param config.esbuild - Adjust ESBuild bundling
|
|
23
|
+
* @param config.build - Customize build settings
|
|
137
24
|
* @param config.metro - Configure Metro bundler settings
|
|
25
|
+
* @param config.devServer - Configure Mpack dev server settings
|
|
26
|
+
* @param config.plugins - Granite plugins to enhance functionality
|
|
138
27
|
* @returns The processed configuration
|
|
139
28
|
*
|
|
140
29
|
* @example
|
|
@@ -159,52 +48,10 @@ interface GraniteConfigResponse extends z.infer<typeof graniteConfigSchema> {
|
|
|
159
48
|
* });
|
|
160
49
|
* ```
|
|
161
50
|
*/
|
|
162
|
-
declare const defineConfig: (config:
|
|
163
|
-
|
|
164
|
-
declare const loadConfig: () => Promise<GraniteConfigResponse>;
|
|
165
|
-
|
|
166
|
-
declare function getGlobalVariables({ dev }: {
|
|
167
|
-
dev?: boolean;
|
|
168
|
-
}): {
|
|
169
|
-
global: string;
|
|
170
|
-
__DEV__: string;
|
|
171
|
-
'process.env.NODE_ENV': string;
|
|
172
|
-
};
|
|
51
|
+
declare const defineConfig: (config: GraniteConfig) => Promise<CompleteGraniteConfig>;
|
|
173
52
|
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* 최적화 구성
|
|
177
|
-
*/
|
|
178
|
-
optimization?: ServiceOptimizeOptions;
|
|
179
|
-
}
|
|
180
|
-
interface ServiceOptimizeOptions {
|
|
181
|
-
/**
|
|
182
|
-
* tslib 트리셰이킹 최적화 활성화 (기본값: false)
|
|
183
|
-
*/
|
|
184
|
-
'tslib-esm'?: boolean;
|
|
185
|
-
}
|
|
186
|
-
declare function commonResolver({ optimization }: ServicePresetOptions): {
|
|
187
|
-
alias: ({
|
|
188
|
-
from: string;
|
|
189
|
-
to: ({ resolve, args }: {
|
|
190
|
-
resolve: esbuild.PluginBuild["resolve"];
|
|
191
|
-
args: esbuild.OnResolveArgs;
|
|
192
|
-
}) => Promise<string>;
|
|
193
|
-
exact: boolean;
|
|
194
|
-
} | {
|
|
195
|
-
from: string;
|
|
196
|
-
to: string;
|
|
197
|
-
exact: boolean;
|
|
198
|
-
})[];
|
|
199
|
-
protocols: {
|
|
200
|
-
'granite-require': {
|
|
201
|
-
resolve?: (args: esbuild.OnResolveArgs) => string | Promise<string>;
|
|
202
|
-
load: (args: esbuild.OnLoadArgs) => esbuild.OnLoadResult | Promise<esbuild.OnLoadResult>;
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
declare const service: (options?: ServicePresetOptions) => Preset;
|
|
53
|
+
declare const loadConfig: () => Promise<CompleteGraniteConfig>;
|
|
207
54
|
|
|
208
55
|
declare function initialize(): Promise<void>;
|
|
209
56
|
|
|
210
|
-
export {
|
|
57
|
+
export { defineConfig, initialize, loadConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,115 +1,5 @@
|
|
|
1
|
-
import
|
|
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';
|
|
1
|
+
import { GraniteConfig, CompleteGraniteConfig } from '@granite-js/plugin-core';
|
|
6
2
|
|
|
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
3
|
/**
|
|
114
4
|
* @public
|
|
115
5
|
* @category Configuration
|
|
@@ -125,16 +15,15 @@ interface GraniteConfigResponse extends z.infer<typeof graniteConfigSchema> {
|
|
|
125
15
|
* - Additional functionality through Granite plugins
|
|
126
16
|
*
|
|
127
17
|
* @param config - Configuration options
|
|
18
|
+
* @param config.cwd - Working directory for build process (defaults to process.cwd())
|
|
128
19
|
* @param config.appName - Your app's unique identifier
|
|
129
20
|
* @param config.scheme - URL scheme for launching your app (e.g. 'granite')
|
|
130
|
-
* @param config.plugins - Granite plugins to enhance functionality
|
|
131
21
|
* @param config.outdir - Where to output build files (defaults to 'dist')
|
|
132
22
|
* @param config.entryFile - Your app's entry point (defaults to './src/_app.tsx')
|
|
133
|
-
* @param config.
|
|
134
|
-
* @param config.mpack - Fine-tune mpack bundler behavior
|
|
135
|
-
* @param config.babel - Customize Babel transpilation
|
|
136
|
-
* @param config.esbuild - Adjust ESBuild bundling
|
|
23
|
+
* @param config.build - Customize build settings
|
|
137
24
|
* @param config.metro - Configure Metro bundler settings
|
|
25
|
+
* @param config.devServer - Configure Mpack dev server settings
|
|
26
|
+
* @param config.plugins - Granite plugins to enhance functionality
|
|
138
27
|
* @returns The processed configuration
|
|
139
28
|
*
|
|
140
29
|
* @example
|
|
@@ -159,52 +48,10 @@ interface GraniteConfigResponse extends z.infer<typeof graniteConfigSchema> {
|
|
|
159
48
|
* });
|
|
160
49
|
* ```
|
|
161
50
|
*/
|
|
162
|
-
declare const defineConfig: (config:
|
|
163
|
-
|
|
164
|
-
declare const loadConfig: () => Promise<GraniteConfigResponse>;
|
|
165
|
-
|
|
166
|
-
declare function getGlobalVariables({ dev }: {
|
|
167
|
-
dev?: boolean;
|
|
168
|
-
}): {
|
|
169
|
-
global: string;
|
|
170
|
-
__DEV__: string;
|
|
171
|
-
'process.env.NODE_ENV': string;
|
|
172
|
-
};
|
|
51
|
+
declare const defineConfig: (config: GraniteConfig) => Promise<CompleteGraniteConfig>;
|
|
173
52
|
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* 최적화 구성
|
|
177
|
-
*/
|
|
178
|
-
optimization?: ServiceOptimizeOptions;
|
|
179
|
-
}
|
|
180
|
-
interface ServiceOptimizeOptions {
|
|
181
|
-
/**
|
|
182
|
-
* tslib 트리셰이킹 최적화 활성화 (기본값: false)
|
|
183
|
-
*/
|
|
184
|
-
'tslib-esm'?: boolean;
|
|
185
|
-
}
|
|
186
|
-
declare function commonResolver({ optimization }: ServicePresetOptions): {
|
|
187
|
-
alias: ({
|
|
188
|
-
from: string;
|
|
189
|
-
to: ({ resolve, args }: {
|
|
190
|
-
resolve: esbuild.PluginBuild["resolve"];
|
|
191
|
-
args: esbuild.OnResolveArgs;
|
|
192
|
-
}) => Promise<string>;
|
|
193
|
-
exact: boolean;
|
|
194
|
-
} | {
|
|
195
|
-
from: string;
|
|
196
|
-
to: string;
|
|
197
|
-
exact: boolean;
|
|
198
|
-
})[];
|
|
199
|
-
protocols: {
|
|
200
|
-
'granite-require': {
|
|
201
|
-
resolve?: (args: esbuild.OnResolveArgs) => string | Promise<string>;
|
|
202
|
-
load: (args: esbuild.OnLoadArgs) => esbuild.OnLoadResult | Promise<esbuild.OnLoadResult>;
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
declare const service: (options?: ServicePresetOptions) => Preset;
|
|
53
|
+
declare const loadConfig: () => Promise<CompleteGraniteConfig>;
|
|
207
54
|
|
|
208
55
|
declare function initialize(): Promise<void>;
|
|
209
56
|
|
|
210
|
-
export {
|
|
57
|
+
export { defineConfig, initialize, loadConfig };
|