diff --git a/src/framework/chef.c b/src/framework/chef.c index 9852340..ad4bcf4 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -12,6 +12,57 @@ #pragma once +void +chef_debug_target (Target_t *target) +{ +#ifdef XY_DEBUG + if (!target) + { + chsrc_debug2 ("target", "Target is NULL"); + return; + } + + say ("DEBUG Target Information:"); + printf (" Aliases: %s\n", target->aliases); + + printf (" Get Function: %p\n", target->getfn); + printf (" Set Function: %p\n", target->setfn); + printf (" Reset Function: %p\n", target->resetfn); + printf (" Prelude Function: %p\n", target->preludefn); + + printf (" Inited?: %d\n", target->inited); + + printf (" Sources: %p\n", target->sources); + printf (" Sources Count: %lld\n", target->sources_n); + + printf (" Chef: %p\n", target->chef); + printf (" Cooks: %p\n", target->cooks); + printf (" Cooks Count: %lld\n", target->cooks_n); + printf (" Sauciers: %p\n", target->sauciers); + printf (" Sauciers Count: %lld\n", target->sauciers_n); +#endif +} + + +void +chef_debug_contributor (Contributor_t *contributor) +{ +#ifdef XY_DEBUG + if (!contributor) + { + chsrc_debug2 ("contrib", "Contributor is NULL"); + return; + } + + say ("DEBUG Contributor Information:"); + printf (" ID: %s\n", contributor->id); + printf (" Name: %s\n", contributor->name); + printf (" Email: %s\n", contributor->email); + printf (" DisplayName: %s\n", contributor->display_name); +#endif +} + + /** * @brief 登记所有贡献者 * @@ -107,7 +158,17 @@ chef_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix void chef_use_other_target_sources (Target_t *this, Target_t *other) { - if (!other->inited) other->preludefn(); + if (!other->inited) + { + if (other->preludefn) + other->preludefn(); + else + { + chef_debug_target (other); + chsrc_panic ("`other` 未定义 _prelude() !"); + } + } + this->sources = other->sources; this->sources_n = other->sources_n; } @@ -309,54 +370,3 @@ chef_set_sources_last_updated (Target_t *target, char *date) target->sources_last_updated = xy_strdup (date); } - - -void -chef_debug_target (Target_t *target) -{ -#ifdef XY_DEBUG - if (!target) - { - chsrc_debug2 ("target", "Target is NULL"); - return; - } - - say ("DEBUG Target Information:"); - printf (" Aliases: %s\n", target->aliases); - - printf (" Get Function: %p\n", target->getfn); - printf (" Set Function: %p\n", target->setfn); - printf (" Reset Function: %p\n", target->resetfn); - printf (" Prelude Function: %p\n", target->preludefn); - - printf (" Inited?: %d\n", target->inited); - - printf (" Sources: %p\n", target->sources); - printf (" Sources Count: %lld\n", target->sources_n); - - printf (" Chef: %p\n", target->chef); - printf (" Cooks: %p\n", target->cooks); - printf (" Cooks Count: %lld\n", target->cooks_n); - printf (" Sauciers: %p\n", target->sauciers); - printf (" Sauciers Count: %lld\n", target->sauciers_n); -#endif -} - - -void -chef_debug_contributor (Contributor_t *contributor) -{ -#ifdef XY_DEBUG - if (!contributor) - { - chsrc_debug2 ("contrib", "Contributor is NULL"); - return; - } - - say ("DEBUG Contributor Information:"); - printf (" ID: %s\n", contributor->id); - printf (" Name: %s\n", contributor->name); - printf (" Email: %s\n", contributor->email); - printf (" DisplayName: %s\n", contributor->display_name); -#endif -} diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h index 2ff97fd..5595b23 100644 --- a/src/recipe/lang/JavaScript/common.h +++ b/src/recipe/lang/JavaScript/common.h @@ -45,7 +45,7 @@ pl_js_group_prelude (void) -def_target(pl_js_nodejs_binary, "__internal_use_nodejs_binary__"); +def_target(pl_js_nodejs_binary, "__internal_target_nodejs_binary__"); void pl_js_nodejs_binary_prelude (void) @@ -53,7 +53,7 @@ pl_js_nodejs_binary_prelude (void) chef_prep_this (pl_js_nodejs_binary, NOOP); chef_set_created_on (this, "2023-09-09"); - chef_set_last_updated (this, "2025-07-11"); + chef_set_last_updated (this, "2025-08-22"); chef_set_sources_last_updated (this, "2025-07-11"); chef_set_chef (this, NULL); diff --git a/src/recipe/menu.c b/src/recipe/menu.c index 32d59c1..e16433b 100644 --- a/src/recipe/menu.c +++ b/src/recipe/menu.c @@ -183,6 +183,9 @@ chsrc_init_menu () add (tex); add (anaconda); #undef add + + // Internal Target 不会由用户使用,需要特殊对待 + pl_js_nodejs_binary_target.preludefn = pl_js_nodejs_binary_prelude; }