@rock-js/plugin-metro 0.11.4 → 0.11.6

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.
Files changed (57) hide show
  1. package/package.json +4 -3
  2. package/template/package.json +1 -1
  3. package/dist/src/index.d.ts.map +0 -1
  4. package/dist/src/lib/bundle/__tests__/filterPlatformAssetScales-test.d.ts +0 -8
  5. package/dist/src/lib/bundle/__tests__/filterPlatformAssetScales-test.js +0 -29
  6. package/dist/src/lib/bundle/__tests__/filterPlatformAssetScales-test.js.map +0 -1
  7. package/dist/src/lib/bundle/assetCatalogIOS.d.ts +0 -21
  8. package/dist/src/lib/bundle/assetCatalogIOS.js +0 -54
  9. package/dist/src/lib/bundle/assetCatalogIOS.js.map +0 -1
  10. package/dist/src/lib/bundle/assetPathUtils.d.ts +0 -28
  11. package/dist/src/lib/bundle/assetPathUtils.js +0 -72
  12. package/dist/src/lib/bundle/assetPathUtils.js.map +0 -1
  13. package/dist/src/lib/bundle/buildBundle.d.ts +0 -57
  14. package/dist/src/lib/bundle/buildBundle.js +0 -99
  15. package/dist/src/lib/bundle/buildBundle.js.map +0 -1
  16. package/dist/src/lib/bundle/command.d.ts.map +0 -1
  17. package/dist/src/lib/bundle/createKeepFileAsync.d.ts +0 -10
  18. package/dist/src/lib/bundle/createKeepFileAsync.js +0 -28
  19. package/dist/src/lib/bundle/createKeepFileAsync.js.map +0 -1
  20. package/dist/src/lib/bundle/filterPlatformAssetScales.d.ts +0 -9
  21. package/dist/src/lib/bundle/filterPlatformAssetScales.js +0 -36
  22. package/dist/src/lib/bundle/filterPlatformAssetScales.js.map +0 -1
  23. package/dist/src/lib/bundle/getAssetDestPathAndroid.d.ts +0 -10
  24. package/dist/src/lib/bundle/getAssetDestPathAndroid.js +0 -16
  25. package/dist/src/lib/bundle/getAssetDestPathAndroid.js.map +0 -1
  26. package/dist/src/lib/bundle/getAssetDestPathIOS.d.ts +0 -10
  27. package/dist/src/lib/bundle/getAssetDestPathIOS.js +0 -19
  28. package/dist/src/lib/bundle/getAssetDestPathIOS.js.map +0 -1
  29. package/dist/src/lib/bundle/index.d.ts +0 -11
  30. package/dist/src/lib/bundle/index.js +0 -106
  31. package/dist/src/lib/bundle/index.js.map +0 -1
  32. package/dist/src/lib/bundle/saveAssets.d.ts +0 -10
  33. package/dist/src/lib/bundle/saveAssets.js +0 -112
  34. package/dist/src/lib/bundle/saveAssets.js.map +0 -1
  35. package/dist/src/lib/getDevMiddleware.d.ts +0 -2
  36. package/dist/src/lib/getDevMiddleware.js +0 -15
  37. package/dist/src/lib/getDevMiddleware.js.map +0 -1
  38. package/dist/src/lib/loadMetroConfig.d.ts +0 -24
  39. package/dist/src/lib/loadMetroConfig.js +0 -76
  40. package/dist/src/lib/loadMetroConfig.js.map +0 -1
  41. package/dist/src/lib/pluginMetro.d.ts.map +0 -1
  42. package/dist/src/lib/start/OpenDebuggerKeyboardHandler.d.ts.map +0 -1
  43. package/dist/src/lib/start/attachKeyHandlers.d.ts.map +0 -1
  44. package/dist/src/lib/start/command.d.ts.map +0 -1
  45. package/dist/src/lib/start/createDevMiddlewareLogger.d.ts.map +0 -1
  46. package/dist/src/lib/start/loadMetroConfig.d.ts.map +0 -1
  47. package/dist/src/lib/start/metroPlatformResolver.d.ts.map +0 -1
  48. package/dist/src/lib/start/runServer.d.ts.map +0 -1
  49. package/dist/src/utils/loadMetroConfig.d.ts +0 -24
  50. package/dist/src/utils/loadMetroConfig.js +0 -76
  51. package/dist/src/utils/loadMetroConfig.js.map +0 -1
  52. package/dist/src/utils/metroPlatformResolver.d.ts +0 -24
  53. package/dist/src/utils/metroPlatformResolver.js +0 -38
  54. package/dist/src/utils/metroPlatformResolver.js.map +0 -1
  55. package/dist/src/utils/parseKeyValueParamArray.d.ts +0 -8
  56. package/dist/src/utils/parseKeyValueParamArray.js +0 -21
  57. package/dist/src/utils/parseKeyValueParamArray.js.map +0 -1
