@granite-js/plugin-core 0.1.18 → 0.1.20
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 +13 -0
- package/dist/index.cjs +17 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +17 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @granite-js/plugin-core
|
|
2
2
|
|
|
3
|
+
## 0.1.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @granite-js/utils@0.1.20
|
|
8
|
+
|
|
9
|
+
## 0.1.19
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e9a3daf: missing Metro configuration compatibility
|
|
14
|
+
- @granite-js/utils@0.1.19
|
|
15
|
+
|
|
3
16
|
## 0.1.18
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -346,7 +346,23 @@ const EMPTY_CONFIG = {};
|
|
|
346
346
|
async function resolveConfig(config) {
|
|
347
347
|
const [base, ...rest] = config.pluginConfigs;
|
|
348
348
|
if (base == null) return EMPTY_CONFIG;
|
|
349
|
-
|
|
349
|
+
const mergedConfig = await mergeConfig(base, ...rest) ?? EMPTY_CONFIG;
|
|
350
|
+
const resolvedConfig = {
|
|
351
|
+
...mergedConfig,
|
|
352
|
+
metro: resolveMetroConfig(mergedConfig)
|
|
353
|
+
};
|
|
354
|
+
return resolvedConfig;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Injects the some config into the metro config to ensure compatibility with the plugin config.
|
|
358
|
+
*/
|
|
359
|
+
function resolveMetroConfig(pluginConfig) {
|
|
360
|
+
const metroConfig = pluginConfig.metro ?? {};
|
|
361
|
+
return {
|
|
362
|
+
...metroConfig,
|
|
363
|
+
babelConfig: pluginConfig.babel,
|
|
364
|
+
transformSync: pluginConfig?.transformer?.transformSync
|
|
365
|
+
};
|
|
350
366
|
}
|
|
351
367
|
|
|
352
368
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -525,7 +525,11 @@ type StaticPluginConfig = Omit<PluginBuildConfig, 'platform' | 'outfile'> & {
|
|
|
525
525
|
metro?: PluginMetroConfig;
|
|
526
526
|
};
|
|
527
527
|
type DynamicPluginConfig = (() => StaticPluginConfig) | (() => Promise<StaticPluginConfig>);
|
|
528
|
-
type PluginMetroConfig = Omit<
|
|
528
|
+
type PluginMetroConfig = Omit<ResolvedMetroConfig, 'babelConfig' | 'transformSync'>;
|
|
529
|
+
type ResolvedPluginConfig = Omit<StaticPluginConfig, 'metro'> & {
|
|
530
|
+
metro?: ResolvedMetroConfig;
|
|
531
|
+
};
|
|
532
|
+
type ResolvedMetroConfig = AdditionalMetroConfig & MetroDevServerConfig;
|
|
529
533
|
type PluginResolvable = GranitePlugin | GranitePluginCore | Promise<GranitePlugin> | Promise<GranitePluginCore>;
|
|
530
534
|
type PluginInput = PluginResolvable | PluginInput[];
|
|
531
535
|
type PluginBuildConfig = Omit<BuildConfig, 'platform' | 'entry' | 'outfile'>;
|
|
@@ -620,7 +624,7 @@ declare function isBuildFailure(result: BuildResult$1): result is BuildFailureRe
|
|
|
620
624
|
|
|
621
625
|
//#endregion
|
|
622
626
|
//#region src/utils/resolveConfig.d.ts
|
|
623
|
-
declare function resolveConfig(config: CompleteGraniteConfig): Promise<
|
|
627
|
+
declare function resolveConfig(config: CompleteGraniteConfig): Promise<ResolvedPluginConfig>;
|
|
624
628
|
|
|
625
629
|
//#endregion
|
|
626
630
|
//#region src/config/defineConfig.d.ts
|
|
@@ -697,4 +701,4 @@ interface LoadConfigOptions {
|
|
|
697
701
|
declare const loadConfig: (options?: LoadConfigOptions) => Promise<CompleteGraniteConfig>;
|
|
698
702
|
|
|
699
703
|
//#endregion
|
|
700
|
-
export { AdditionalMetroConfig, AliasConfig, AliasResolver, BabelConfig, BuildConfig, BuildFailureResult, BuildResult, BuildSuccessResult, BundleData, CompleteGraniteConfig, DevServerConfig, DynamicPluginConfig, EsbuildConfig, GraniteConfig, GranitePlugin, GranitePluginBuildPostHandler, GranitePluginBuildPreHandler, GranitePluginConfig, GranitePluginCore, GranitePluginDevHandlerArgs, GranitePluginDevPostHandler, GranitePluginDevPreHandler, GranitePluginHooks, GranitePluginPostHandlerArgs, GranitePluginPreHandlerArgs, MetroDevServerConfig, MetroMiddleware, Middleware, ParsedGraniteConfig, PluginBuildConfig, PluginConfig, PluginContext, PluginInput, PluginMetroConfig, PluginResolvable, ProtocolConfig, ResolveResult, ResolveResultWithOptions, ResolverConfig, StaticPluginConfig, SwcConfig, TransformAsync, TransformSync, TransformerConfig, createContext, createPluginContext, createPluginHooksDriver, defineConfig, flattenPlugins, isBuildFailure, isBuildSuccess, loadConfig, mergeBuildConfigs, mergeConfig, pluginConfigSchema, resolveConfig, resolvePlugins };
|
|
704
|
+
export { AdditionalMetroConfig, AliasConfig, AliasResolver, BabelConfig, BuildConfig, BuildFailureResult, BuildResult, BuildSuccessResult, BundleData, CompleteGraniteConfig, DevServerConfig, DynamicPluginConfig, EsbuildConfig, GraniteConfig, GranitePlugin, GranitePluginBuildPostHandler, GranitePluginBuildPreHandler, GranitePluginConfig, GranitePluginCore, GranitePluginDevHandlerArgs, GranitePluginDevPostHandler, GranitePluginDevPreHandler, GranitePluginHooks, GranitePluginPostHandlerArgs, GranitePluginPreHandlerArgs, MetroDevServerConfig, MetroMiddleware, Middleware, ParsedGraniteConfig, PluginBuildConfig, PluginConfig, PluginContext, PluginInput, PluginMetroConfig, PluginResolvable, ProtocolConfig, ResolveResult, ResolveResultWithOptions, ResolvedMetroConfig, ResolvedPluginConfig, ResolverConfig, StaticPluginConfig, SwcConfig, TransformAsync, TransformSync, TransformerConfig, createContext, createPluginContext, createPluginHooksDriver, defineConfig, flattenPlugins, isBuildFailure, isBuildSuccess, loadConfig, mergeBuildConfigs, mergeConfig, pluginConfigSchema, resolveConfig, resolvePlugins };
|
package/dist/index.d.ts
CHANGED
|
@@ -525,7 +525,11 @@ type StaticPluginConfig = Omit<PluginBuildConfig, 'platform' | 'outfile'> & {
|
|
|
525
525
|
metro?: PluginMetroConfig;
|
|
526
526
|
};
|
|
527
527
|
type DynamicPluginConfig = (() => StaticPluginConfig) | (() => Promise<StaticPluginConfig>);
|
|
528
|
-
type PluginMetroConfig = Omit<
|
|
528
|
+
type PluginMetroConfig = Omit<ResolvedMetroConfig, 'babelConfig' | 'transformSync'>;
|
|
529
|
+
type ResolvedPluginConfig = Omit<StaticPluginConfig, 'metro'> & {
|
|
530
|
+
metro?: ResolvedMetroConfig;
|
|
531
|
+
};
|
|
532
|
+
type ResolvedMetroConfig = AdditionalMetroConfig & MetroDevServerConfig;
|
|
529
533
|
type PluginResolvable = GranitePlugin | GranitePluginCore | Promise<GranitePlugin> | Promise<GranitePluginCore>;
|
|
530
534
|
type PluginInput = PluginResolvable | PluginInput[];
|
|
531
535
|
type PluginBuildConfig = Omit<BuildConfig, 'platform' | 'entry' | 'outfile'>;
|
|
@@ -620,7 +624,7 @@ declare function isBuildFailure(result: BuildResult$1): result is BuildFailureRe
|
|
|
620
624
|
|
|
621
625
|
//#endregion
|
|
622
626
|
//#region src/utils/resolveConfig.d.ts
|
|
623
|
-
declare function resolveConfig(config: CompleteGraniteConfig): Promise<
|
|
627
|
+
declare function resolveConfig(config: CompleteGraniteConfig): Promise<ResolvedPluginConfig>;
|
|
624
628
|
|
|
625
629
|
//#endregion
|
|
626
630
|
//#region src/config/defineConfig.d.ts
|
|
@@ -697,4 +701,4 @@ interface LoadConfigOptions {
|
|
|
697
701
|
declare const loadConfig: (options?: LoadConfigOptions) => Promise<CompleteGraniteConfig>;
|
|
698
702
|
|
|
699
703
|
//#endregion
|
|
700
|
-
export { AdditionalMetroConfig, AliasConfig, AliasResolver, BabelConfig, BuildConfig, BuildFailureResult, BuildResult, BuildSuccessResult, BundleData, CompleteGraniteConfig, DevServerConfig, DynamicPluginConfig, EsbuildConfig, GraniteConfig, GranitePlugin, GranitePluginBuildPostHandler, GranitePluginBuildPreHandler, GranitePluginConfig, GranitePluginCore, GranitePluginDevHandlerArgs, GranitePluginDevPostHandler, GranitePluginDevPreHandler, GranitePluginHooks, GranitePluginPostHandlerArgs, GranitePluginPreHandlerArgs, MetroDevServerConfig, MetroMiddleware, Middleware, ParsedGraniteConfig, PluginBuildConfig, PluginConfig, PluginContext, PluginInput, PluginMetroConfig, PluginResolvable, ProtocolConfig, ResolveResult, ResolveResultWithOptions, ResolverConfig, StaticPluginConfig, SwcConfig, TransformAsync, TransformSync, TransformerConfig, createContext, createPluginContext, createPluginHooksDriver, defineConfig, flattenPlugins, isBuildFailure, isBuildSuccess, loadConfig, mergeBuildConfigs, mergeConfig, pluginConfigSchema, resolveConfig, resolvePlugins };
|
|
704
|
+
export { AdditionalMetroConfig, AliasConfig, AliasResolver, BabelConfig, BuildConfig, BuildFailureResult, BuildResult, BuildSuccessResult, BundleData, CompleteGraniteConfig, DevServerConfig, DynamicPluginConfig, EsbuildConfig, GraniteConfig, GranitePlugin, GranitePluginBuildPostHandler, GranitePluginBuildPreHandler, GranitePluginConfig, GranitePluginCore, GranitePluginDevHandlerArgs, GranitePluginDevPostHandler, GranitePluginDevPreHandler, GranitePluginHooks, GranitePluginPostHandlerArgs, GranitePluginPreHandlerArgs, MetroDevServerConfig, MetroMiddleware, Middleware, ParsedGraniteConfig, PluginBuildConfig, PluginConfig, PluginContext, PluginInput, PluginMetroConfig, PluginResolvable, ProtocolConfig, ResolveResult, ResolveResultWithOptions, ResolvedMetroConfig, ResolvedPluginConfig, ResolverConfig, StaticPluginConfig, SwcConfig, TransformAsync, TransformSync, TransformerConfig, createContext, createPluginContext, createPluginHooksDriver, defineConfig, flattenPlugins, isBuildFailure, isBuildSuccess, loadConfig, mergeBuildConfigs, mergeConfig, pluginConfigSchema, resolveConfig, resolvePlugins };
|
package/dist/index.js
CHANGED
|
@@ -323,7 +323,23 @@ const EMPTY_CONFIG = {};
|
|
|
323
323
|
async function resolveConfig(config) {
|
|
324
324
|
const [base, ...rest] = config.pluginConfigs;
|
|
325
325
|
if (base == null) return EMPTY_CONFIG;
|
|
326
|
-
|
|
326
|
+
const mergedConfig = await mergeConfig(base, ...rest) ?? EMPTY_CONFIG;
|
|
327
|
+
const resolvedConfig = {
|
|
328
|
+
...mergedConfig,
|
|
329
|
+
metro: resolveMetroConfig(mergedConfig)
|
|
330
|
+
};
|
|
331
|
+
return resolvedConfig;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Injects the some config into the metro config to ensure compatibility with the plugin config.
|
|
335
|
+
*/
|
|
336
|
+
function resolveMetroConfig(pluginConfig) {
|
|
337
|
+
const metroConfig = pluginConfig.metro ?? {};
|
|
338
|
+
return {
|
|
339
|
+
...metroConfig,
|
|
340
|
+
babelConfig: pluginConfig.babel,
|
|
341
|
+
transformSync: pluginConfig?.transformer?.transformSync
|
|
342
|
+
};
|
|
327
343
|
}
|
|
328
344
|
|
|
329
345
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@granite-js/plugin-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.20",
|
|
5
5
|
"description": "The core plugin module for Granite",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"vitest": "^3.0.9"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@granite-js/utils": "0.1.
|
|
37
|
+
"@granite-js/utils": "0.1.20",
|
|
38
38
|
"@swc/core": "1.5.24",
|
|
39
39
|
"@types/babel__core": "^7",
|
|
40
40
|
"@types/connect": "^3",
|