mirror of
https://github.com/strapi/strapi.git
synced 2025-07-17 05:53:01 +00:00
22 lines
549 B
JavaScript
22 lines
549 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
const _ = require('lodash');
|
||
|
|
||
|
let strapiInstance;
|
||
|
Object.defineProperty(global, 'strapi', {
|
||
|
get() {
|
||
|
return strapiInstance;
|
||
|
},
|
||
|
set(value) {
|
||
|
strapiInstance = value;
|
||
|
|
||
|
strapiInstance.plugin = name => strapiInstance.plugins[name];
|
||
|
_.mapValues(strapi.plugins, plugin => {
|
||
|
plugin.controller = name => plugin.controllers[name];
|
||
|
plugin.service = name => plugin.services[name];
|
||
|
plugin.contentType = name => plugin.contentTypes[name];
|
||
|
plugin.policy = name => plugin.policies[name];
|
||
|
});
|
||
|
},
|
||
|
});
|