@granite-js/mpack 1.0.36 → 1.0.37

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @granite-js/mpack
2
2
 
3
+ ## 1.0.37
4
+
5
+ ### Patch Changes
6
+
7
+ - 2096242: add `aliasFields` to enhanced-resolver
8
+ - @granite-js/plugin-core@1.0.37
9
+ - @granite-js/utils@1.0.37
10
+
3
11
  ## 1.0.36
4
12
 
5
13
  ### Patch Changes
@@ -16,5 +16,6 @@ export declare const BUNDLE_NAME: `${string}.bundle`;
16
16
  export declare const DEBUGGER_FRONTEND_PATH = "/debugger-frontend";
17
17
  export declare const RESOLVER_MAIN_FIELDS: string[];
18
18
  export declare const RESOLVER_EXPORTS_MAP_CONDITIONS: string[];
19
+ export declare const RESOLVER_ALIAS_FIELDS: string[];
19
20
  export declare const INTERNAL_NAMESPACE_IDENTIFIER = "__mpackInternal";
20
21
  export declare const INTERNAL_LOAD_REMOTE_IDENTIFIER = "loadRemote";
@@ -39,6 +39,7 @@ __export(constants_exports, {
39
39
  MPACK_DATA_DIR: () => MPACK_DATA_DIR,
40
40
  PRELUDE_PROTOCOL: () => PRELUDE_PROTOCOL,
41
41
  REQUIRE_CONTEXT_PROTOCOL: () => REQUIRE_CONTEXT_PROTOCOL,
42
+ RESOLVER_ALIAS_FIELDS: () => RESOLVER_ALIAS_FIELDS,
42
43
  RESOLVER_EXPORTS_MAP_CONDITIONS: () => RESOLVER_EXPORTS_MAP_CONDITIONS,
43
44
  RESOLVER_MAIN_FIELDS: () => RESOLVER_MAIN_FIELDS,
44
45
  SERVICE_BUNDLE_NAME: () => SERVICE_BUNDLE_NAME,
@@ -67,6 +68,7 @@ const BUNDLE_NAME = (0, import_getBundleName.getBundleName)("index");
67
68
  const DEBUGGER_FRONTEND_PATH = "/debugger-frontend";
68
69
  const RESOLVER_MAIN_FIELDS = ["react-native", "browser", "main"];
69
70
  const RESOLVER_EXPORTS_MAP_CONDITIONS = ["react-native"];
71
+ const RESOLVER_ALIAS_FIELDS = ["react-native", "browser"];
70
72
  const INTERNAL_NAMESPACE_IDENTIFIER = "__mpackInternal";
71
73
  const INTERNAL_LOAD_REMOTE_IDENTIFIER = "loadRemote";
72
74
  // Annotate the CommonJS export names for ESM import in node:
@@ -82,6 +84,7 @@ const INTERNAL_LOAD_REMOTE_IDENTIFIER = "loadRemote";
82
84
  MPACK_DATA_DIR,
83
85
  PRELUDE_PROTOCOL,
84
86
  REQUIRE_CONTEXT_PROTOCOL,
87
+ RESOLVER_ALIAS_FIELDS,
85
88
  RESOLVER_EXPORTS_MAP_CONDITIONS,
86
89
  RESOLVER_MAIN_FIELDS,
87
90
  SERVICE_BUNDLE_NAME,
@@ -1,6 +1,4 @@
1
1
  import type { MetroResolutionContext } from '@granite-js/plugin-core';
2
- interface CreateResolverOptions {
3
- conditionNames?: string[];
4
- }
2
+ import { ResolveOptions } from 'enhanced-resolve';
3
+ export type CreateResolverOptions = Omit<ResolveOptions, 'fileSystem' | 'extensions'>;
5
4
  export declare function createResolver(rootPath: string, options?: CreateResolverOptions): (context: MetroResolutionContext, request: string, platform: string | null) => any;
6
- export {};
@@ -62,8 +62,10 @@ function createResolver(rootPath, options) {
62
62
  finalExtensions = [...baseExtensions.map((extension) => `.${platform}${extension}`), ...finalExtensions];
63
63
  }
64
64
  const resolver = import_enhanced_resolve.default.create.sync({
65
+ ...options,
65
66
  extensions: finalExtensions,
66
67
  mainFields: context.mainFields,
68
+ aliasFields: options?.aliasFields ?? [...import_constants.RESOLVER_ALIAS_FIELDS],
67
69
  conditionNames: options?.conditionNames ?? [...import_constants.RESOLVER_EXPORTS_MAP_CONDITIONS, "require", "node", "default"],
68
70
  mainFiles: ["index"],
69
71
  modules: ["node_modules", import_path.default.join(rootPath2, "src")]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granite-js/mpack",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "A bundler for Granite apps",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -92,8 +92,8 @@
92
92
  "@babel/traverse": "7.28.5",
93
93
  "@babel/types": "7.28.5",
94
94
  "@fastify/middie": "8.3.0",
95
- "@granite-js/plugin-core": "1.0.36",
96
- "@granite-js/utils": "1.0.36",
95
+ "@granite-js/plugin-core": "1.0.37",
96
+ "@granite-js/utils": "1.0.37",
97
97
  "@react-native-community/cli-plugin-metro": "11.3.7",
98
98
  "@react-native-community/cli-server-api": "11.3.7",
99
99
  "@react-native-community/cli-tools": "11.3.7",