Versioning for plugin format
Summary: Added versioning for plugin format. The first version is where "main" points to source code entry and plugins are bundled by Flipper in run-time on loading them. The second version is where "main" points to the already existing bundle and Flipper just loads it without bundling. The plugins of version 2 must be bundled using "flipper-pkg" tool before publishing. Changelog: Support new packaging format for plugins. Reviewed By: mweststrate Differential Revision: D21074173 fbshipit-source-id: 7b70250e48e5bd5d359c96149fb5b14e67783c4d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
eb34b2f6e3
commit
ca2d04a5da
@@ -33,16 +33,13 @@ export function die(err: Error) {
|
||||
|
||||
export async function generatePluginEntryPoints() {
|
||||
console.log('⚙️ Generating plugin entry points...');
|
||||
const pluginEntryPoints = await getPlugins();
|
||||
const plugins = await getPlugins();
|
||||
if (await fs.pathExists(defaultPluginsIndexDir)) {
|
||||
await fs.remove(defaultPluginsIndexDir);
|
||||
}
|
||||
await fs.mkdirp(defaultPluginsIndexDir);
|
||||
await fs.writeJSON(
|
||||
path.join(defaultPluginsIndexDir, 'index.json'),
|
||||
pluginEntryPoints.map((plugin) => plugin.manifest),
|
||||
);
|
||||
const pluginRequres = pluginEntryPoints
|
||||
await fs.writeJSON(path.join(defaultPluginsIndexDir, 'index.json'), plugins);
|
||||
const pluginRequres = plugins
|
||||
.map((x) => ` '${x.name}': require('${x.name}')`)
|
||||
.join(',\n');
|
||||
const generatedIndex = `
|
||||
@@ -76,7 +73,7 @@ async function compile(
|
||||
),
|
||||
},
|
||||
resolver: {
|
||||
resolverMainFields: ['flipper:source', 'module', 'main'],
|
||||
resolverMainFields: ['flipperBundlerEntry', 'module', 'main'],
|
||||
blacklistRE: /\.native\.js$/,
|
||||
sourceExts: ['js', 'jsx', 'ts', 'tsx', 'json', 'mjs'],
|
||||
},
|
||||
@@ -151,7 +148,7 @@ export async function compileMain() {
|
||||
},
|
||||
resolver: {
|
||||
sourceExts: ['tsx', 'ts', 'js'],
|
||||
resolverMainFields: ['flipper:source', 'module', 'main'],
|
||||
resolverMainFields: ['flipperBundlerEntry', 'module', 'main'],
|
||||
blacklistRE: /\.native\.js$/,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user