@@ -1,106 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import path from 'path';
9
- import buildBundle from './buildBundle.js';
10
- const bundleCommand = {
11
- name: 'bundle',
12
- description: 'Build the bundle for the provided JavaScript entry file.',
13
- func: buildBundle,
14
- options: [
15
- {
16
- name: '--entry-file <path>',
17
- description: 'Path to the root JS file, either absolute or relative to JS root',
18
- },
19
- {
20
- name: '--platform <string>',
21
- description: 'Either "ios" or "android"',
22
- default: 'ios',
23
- },
24
- {
25
- name: '--transformer <string>',
26
- description: 'Specify a custom transformer to be used',
27
- },
28
- {
29
- name: '--dev [boolean]',
30
- description: 'If false, warnings are disabled and the bundle is minified',
31
- parse: (val) => val !== 'false',
32
- default: true,
33
- },
34
- {
35
- name: '--minify [boolean]',
36
- description: 'Allows overriding whether bundle is minified. This defaults to ' +
37
- 'false if dev is true, and true if dev is false. Disabling minification ' +
38
- 'can be useful for speeding up production builds for testing purposes.',
39
- parse: (val) => val !== 'false',
40
- },
41
- {
42
- name: '--bundle-output <string>',
43
- description: 'File name where to store the resulting bundle, ex. /tmp/groups.bundle',
44
- },
45
- {
46
- name: '--bundle-encoding <string>',
47
- description: 'Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer).',
48
- default: 'utf8',
49
- },
50
- {
51
- name: '--max-workers <number>',
52
- description: 'Specifies the maximum number of workers the worker-pool ' +
53
- 'will spawn for transforming files. This defaults to the number of the ' +
54
- 'cores available on your machine.',
55
- },
56
- {
57
- name: '--sourcemap-output <string>',
58
- description: 'File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map',
59
- },
60
- {
61
- name: '--sourcemap-sources-root <string>',
62
- description: "Path to make sourcemap's sources entries relative to, ex. /root/dir",
63
- },
64
- {
65
- name: '--sourcemap-use-absolute-path',
66
- description: 'Report SourceMapURL using its full path',
67
- default: false,
68
- },
69
- {
70
- name: '--assets-dest <string>',
71
- description: 'Directory name where to store assets referenced in the bundle',
72
- },
73
- {
74
- name: '--unstable-transform-profile <string>',
75
- description: 'Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default',
76
- default: 'default',
77
- },
78
- {
79
- name: '--asset-catalog-dest [string]',
80
- description: 'Path where to create an iOS Asset Catalog for images',
81
- },
82
- {
83
- name: '--reset-cache',
84
- description: 'Removes cached files',
85
- default: false,
86
- },
87
- {
88
- name: '--read-global-cache',
89
- description: 'Try to fetch transformed JS code from the global cache, if configured.',
90
- default: false,
91
- },
92
- {
93
- name: '--config <string>',
94
- description: 'Path to the CLI configuration file',
95
- parse: (val) => path.resolve(val),
96
- },
97
- {
98
- name: '--resolver-option <string...>',
99
- description: 'Custom resolver options of the form key=value. URL-encoded. May be specified multiple times.',
100
- // @ts-expect-error - TODO: fix this
101
- parse: (val, previous = []) => previous.concat([val]),
102
- },
103
- ],
104
- };
105
- export { bundleCommand };
106
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/bundle/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAI3C,MAAM,aAAa,GAAgB;IACjC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,0DAA0D;IACvE,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE;QACP;YACE,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EACT,kEAAkE;SACrE;QACD;YACE,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE,KAAK;SACf;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,WAAW,EAAE,yCAAyC;SACvD;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE,4DAA4D;YACzE,KAAK,EAAE,CAAC,GAAW,EAAW,EAAE,CAAC,GAAG,KAAK,OAAO;Y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CAAoC;YACpC,KAAK,EAAE,CAAC,GAAW,EAAE,WAA0B,EAAE,EAAiB,EAAE,CAClE,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;SACzB;KACF;CACF,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import type { AssetData } from 'metro';
9
- declare function saveAssets(assets: ReadonlyArray<AssetData>, platform: string, assetsDest?: string, assetCatalogDest?: string): Promise<void>;
10
- export default saveAssets;
@@ -1,112 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import fs from 'fs';
9
- import path from 'path';
10
- import { cleanAssetCatalog, getImageSet, isCatalogAsset, writeImageSet, } from './assetCatalogIOS.js';
11
- import createKeepFileAsync from './createKeepFileAsync.js';
12
- import filterPlatformAssetScales from './filterPlatformAssetScales.js';
13
- import getAssetDestPathAndroid from './getAssetDestPathAndroid.js';
14
- import getAssetDestPathIOS from './getAssetDestPathIOS.js';
15
- // import { styleText } from 'util'; // Not available in all Node versions
16
- function styleText(style, text) {
17
- const styles = {
18
- red: '\x1b[31m',
19
- bold: '\x1b[1m',
20
- reset: '\x1b[0m'
21
- };
22
- const colorCode = styles[style] || '';
23
- return `${colorCode}${text}${styles.reset}`;
24
- }
25
- async function saveAssets(assets, platform, assetsDest, assetCatalogDest) {
26
- if (assetsDest == null) {
27
- console.warn('Warning: Assets destination folder is not set, skipping...');
28
- return;
29
- }
30
- const filesToCopy = {};
31
- const getAssetDestPath = platform === 'android' ? getAssetDestPathAndroid : getAssetDestPathIOS;
32
- const addAssetToCopy = (asset) => {
33
- const validScales = new Set(filterPlatformAssetScales(platform, asset.scales));
34
- asset.scales.forEach((scale, idx) => {
35
- if (!validScales.has(scale)) {
36
- return;
37
- }
38
- const src = asset.files[idx];
39
- const dest = path.join(assetsDest, getAssetDestPath(asset, scale));
40
- filesToCopy[src] = dest;
41
- });
42
- };
43
- if (platform === 'ios' && assetCatalogDest != null) {
44
- // Use iOS Asset Catalog for images. This will allow Apple app thinning to
45
- // remove unused scales from the optimized bundle.
46
- const catalogDir = path.join(assetCatalogDest, 'RNAssets.xcassets');
47
- if (!fs.existsSync(catalogDir)) {
48
- console.error(`${styleText('red', 'error')}: Could not find asset catalog 'RNAssets.xcassets' in ${assetCatalogDest}. Make sure to create it if it does not exist.`);
49
- return;
50
- }
51
- console.info('Adding images to asset catalog', catalogDir);
52
- cleanAssetCatalog(catalogDir);
53
- for (const asset of assets) {
54
- if (isCatalogAsset(asset)) {
55
- const imageSet = getImageSet(catalogDir, asset, filterPlatformAssetScales(platform, asset.scales));
56
- writeImageSet(imageSet);
57
- }
58
- else {
59
- addAssetToCopy(asset);
60
- }
61
- }
62
- console.info('Done adding images to asset catalog');
63
- }
64
- else {
65
- assets.forEach(addAssetToCopy);
66
- }
67
- if (platform === 'android') {
68
- await createKeepFileAsync(assets, assetsDest);
69
- }
70
- return copyAll(filesToCopy);
71
- }
72
- function copyAll(filesToCopy) {
73
- const queue = Object.keys(filesToCopy);
74
- if (queue.length === 0) {
75
- return Promise.resolve();
76
- }
77
- console.info(`Copying ${queue.length} asset files`);
78
- return new Promise((resolve, reject) => {
79
- const copyNext = (error) => {
80
- if (error) {
81
- reject(error);
82
- return;
83
- }
84
- if (queue.length === 0) {
85
- console.info('Done copying assets');
86
- resolve();
87
- }
88
- else {
89
- // queue.length === 0 is checked in previous branch, so this is string
90
- const src = queue.shift();
91
- const dest = filesToCopy[src];
92
- copy(src, dest, copyNext);
93
- }
94
- };
95
- copyNext();
96
- });
97
- }
98
- function copy(src, dest, callback) {
99
- const destDir = path.dirname(dest);
100
- fs.mkdir(destDir, { recursive: true }, (err) => {
101
- if (err) {
102
- callback(err);
103
- return;
104
- }
105
- fs.createReadStream(src)
106
- .pipe(fs.createWriteStream(dest))
107
- .on('finish', () => callback())
108
- .on('error', callback);
109
- });
110
- }
111
- export default saveAssets;
112
- //# sourceMappingURL=saveAssets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"saveAssets.js","sourceRoot":"","sources":["../../../../src/lib/bundle/saveAssets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,yBAAyB,MAAM,gCAAgC,CAAC;AACvE,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,0EAA0E;AAC1E,SAAS,SAAS,CAAC,KAAa,EAAE,IAAY;IAC5C,MAAM,MAAM,GAAG;QACb,GAAG,EAAE,UAAU;QACf,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;KACjB,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,CAAC,KAA4B,CAAC,IAAI,EAAE,CAAC;IAC7D,OAAO,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;AAC9C,CAAC;AAMD,KAAK,UAAU,UAAU,CACvB,MAAgC,EAChC,QAAgB,EAChB,UAAmB,EACnB,gBAAyB;IAEzB,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;QAC3E,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAgB,EAAE,CAAC;IAEpC,MAAM,gBAAgB,GACpB,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,uBAAuB,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BAC3B,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;gBAC9B,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC;QACF,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,IAAI,CACX,GAAW,EACX,IAAY,EACZ,QAAiC;IAEjC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;QAC7C,IAAI,GAAG,EAAE,CAAC;YACR,QAAQ,CAAC,GAAG,CAAC,CAAC;YACd,OAAO;QACT,CAAC;QACD,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC;aACrB,IAAI,CAAC,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;aAChC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;aAC9B,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,eAAe,UAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function getDevMiddleware(reactNativePath: string): Promise<any>;
2
- export declare function getReactNativeCommunityCliPlugin(reactNativePath: string): Promise<any>;
@@ -1,15 +0,0 @@
1
- import { createRequire } from 'node:module';
2
- export async function getDevMiddleware(reactNativePath) {
3
- const require = createRequire(import.meta.url);
4
- const reactNativeCommunityCliPluginPath = require.resolve('@react-native/community-cli-plugin', { paths: [reactNativePath] });
5
- const devMiddlewarePath = require.resolve('@react-native/dev-middleware', {
6
- paths: [reactNativeCommunityCliPluginPath],
7
- });
8
- return import(devMiddlewarePath);
9
- }
10
- export async function getReactNativeCommunityCliPlugin(reactNativePath) {
11
- const require = createRequire(import.meta.url);
12
- const reactNativeCommunityCliPluginPath = require.resolve('@react-native/community-cli-plugin', { paths: [reactNativePath] });
13
- return import(reactNativeCommunityCliPluginPath);
14
- }
15
- //# sourceMappingURL=getDevMiddleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDevMiddleware.js","sourceRoot":"","sources":["../../../src/lib/getDevMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,eAAuB;IAC5D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,iCAAiC,GAAG,OAAO,CAAC,OAAO,CACvD,oCAAoC,EACpC,EAAE,KAAK,EAAE,CAAC,eAAe,CAAC,EAAE,CAC7B,CAAC;IAEF,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,8BAA8B,EAAE;QACxE,KAAK,EAAE,CAAC,iCAAiC,CAAC;KAC3C,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,eAAuB;IAEvB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,iCAAiC,GAAG,OAAO,CAAC,OAAO,CACvD,oCAAoC,EACpC,EAAE,KAAK,EAAE,CAAC,eAAe,CAAC,EAAE,CAC7B,CAAC;IAEF,OAAO,MAAM,CAAC,iCAAiC,CAAC,CAAC;AACnD,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import type { ConfigT, YargArguments } from 'metro-config';
8
- export type ConfigLoadingContext = Readonly<{
9
- root: string;
10
- reactNativePath: string;
11
- platforms: Record<string, object>;
12
- }>;
13
- /**
14
- * Load Metro config.
15
- *
16
- * Allows the CLI to override select values in `metro.config.js` based on
17
- * dynamic user options in `ctx`.
18
- */
19
- export default function loadMetroConfig(ctx: {
20
- platforms: Record<string, object>;
21
- reactNativeVersion: string;
22
- reactNativePath: string;
23
- root: string;
24
- }, options?: YargArguments): Promise<ConfigT>;
@@ -1,76 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { createRequire } from 'node:module';
8
- import path from 'node:path';
9
- import { logger, RnefError } from '@rnef/tools';
10
- import { loadConfig, mergeConfig, resolveConfig } from 'metro-config';
11
- import { reactNativePlatformResolver } from './metroPlatformResolver.js';
12
- /**
13
- * Get the config options to override based on RN CLI inputs.
14
- */
15
- function getOverrideConfig(ctx, config) {
16
- const outOfTreePlatforms = Object.keys(ctx.platforms).filter(
17
- // @ts-expect-error - TBD
18
- (platform) => ctx.platforms[platform].npmPackageName);
19
- const resolver = {
20
- platforms: [...Object.keys(ctx.platforms), 'native'],
21
- };
22
- if (outOfTreePlatforms.length) {
23
- // @ts-expect-error - TBD
24
- resolver.resolveRequest = reactNativePlatformResolver(outOfTreePlatforms.reduce((result, platform) => {
25
- // @ts-expect-error - TBD
26
- result[platform] = ctx.platforms[platform].npmPackageName;
27
- return result;
28
- }, {}), config.resolver?.resolveRequest);
29
- }
30
- const require = createRequire(import.meta.url);
31
- return {
32
- resolver,
33
- serializer: {
34
- // We can include multiple copies of InitializeCore here because metro will
35
- // only add ones that are already part of the bundle
36
- getModulesRunBeforeMainModule: () => [
37
- require.resolve(path.join(ctx.reactNativePath, 'Libraries/Core/InitializeCore'), { paths: [ctx.root] }),
38
- ...outOfTreePlatforms.map((platform) => require.resolve(
39
- // @ts-expect-error - TBD
40
- `${ctx.platforms[platform].npmPackageName}/Libraries/Core/InitializeCore`, { paths: [ctx.root] })),
41
- ],
42
- },
43
- };
44
- }
45
- /**
46
- * Load Metro config.
47
- *
48
- * Allows the CLI to override select values in `metro.config.js` based on
49
- * dynamic user options in `ctx`.
50
- */
51
- export default async function loadMetroConfig(ctx, options = {}) {
52
- const cwd = ctx.root;
53
- const projectConfig = await resolveConfig(options.config, cwd);
54
- if (projectConfig.isEmpty) {
55
- throw new RnefError(`No Metro config found in ${cwd}`);
56
- }
57
- logger.debug(`Reading Metro config from ${projectConfig.filepath}`);
58
- // @ts-expect-error - we're fine with this
59
- if (!global.__REACT_NATIVE_METRO_CONFIG_LOADED) {
60
- const warning = `
61
- =================================================================================================
62
- From React Native 0.73, your project's Metro config should extend '@react-native/metro-config'
63
- or it will fail to build. Please copy the template at:
64
- https://github.com/react-native-community/template/blob/main/template/metro.config.js
65
- This warning will be removed in future (https://github.com/facebook/metro/issues/1018).
66
- =================================================================================================
67
- `;
68
- for (const line of warning.trim().split('\n')) {
69
- console.warn(line);
70
- }
71
- }
72
- const config = await loadConfig({ cwd, ...options });
73
- const overrideConfig = getOverrideConfig(ctx, config);
74
- return mergeConfig(config, overrideConfig);
75
- }
76
- //# sourceMappingURL=loadMetroConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadMetroConfig.js","sourceRoot":"","sources":["../../../src/lib/loadMetroConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAQzE;;GAEG;AACH,SAAS,iBAAiB,CACxB,GAAyB,EACzB,MAAe;IAEf,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,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,eAAe,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"OpenDebuggerKeyboardHandler.d.ts","sourceRoot":"","sources":["../../../../src/lib/start/OpenDebuggerKeyboardHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAQvE,MAAM,CAAC,OAAO,OAAO,2BAA2B;;gBAKlC,EACV,YAAY,EACZ,QAAQ,GACT,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,gBAAgB,CAAC;KAC5B;IAkCD;;;;;;;OAOG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAmDzC;;;;;;OAMG;IACH,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAgBpD;;OAEG;IACH,OAAO;CA6BR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachKeyHandlers.d.ts","sourceRoot":"","sources":["../../../../src/lib/start/attachKeyHandlers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AA0BvE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,YAAY,EACZ,aAAa,EACb,QAAQ,GACT,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE;QACb,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;KAC5E,CAAC;IACF,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,QAmFA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/lib/start/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAK9C,eAAO,MAAM,oBAAoB,QAAS,SAAS,SAkHlD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDevMiddlewareLogger.d.ts","sourceRoot":"","sources":["../../../../src/lib/start/createDevMiddlewareLogger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,KAAK,QAAQ,GAAG,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,QAAQ,EAAE,gBAAgB,GACzB,QAAQ,CAAC;IACV,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC,CAMD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadMetroConfig.d.ts","sourceRoot":"","sources":["../../../../src/lib/start/loadMetroConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAgB,aAAa,EAAE,MAAM,cAAc,CAAC;AAIzE,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC,CAAC;AAuDH;;;;;GAKG;AACH,wBAA8B,eAAe,CAC3C,GAAG,EAAE;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd,EACD,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,OAAO,CAAC,CA8BlB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"metroPlatformResolver.d.ts","sourceRoot":"","sources":["../../../../src/lib/start/metroPlatformResolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACzC,uBAAuB,EAAE;IACvB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,EACD,cAAc,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAChD,cAAc,CAiBhB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runServer.d.ts","sourceRoot":"","sources":["../../../../src/lib/start/runServer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,iBAAe,SAAS,CACtB,OAAO,EAAE;IACP,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd,EACD,IAAI,EAAE,gBAAgB,iBAqHvB;AAsBD,eAAe,SAAS,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import type { ConfigT, YargArguments } from 'metro-config';
8
- export type ConfigLoadingContext = Readonly<{
9
- root: string;
10
- reactNativePath: string;
11
- platforms: Record<string, object>;
12
- }>;
13
- /**
14
- * Load Metro config.
15
- *
16
- * Allows the CLI to override select values in `metro.config.js` based on
17
- * dynamic user options in `ctx`.
18
- */
19
- export default function loadMetroConfig(ctx: {
20
- platforms: Record<string, object>;
21
- reactNativeVersion: string;
22
- reactNativePath: string;
23
- root: string;
24
- }, options?: YargArguments): Promise<ConfigT>;
@@ -1,76 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { createRequire } from 'node:module';
8
- import path from 'node:path';
9
- import { logger, RnefError } from '@rnef/tools';
10
- import { loadConfig, mergeConfig, resolveConfig } from 'metro-config';
11
- import { reactNativePlatformResolver } from './metroPlatformResolver.js';
12
- /**
13
- * Get the config options to override based on RN CLI inputs.
14
- */
15
- function getOverrideConfig(ctx, config) {
16
- const outOfTreePlatforms = Object.keys(ctx.platforms).filter(
17
- // @ts-expect-error - TBD
18
- (platform) => ctx.platforms[platform].npmPackageName);
19
- const resolver = {
20
- platforms: [...Object.keys(ctx.platforms), 'native'],
21
- };
22
- if (outOfTreePlatforms.length) {
23
- // @ts-expect-error - TBD
24
- resolver.resolveRequest = reactNativePlatformResolver(outOfTreePlatforms.reduce((result, platform) => {
25
- // @ts-expect-error - TBD
26
- result[platform] = ctx.platforms[platform].npmPackageName;
27
- return result;
28
- }, {}), config.resolver?.resolveRequest);
29
- }
30
- const require = createRequire(import.meta.url);
31
- return {
32
- resolver,
33
- serializer: {
34
- // We can include multiple copies of InitializeCore here because metro will
35
- // only add ones that are already part of the bundle
36
- getModulesRunBeforeMainModule: () => [
37
- require.resolve(path.join(ctx.reactNativePath, 'Libraries/Core/InitializeCore'), { paths: [ctx.root] }),
38
- ...outOfTreePlatforms.map((platform) => require.resolve(
39
- // @ts-expect-error - TBD
40
- `${ctx.platforms[platform].npmPackageName}/Libraries/Core/InitializeCore`, { paths: [ctx.root] })),
41
- ],
42
- },
43
- };
44
- }
45
- /**
46
- * Load Metro config.
47
- *
48
- * Allows the CLI to override select values in `metro.config.js` based on
49
- * dynamic user options in `ctx`.
50
- */
51
- export default async function loadMetroConfig(ctx, options = {}) {
52
- const cwd = ctx.root;
53
- const projectConfig = await resolveConfig(options.config, cwd);
54
- if (projectConfig.isEmpty) {
55
- throw new RnefError(`No Metro config found in ${cwd}`);
56
- }
57
- logger.debug(`Reading Metro config from ${projectConfig.filepath}`);
58
- // @ts-expect-error - we're fine with this
59
- if (!global.__REACT_NATIVE_METRO_CONFIG_LOADED) {
60
- const warning = `
61
- =================================================================================================
62
- From React Native 0.73, your project's Metro config should extend '@react-native/metro-config'
63
- or it will fail to build. Please copy the template at:
64
- https://github.com/react-native-community/template/blob/main/template/metro.config.js
65
- This warning will be removed in future (https://github.com/facebook/metro/issues/1018).
66
- =================================================================================================
67
- `;
68
- for (const line of warning.trim().split('\n')) {
69
- console.warn(line);
70
- }
71
- }
72
- const config = await loadConfig({ cwd, ...options });
73
- const overrideConfig = getOverrideConfig(ctx, config);
74
- return mergeConfig(config, overrideConfig);
75
- }
76
- //# sourceMappingURL=loadMetroConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadMetroConfig.js","sourceRoot":"","sources":["../../../src/utils/loadMetroConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA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AAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAEtD,OAAO,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import type { CustomResolver } from 'metro-resolver';
8
- /**
9
- * This is an implementation of a metro resolveRequest option which will remap react-native imports
10
- * to different npm packages based on the platform requested. This allows a single metro instance/config
11
- * to produce bundles for multiple out of tree platforms at a time.
12
- *
13
- * @param platformImplementations
14
- * A map of platform to npm package that implements that platform
15
- *
16
- * Ex:
17
- * {
18
- * windows: 'react-native-windows'
19
- * macos: 'react-native-macos'
20
- * }
21
- */
22
- export declare function reactNativePlatformResolver(platformImplementations: {
23
- [platform: string]: string;
24
- }, customResolver: CustomResolver | null | undefined): CustomResolver;
@@ -1,38 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- /**
8
- * This is an implementation of a metro resolveRequest option which will remap react-native imports
9
- * to different npm packages based on the platform requested. This allows a single metro instance/config
10
- * to produce bundles for multiple out of tree platforms at a time.
11
- *
12
- * @param platformImplementations
13
- * A map of platform to npm package that implements that platform
14
- *
15
- * Ex:
16
- * {
17
- * windows: 'react-native-windows'
18
- * macos: 'react-native-macos'
19
- * }
20
- */
21
- export function reactNativePlatformResolver(platformImplementations, customResolver) {
22
- return (context, moduleName, platform) => {
23
- let modifiedModuleName = moduleName;
24
- if (platform != null && platformImplementations[platform]) {
25
- if (moduleName === 'react-native') {
26
- modifiedModuleName = platformImplementations[platform];
27
- }
28
- else if (moduleName.startsWith('react-native/')) {
29
- modifiedModuleName = `${platformImplementations[platform]}/${modifiedModuleName.slice('react-native/'.length)}`;
30
- }
31
- }
32
- if (customResolver) {
33
- return customResolver(context, modifiedModuleName, platform);
34
- }
35
- return context.resolveRequest(context, modifiedModuleName, platform);
36
- };
37
- }
38
- //# sourceMappingURL=metroPlatformResolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metroPlatformResolver.js","sourceRoot":"","sources":["../../../src/utils/metroPlatformResolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,2BAA2B,CACzC,uBAEC,EACD,cAAiD;IAEjD,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE;QACvC,IAAI,kBAAkB,GAAG,UAAU,CAAC;QACpC,IAAI,QAAQ,IAAI,IAAI,IAAI,uBAAuB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1D,IAAI,UAAU,KAAK,cAAc,EAAE,CAAC;gBAClC,kBAAkB,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YACzD,CAAC;iBAAM,IAAI,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;gBAClD,kBAAkB,GAAG,GACnB,uBAAuB,CAAC,QAAQ,CAClC,IAAI,kBAAkB,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;YACzD,CAAC;QACH,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IACvE,CAAC,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- export default function parseKeyValueParamArray(paramArray: Array<string>): Record<string, string>;
@@ -1,21 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- export default function parseKeyValueParamArray(paramArray) {
9
- const result = {};
10
- for (const param of paramArray) {
11
- const equalIndex = param.indexOf('=');
12
- if (equalIndex === -1) {
13
- throw new Error(`Invalid key-value param: ${param}. Expected format: key=value`);
14
- }
15
- const key = decodeURIComponent(param.slice(0, equalIndex));
16
- const value = decodeURIComponent(param.slice(equalIndex + 1));
17
- result[key] = value;
18
- }
19
- return result;
20
- }
21
- //# sourceMappingURL=parseKeyValueParamArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseKeyValueParamArray.js","sourceRoot":"","sources":["../../../src/utils/parseKeyValueParamArray.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,UAAyB;IAEzB,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,8BAA8B,CAAC,CAAC;QACnF,CAAC;QAED,MAAM,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;QAE9D,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}