@shopify/create-app
Version:
A CLI tool to create a new Shopify app.
55 lines (53 loc) • 1.98 kB
JavaScript
import {
require_lib
} from "./chunk-E43EDJOG.js";
import "./chunk-ODCXYGJ2.js";
import "./chunk-LBXDGVFS.js";
import "./chunk-OQ3KXXGH.js";
import "./chunk-7OHJH7BF.js";
import "./chunk-D6NYWNY2.js";
import {
__toESM,
init_cjs_shims
} from "./chunk-3XNI6LP4.js";
// ../cli-kit/dist/public/node/custom-oclif-loader.js
init_cjs_shims();
var import_core = __toESM(require_lib(), 1), ShopifyConfig = class extends import_core.Config {
lazyCommandLoader;
/**
* Set a lazy command loader that will be used to load individual command classes on demand,
* bypassing the default oclif behavior of importing the entire COMMANDS module.
*
* @param loader - The lazy command loader function.
*/
setLazyCommandLoader(loader) {
this.lazyCommandLoader = loader;
}
/**
* Override runCommand to use lazy loading when available.
* Instead of calling cmd.load() which triggers loading ALL commands via index.js,
* we directly import only the needed command module.
*
* @param id - The command ID to run.
* @param argv - The arguments to pass to the command.
* @param cachedCommand - An optional cached command loadable.
* @returns The command result.
*/
async runCommand(id, argv = [], cachedCommand = null) {
if (!this.lazyCommandLoader)
return super.runCommand(id, argv, cachedCommand);
let cmd = cachedCommand ?? this.findCommand(id);
if (!cmd)
return super.runCommand(id, argv, cachedCommand);
let commandClass = await this.lazyCommandLoader(id);
if (!commandClass)
return super.runCommand(id, argv, cachedCommand);
commandClass.id = id, commandClass.plugin = cmd.plugin ?? this.rootPlugin, await this.runHook("prerun", { argv, Command: commandClass });
let result = await commandClass.run(argv, this);
return await this.runHook("postrun", { argv, Command: commandClass, result }), result;
}
};
export {
ShopifyConfig
};
//# sourceMappingURL=custom-oclif-loader-HTLL62HO.js.map