zephyr-metro-plugin 0.0.56 → 0.1.3-next.3
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/README.md +325 -6
- package/TESTING.md +153 -0
- package/dist/README.md +325 -6
- package/dist/TESTING.md +153 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/internal/extract-mf-remotes.d.ts +3 -2
- package/dist/lib/internal/extract-mf-remotes.js +17 -7
- package/dist/lib/internal/extract-mf-remotes.js.map +1 -1
- package/dist/lib/internal/extract-modules-from-exposes.d.ts +12 -0
- package/dist/lib/internal/extract-modules-from-exposes.js +66 -0
- package/dist/lib/internal/extract-modules-from-exposes.js.map +1 -0
- package/dist/lib/internal/get-package-dependencies.d.ts +4 -0
- package/dist/lib/internal/get-package-dependencies.js +9 -0
- package/dist/lib/internal/get-package-dependencies.js.map +1 -0
- package/dist/lib/internal/load-static-entries.d.ts +7 -0
- package/dist/lib/internal/load-static-entries.js +39 -0
- package/dist/lib/internal/load-static-entries.js.map +1 -0
- package/dist/lib/internal/metro-build-stats.d.ts +4 -0
- package/dist/lib/internal/metro-build-stats.js +53 -0
- package/dist/lib/internal/metro-build-stats.js.map +1 -0
- package/dist/lib/internal/metro-errors.d.ts +5 -0
- package/dist/lib/internal/metro-errors.js +7 -0
- package/dist/lib/internal/metro-errors.js.map +1 -0
- package/dist/lib/internal/mutate-mf-config.js +5 -3
- package/dist/lib/internal/mutate-mf-config.js.map +1 -1
- package/dist/lib/internal/parse-shared-dependencies.d.ts +8 -0
- package/dist/lib/internal/parse-shared-dependencies.js +54 -0
- package/dist/lib/internal/parse-shared-dependencies.js.map +1 -0
- package/dist/lib/internal/types.d.ts +53 -0
- package/dist/lib/internal/types.js +3 -0
- package/dist/lib/internal/types.js.map +1 -0
- package/dist/lib/with-zephyr.d.ts +25 -0
- package/dist/lib/with-zephyr.js +143 -0
- package/dist/lib/with-zephyr.js.map +1 -0
- package/dist/lib/zephyr-metro-command-wrapper.d.ts +15 -3
- package/dist/lib/zephyr-metro-command-wrapper.js +4 -3
- package/dist/lib/zephyr-metro-command-wrapper.js.map +1 -1
- package/dist/lib/zephyr-metro-plugin.d.ts +1 -1
- package/dist/lib/zephyr-metro-plugin.js +40 -32
- package/dist/lib/zephyr-metro-plugin.js.map +1 -1
- package/dist/lib/zephyr-transformer.d.ts +16 -0
- package/dist/lib/zephyr-transformer.js +99 -0
- package/dist/lib/zephyr-transformer.js.map +1 -0
- package/dist/package.json +49 -20
- package/package.json +49 -19
- package/dist/lib/withZephyr.d.ts +0 -14
- package/dist/lib/withZephyr.js +0 -20
- package/dist/lib/withZephyr.js.map +0 -1
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _ZephyrMetroPlugin_config;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.ZephyrMetroPlugin = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
4
6
|
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
-
const
|
|
7
|
+
const extract_modules_from_exposes_1 = require("./internal/extract-modules-from-exposes");
|
|
8
|
+
const get_package_dependencies_1 = require("./internal/get-package-dependencies");
|
|
9
|
+
const load_static_entries_1 = require("./internal/load-static-entries");
|
|
10
|
+
const metro_build_stats_1 = require("./internal/metro-build-stats");
|
|
11
|
+
const parse_shared_dependencies_1 = require("./internal/parse-shared-dependencies");
|
|
6
12
|
const extract_mf_remotes_1 = require("./internal/extract-mf-remotes");
|
|
7
13
|
const mutate_mf_config_1 = require("./internal/mutate-mf-config");
|
|
8
14
|
class ZephyrMetroPlugin {
|
|
9
15
|
constructor(props) {
|
|
10
|
-
this
|
|
16
|
+
_ZephyrMetroPlugin_config.set(this, void 0);
|
|
17
|
+
tslib_1.__classPrivateFieldSet(this, _ZephyrMetroPlugin_config, props, "f");
|
|
11
18
|
}
|
|
12
19
|
async beforeBuild() {
|
|
13
20
|
this.zephyr_engine = await zephyr_agent_1.ZephyrEngine.create({
|
|
14
21
|
builder: 'metro',
|
|
15
|
-
context: this.
|
|
22
|
+
context: tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").context,
|
|
16
23
|
});
|
|
17
|
-
zephyr_agent_1.ze_log.config('Configuring with Zephyr... \n config: ', this
|
|
18
|
-
this.zephyr_engine.env.target = this.
|
|
19
|
-
const dependency_pairs = (0, extract_mf_remotes_1.extract_remotes_dependencies)(this
|
|
24
|
+
zephyr_agent_1.ze_log.config('Configuring with Zephyr... \n config: ', tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f"));
|
|
25
|
+
this.zephyr_engine.env.target = tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").platform;
|
|
26
|
+
const dependency_pairs = (0, extract_mf_remotes_1.extract_remotes_dependencies)(tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f"));
|
|
20
27
|
zephyr_agent_1.ze_log.config('Resolving and building towards target by zephyr_engine.env.target: ', this.zephyr_engine.env.target);
|
|
21
28
|
const resolved_dependency_pairs = await this.zephyr_engine.resolve_remote_dependencies(dependency_pairs);
|
|
22
|
-
if (this.
|
|
23
|
-
(0, mutate_mf_config_1.mutateMfConfig)(this.zephyr_engine, this.
|
|
29
|
+
if (tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig) {
|
|
30
|
+
(0, mutate_mf_config_1.mutateMfConfig)(this.zephyr_engine, tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig, resolved_dependency_pairs);
|
|
24
31
|
}
|
|
25
|
-
return this.
|
|
32
|
+
return tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig;
|
|
26
33
|
}
|
|
27
34
|
async afterBuild() {
|
|
28
35
|
await this.zephyr_engine.start_new_build();
|
|
@@ -30,8 +37,8 @@ class ZephyrMetroPlugin {
|
|
|
30
37
|
const buildStats = await this.getBuildStats(Object.values(assetsMap).filter((asset) => asset.extname === '.map' && !asset.path.includes('shared/')));
|
|
31
38
|
await this.zephyr_engine.upload_assets({
|
|
32
39
|
assetsMap,
|
|
33
|
-
buildStats,
|
|
34
|
-
mfConfig: this.
|
|
40
|
+
buildStats: buildStats,
|
|
41
|
+
mfConfig: tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig,
|
|
35
42
|
});
|
|
36
43
|
await this.zephyr_engine.build_finished();
|
|
37
44
|
}
|
|
@@ -71,15 +78,15 @@ class ZephyrMetroPlugin {
|
|
|
71
78
|
name: componentName,
|
|
72
79
|
usedIn: [
|
|
73
80
|
{
|
|
74
|
-
file: fileUrl.replace(this.
|
|
75
|
-
url: fileUrl.replace(this.
|
|
81
|
+
file: fileUrl.replace(tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").context, ''),
|
|
82
|
+
url: fileUrl.replace(tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").context, ''),
|
|
76
83
|
},
|
|
77
84
|
],
|
|
78
85
|
});
|
|
79
86
|
zephyr_agent_1.ze_log.app('Found remote import in promise chain', {
|
|
80
87
|
remoteName,
|
|
81
88
|
componentName,
|
|
82
|
-
file: fileUrl.replace(this.
|
|
89
|
+
file: fileUrl.replace(tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").context, ''),
|
|
83
90
|
});
|
|
84
91
|
}
|
|
85
92
|
}
|
|
@@ -96,43 +103,43 @@ class ZephyrMetroPlugin {
|
|
|
96
103
|
return consumeMap;
|
|
97
104
|
}
|
|
98
105
|
async getBuildStats(bundleMaps) {
|
|
99
|
-
const minimal_build_stats = await (0,
|
|
106
|
+
const minimal_build_stats = await (0, metro_build_stats_1.createMinimalBuildStats)(this.zephyr_engine);
|
|
100
107
|
const consumeMap = await this.getConsumeMap(bundleMaps);
|
|
101
108
|
Object.assign(minimal_build_stats, {
|
|
102
|
-
name: this.
|
|
103
|
-
remote: this.
|
|
104
|
-
remotes: this.
|
|
105
|
-
? Object.keys(this.
|
|
109
|
+
name: tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig?.name || this.zephyr_engine.applicationProperties.name,
|
|
110
|
+
remote: tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig?.filename || 'remoteEntry.js',
|
|
111
|
+
remotes: tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig?.remotes
|
|
112
|
+
? Object.keys(tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig.remotes)
|
|
106
113
|
: [],
|
|
107
114
|
metadata: {
|
|
108
|
-
hasFederation: !!this.
|
|
115
|
+
hasFederation: !!tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig,
|
|
109
116
|
},
|
|
110
117
|
build_target: this.zephyr_engine.env.target,
|
|
111
118
|
});
|
|
112
119
|
// Extract shared dependencies from Module Federation config
|
|
113
|
-
const overrides = this.
|
|
114
|
-
? Object.entries(this.
|
|
120
|
+
const overrides = tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig?.shared
|
|
121
|
+
? Object.entries(tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig.shared).map(([name, config]) => (0, parse_shared_dependencies_1.parseSharedDependencies)(name, config, this.zephyr_engine))
|
|
115
122
|
: [];
|
|
116
123
|
// Build the stats object
|
|
117
124
|
const buildStats = {
|
|
118
125
|
...minimal_build_stats,
|
|
119
126
|
overrides,
|
|
120
|
-
modules: (0,
|
|
127
|
+
modules: (0, extract_modules_from_exposes_1.extractModulesFromExposes)(tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").mfConfig, this.zephyr_engine.application_uid),
|
|
121
128
|
// Module Federation related data
|
|
122
|
-
dependencies: (0,
|
|
123
|
-
devDependencies: (0,
|
|
124
|
-
optionalDependencies: (0,
|
|
125
|
-
peerDependencies: (0,
|
|
129
|
+
dependencies: (0, get_package_dependencies_1.getPackageDependencies)((0, metro_build_stats_1.resolveCatalogDependencies)(this.zephyr_engine.npmProperties.dependencies)),
|
|
130
|
+
devDependencies: (0, get_package_dependencies_1.getPackageDependencies)((0, metro_build_stats_1.resolveCatalogDependencies)(this.zephyr_engine.npmProperties.devDependencies)),
|
|
131
|
+
optionalDependencies: (0, get_package_dependencies_1.getPackageDependencies)((0, metro_build_stats_1.resolveCatalogDependencies)(this.zephyr_engine.npmProperties.optionalDependencies)),
|
|
132
|
+
peerDependencies: (0, get_package_dependencies_1.getPackageDependencies)((0, metro_build_stats_1.resolveCatalogDependencies)(this.zephyr_engine.npmProperties.peerDependencies)),
|
|
126
133
|
consumes: Array.from(consumeMap.values()),
|
|
127
134
|
};
|
|
128
135
|
return buildStats;
|
|
129
136
|
}
|
|
130
137
|
async loadStaticAssets() {
|
|
131
|
-
const assets = await (0,
|
|
132
|
-
root: this.
|
|
133
|
-
outDir: this.
|
|
134
|
-
? this.
|
|
135
|
-
: this.
|
|
138
|
+
const assets = await (0, load_static_entries_1.load_static_entries)({
|
|
139
|
+
root: tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").context,
|
|
140
|
+
outDir: tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").platform === 'ios' || tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").platform === 'android'
|
|
141
|
+
? tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").outDir + `/${tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").platform}`
|
|
142
|
+
: tslib_1.__classPrivateFieldGet(this, _ZephyrMetroPlugin_config, "f").outDir,
|
|
136
143
|
});
|
|
137
144
|
return assets.reduce((acc, asset) => {
|
|
138
145
|
acc[asset.fileName] = asset;
|
|
@@ -151,4 +158,5 @@ class ZephyrMetroPlugin {
|
|
|
151
158
|
}
|
|
152
159
|
}
|
|
153
160
|
exports.ZephyrMetroPlugin = ZephyrMetroPlugin;
|
|
161
|
+
_ZephyrMetroPlugin_config = new WeakMap();
|
|
154
162
|
//# sourceMappingURL=zephyr-metro-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zephyr-metro-plugin.js","sourceRoot":"","sources":["../../src/lib/zephyr-metro-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zephyr-metro-plugin.js","sourceRoot":"","sources":["../../src/lib/zephyr-metro-plugin.ts"],"names":[],"mappings":";;;;;AACA,+CAAoE;AAOpE,0FAAoF;AACpF,kFAA6E;AAC7E,wEAAqE;AACrE,oEAGsC;AACtC,oFAA+E;AAE/E,sEAA6E;AAC7E,kEAA6D;AAU7D,MAAa,iBAAiB;IAI5B,YAAY,KAAiC;QAH7C,4CAAoC;QAIlC,+BAAA,IAAI,6BAAW,KAAK,MAAA,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,CAAC,aAAa,GAAG,MAAM,2BAAY,CAAC,MAAM,CAAC;YAC7C,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,+BAAA,IAAI,iCAAQ,CAAC,OAAO;SAC9B,CAAC,CAAC;QACH,qBAAM,CAAC,MAAM,CAAC,wCAAwC,EAAE,+BAAA,IAAI,iCAAQ,CAAC,CAAC;QAEtE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,GAAG,+BAAA,IAAI,iCAAQ,CAAC,QAAQ,CAAC;QAEtD,MAAM,gBAAgB,GAAG,IAAA,iDAA4B,EAAC,+BAAA,IAAI,iCAAQ,CAAC,CAAC;QAEpE,qBAAM,CAAC,MAAM,CACX,qEAAqE,EACrE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAC9B,CAAC;QAEF,MAAM,yBAAyB,GAC7B,MAAM,IAAI,CAAC,aAAa,CAAC,2B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AK,CAAC,IAAI,IAAI,OAAO,CAAC;IAC/B,CAAC;CACF;AA5MD,8CA4MC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JsTransformOptions, JsTransformerConfig } from 'metro-transform-worker';
|
|
2
|
+
interface ZephyrTransformerOptions {
|
|
3
|
+
/** Custom manifest endpoint path */
|
|
4
|
+
manifestPath?: string;
|
|
5
|
+
/** Custom entry file patterns for more conservative targeting */
|
|
6
|
+
entryFiles?: string[];
|
|
7
|
+
}
|
|
8
|
+
/** Metro transformer that injects Zephyr runtime capabilities */
|
|
9
|
+
export declare function transform(config: JsTransformerConfig & {
|
|
10
|
+
zephyrTransformerOptions?: ZephyrTransformerOptions;
|
|
11
|
+
}, projectRoot: string, filename: string, data: Buffer, options: JsTransformOptions): Promise<{
|
|
12
|
+
ast: any;
|
|
13
|
+
code: string;
|
|
14
|
+
map: any;
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transform = transform;
|
|
4
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
+
/** Default entry file patterns if none specified */
|
|
6
|
+
const DEFAULT_ENTRY_FILES = ['index.js', 'index.ts', 'index.tsx', 'App.js', 'App.tsx'];
|
|
7
|
+
/** Metro transformer that injects Zephyr runtime capabilities */
|
|
8
|
+
async function transform(config, projectRoot, filename, data, options) {
|
|
9
|
+
// Use default Metro transformer first
|
|
10
|
+
const upstream = require('metro-react-native-babel-transformer');
|
|
11
|
+
const result = await upstream.transform(config, projectRoot, filename, data, options);
|
|
12
|
+
// Get Zephyr transformer options from config
|
|
13
|
+
const zephyrOptions = config.zephyrTransformerOptions;
|
|
14
|
+
const entryFiles = zephyrOptions?.entryFiles || DEFAULT_ENTRY_FILES;
|
|
15
|
+
// Only enhance entry files - use configurable patterns for more conservative targeting
|
|
16
|
+
const shouldEnhance = isZephyrTargetFile(filename, result.code, entryFiles);
|
|
17
|
+
if (shouldEnhance) {
|
|
18
|
+
const manifestPath = zephyrOptions?.manifestPath || '/zephyr-manifest.json';
|
|
19
|
+
const enhancedCode = injectZephyrRuntime(result.code, filename, manifestPath);
|
|
20
|
+
return {
|
|
21
|
+
...result,
|
|
22
|
+
code: enhancedCode,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
/** Check if file should be enhanced with Zephyr runtime */
|
|
28
|
+
function isZephyrTargetFile(filename, code, entryFiles) {
|
|
29
|
+
// Check against configured entry file patterns
|
|
30
|
+
const isEntryFile = entryFiles.some((pattern) => {
|
|
31
|
+
// Support glob-like patterns (simple matching)
|
|
32
|
+
if (pattern.includes('*')) {
|
|
33
|
+
const regex = new RegExp(pattern.replace(/\*/g, '.*'));
|
|
34
|
+
return regex.test(filename);
|
|
35
|
+
}
|
|
36
|
+
return filename.endsWith(pattern) || filename.includes(`/${pattern}`);
|
|
37
|
+
});
|
|
38
|
+
if (isEntryFile) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
// Target files that register the app (React Native entry point detection)
|
|
42
|
+
if (code.includes('AppRegistry.registerComponent') ||
|
|
43
|
+
code.includes('AppRegistry.runApplication')) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
/** Inject Zephyr runtime plugin capabilities */
|
|
49
|
+
function injectZephyrRuntime(originalCode, filename, manifestPath) {
|
|
50
|
+
try {
|
|
51
|
+
// Create runtime plugin initialization code
|
|
52
|
+
const runtimePluginCode = generateRuntimePluginCode(manifestPath);
|
|
53
|
+
// Inject at the top of the file
|
|
54
|
+
const injectedCode = `
|
|
55
|
+
// === Zephyr Runtime Plugin Injection ===
|
|
56
|
+
${runtimePluginCode}
|
|
57
|
+
// === End Zephyr Injection ===
|
|
58
|
+
|
|
59
|
+
${originalCode}
|
|
60
|
+
`;
|
|
61
|
+
zephyr_agent_1.ze_log.misc(`Injected Zephyr runtime into: ${filename}`);
|
|
62
|
+
return injectedCode;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
zephyr_agent_1.ze_log.error(`Failed to inject Zephyr runtime into ${filename}: ${error}`);
|
|
66
|
+
return originalCode; // Return original on error
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Generate runtime plugin initialization code */
|
|
70
|
+
function generateRuntimePluginCode(manifestPath) {
|
|
71
|
+
// Generate runtime initialization code using template strings
|
|
72
|
+
// This is more robust than function stringification which can break with minification
|
|
73
|
+
return `// Zephyr Runtime Plugin for React Native
|
|
74
|
+
(function() {
|
|
75
|
+
if (typeof global !== 'undefined' && !global.__ZEPHYR_RUNTIME_PLUGIN__) {
|
|
76
|
+
// Prevent multiple initializations
|
|
77
|
+
try {
|
|
78
|
+
var createZephyrRuntimePlugin = require('zephyr-xpack-internal').createZephyrRuntimePlugin;
|
|
79
|
+
|
|
80
|
+
var plugin = createZephyrRuntimePlugin({
|
|
81
|
+
manifestUrl: '${manifestPath}',
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Store globally
|
|
85
|
+
global.__ZEPHYR_RUNTIME_PLUGIN__ = plugin;
|
|
86
|
+
|
|
87
|
+
if (__DEV__) {
|
|
88
|
+
console.log('[Zephyr] Runtime plugin initialized');
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
// zephyr-xpack-internal is an optional peer dependency
|
|
92
|
+
if (__DEV__) {
|
|
93
|
+
console.warn('[Zephyr] Runtime plugin not available:', error.message);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
})();`;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=zephyr-transformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zephyr-transformer.js","sourceRoot":"","sources":["../../src/lib/zephyr-transformer.ts"],"names":[],"mappings":";;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AC"}
|
package/dist/package.json
CHANGED
|
@@ -1,43 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-metro-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Metro plugin for Zephyr",
|
|
5
|
-
"
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
|
|
8
|
-
"directory": "libs/zephyr-metro-plugin"
|
|
9
|
-
},
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Metro bundler plugin for deploying React Native applications with Zephyr Cloud - OTA updates, Module Federation, and seamless deployment",
|
|
5
|
+
"type": "commonjs",
|
|
10
6
|
"license": "Apache-2.0",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "nx run zephyr-metro-plugin:build",
|
|
11
|
+
"patch-version": "pnpm version"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"require": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
11
20
|
"author": {
|
|
12
21
|
"name": "ZephyrCloudIO",
|
|
13
22
|
"url": "https://github.com/ZephyrCloudIO"
|
|
14
23
|
},
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"metro": ">=0.70.0",
|
|
26
|
+
"react-native": ">=0.60.0",
|
|
27
|
+
"zephyr-xpack-internal": "workspace:*"
|
|
28
|
+
},
|
|
29
|
+
"peerDependenciesMeta": {
|
|
30
|
+
"zephyr-xpack-internal": {
|
|
31
|
+
"optional": true
|
|
32
|
+
}
|
|
22
33
|
},
|
|
23
34
|
"dependencies": {
|
|
24
35
|
"zephyr-agent": "workspace:*",
|
|
25
|
-
"zephyr-
|
|
26
|
-
"zephyr-rollx-internal": "workspace:*"
|
|
36
|
+
"zephyr-edge-contract": "workspace:*"
|
|
27
37
|
},
|
|
28
|
-
"
|
|
29
|
-
"
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
|
|
41
|
+
"directory": "libs/zephyr-metro-plugin"
|
|
30
42
|
},
|
|
31
43
|
"devDependencies": {
|
|
32
44
|
"@rspack/core": "catalog:rspack",
|
|
33
45
|
"@types/find-package-json": "^1.2.6",
|
|
34
46
|
"@types/jest": "catalog:typescript",
|
|
35
47
|
"@typescript-eslint/eslint-plugin": "catalog:eslint",
|
|
48
|
+
"metro-config": "^0.83.3",
|
|
49
|
+
"metro-transform-worker": "^0.83.3",
|
|
36
50
|
"ts-jest": "catalog:typescript"
|
|
37
51
|
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"metro",
|
|
54
|
+
"react-native",
|
|
55
|
+
"zephyr",
|
|
56
|
+
"zephyr-cloud",
|
|
57
|
+
"module-federation",
|
|
58
|
+
"ota",
|
|
59
|
+
"over-the-air",
|
|
60
|
+
"deployment",
|
|
61
|
+
"bundler",
|
|
62
|
+
"ios",
|
|
63
|
+
"android",
|
|
64
|
+
"cross-platform",
|
|
65
|
+
"micro-frontends",
|
|
66
|
+
"plugin"
|
|
67
|
+
],
|
|
38
68
|
"publishConfig": {
|
|
39
69
|
"access": "public",
|
|
40
70
|
"provenance": true
|
|
41
|
-
}
|
|
42
|
-
"types": "./index.d.ts"
|
|
71
|
+
}
|
|
43
72
|
}
|
package/package.json
CHANGED
|
@@ -1,42 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zephyr-metro-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Metro plugin for Zephyr",
|
|
5
|
-
"
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
|
|
8
|
-
"directory": "libs/zephyr-metro-plugin"
|
|
9
|
-
},
|
|
3
|
+
"version": "0.1.3-next.3",
|
|
4
|
+
"description": "Metro bundler plugin for deploying React Native applications with Zephyr Cloud - OTA updates, Module Federation, and seamless deployment",
|
|
5
|
+
"type": "commonjs",
|
|
10
6
|
"license": "Apache-2.0",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
11
16
|
"author": {
|
|
12
17
|
"name": "ZephyrCloudIO",
|
|
13
18
|
"url": "https://github.com/ZephyrCloudIO"
|
|
14
19
|
},
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"metro": ">=0.70.0",
|
|
22
|
+
"react-native": ">=0.60.0",
|
|
23
|
+
"zephyr-xpack-internal": "0.1.3-next.3"
|
|
24
|
+
},
|
|
25
|
+
"peerDependenciesMeta": {
|
|
26
|
+
"zephyr-xpack-internal": {
|
|
27
|
+
"optional": true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
18
30
|
"dependencies": {
|
|
19
|
-
"zephyr-
|
|
20
|
-
"zephyr-
|
|
21
|
-
"zephyr-xpack-internal": "0.0.56"
|
|
31
|
+
"zephyr-edge-contract": "0.1.3-next.3",
|
|
32
|
+
"zephyr-agent": "0.1.3-next.3"
|
|
22
33
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
|
|
37
|
+
"directory": "libs/zephyr-metro-plugin"
|
|
25
38
|
},
|
|
26
39
|
"devDependencies": {
|
|
27
|
-
"@rspack/core": "^1.
|
|
40
|
+
"@rspack/core": "^1.5.5",
|
|
28
41
|
"@types/find-package-json": "^1.2.6",
|
|
29
42
|
"@types/jest": "29.5.14",
|
|
30
43
|
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
|
44
|
+
"metro-config": "^0.83.3",
|
|
45
|
+
"metro-transform-worker": "^0.83.3",
|
|
31
46
|
"ts-jest": "^29.2.6"
|
|
32
47
|
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"metro",
|
|
50
|
+
"react-native",
|
|
51
|
+
"zephyr",
|
|
52
|
+
"zephyr-cloud",
|
|
53
|
+
"module-federation",
|
|
54
|
+
"ota",
|
|
55
|
+
"over-the-air",
|
|
56
|
+
"deployment",
|
|
57
|
+
"bundler",
|
|
58
|
+
"ios",
|
|
59
|
+
"android",
|
|
60
|
+
"cross-platform",
|
|
61
|
+
"micro-frontends",
|
|
62
|
+
"plugin"
|
|
63
|
+
],
|
|
33
64
|
"publishConfig": {
|
|
34
65
|
"access": "public",
|
|
35
66
|
"provenance": true
|
|
36
67
|
},
|
|
37
68
|
"scripts": {
|
|
38
|
-
"build": "nx
|
|
39
|
-
"patch-version": "pnpm version"
|
|
40
|
-
"test": "nx test zephyr-metro-plugin"
|
|
69
|
+
"build": "nx run zephyr-metro-plugin:build",
|
|
70
|
+
"patch-version": "pnpm version"
|
|
41
71
|
}
|
|
42
72
|
}
|
package/dist/lib/withZephyr.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ZephyrPluginOptions } from 'zephyr-edge-contract';
|
|
2
|
-
export interface ModuleFederationConfig {
|
|
3
|
-
name: string;
|
|
4
|
-
remotes?: Record<string, string>;
|
|
5
|
-
shared?: Record<string, {
|
|
6
|
-
singleton?: boolean;
|
|
7
|
-
eager?: boolean;
|
|
8
|
-
requiredVersion?: string;
|
|
9
|
-
version?: string;
|
|
10
|
-
}>;
|
|
11
|
-
shareStrategy?: 'loaded-first' | 'version-first';
|
|
12
|
-
plugins?: string[];
|
|
13
|
-
}
|
|
14
|
-
export declare function withZephyr(context?: string, platform?: 'ios' | 'android', mode?: 'development' | 'production', outDir?: string): (config: Pick<ZephyrPluginOptions, 'mfConfig'>['mfConfig']) => Promise<Pick<ZephyrPluginOptions, 'mfConfig'>['mfConfig']>;
|
package/dist/lib/withZephyr.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withZephyr = withZephyr;
|
|
4
|
-
const zephyr_metro_plugin_1 = require("./zephyr-metro-plugin");
|
|
5
|
-
function withZephyr(context, platform = 'ios', mode = 'development', outDir = 'dist') {
|
|
6
|
-
return async function (config) {
|
|
7
|
-
if (!config)
|
|
8
|
-
return config;
|
|
9
|
-
const zephyrMetroPlugin = new zephyr_metro_plugin_1.ZephyrMetroPlugin({
|
|
10
|
-
platform,
|
|
11
|
-
mode,
|
|
12
|
-
context: context || process.cwd(),
|
|
13
|
-
outDir,
|
|
14
|
-
mfConfig: config,
|
|
15
|
-
});
|
|
16
|
-
const newConfig = await zephyrMetroPlugin.beforeBuild();
|
|
17
|
-
return newConfig;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=withZephyr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withZephyr.js","sourceRoot":"","sources":["../../src/lib/withZephyr.ts"],"names":[],"mappings":";;AAmBA,gCAuBC;AAzCD,+DAA0D;AAkB1D,SAAgB,UAAU,CACxB,OAAgB,EAChB,WAA8B,KAAK,EACnC,OAAqC,aAAa,EAClD,MAAM,GAAG,MAAM;IAIf,OAAO,KAAK,WAAW,MAAyD;QAC9E,IAAI,CAAC,MAAM;YAAE,OAAO,MAAM,CAAC;QAE3B,MAAM,iBAAiB,GAAG,IAAI,uCAAiB,CAAC;YAC9C,QAAQ;YACR,IAAI;YACJ,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;YACjC,MAAM;YACN,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,CAAC;QAExD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC"}
|