@envelop/core 4.0.3 → 5.0.0-alpha-20231006093815-abe48e7c
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/cjs/orchestrator.js +5 -2
- package/esm/orchestrator.js +5 -2
- package/package.json +1 -1
package/cjs/orchestrator.js
CHANGED
|
@@ -34,16 +34,19 @@ function createEnvelopOrchestrator({ plugins, }) {
|
|
|
34
34
|
};
|
|
35
35
|
const contextErrorHandlers = [];
|
|
36
36
|
// Iterate all plugins and trigger onPluginInit
|
|
37
|
-
for (
|
|
37
|
+
for (let i = 0; i < plugins.length; i++) {
|
|
38
|
+
const plugin = plugins[i];
|
|
39
|
+
const pluginsToAdd = [];
|
|
38
40
|
plugin.onPluginInit &&
|
|
39
41
|
plugin.onPluginInit({
|
|
40
42
|
plugins,
|
|
41
43
|
addPlugin: newPlugin => {
|
|
42
|
-
|
|
44
|
+
pluginsToAdd.push(newPlugin);
|
|
43
45
|
},
|
|
44
46
|
setSchema: modifiedSchema => replaceSchema(modifiedSchema, i),
|
|
45
47
|
registerContextErrorHandler: handler => contextErrorHandlers.push(handler),
|
|
46
48
|
});
|
|
49
|
+
pluginsToAdd.length && plugins.splice(i + 1, 0, ...pluginsToAdd);
|
|
47
50
|
}
|
|
48
51
|
// A set of before callbacks defined here in order to allow it to be used later
|
|
49
52
|
const beforeCallbacks = {
|
package/esm/orchestrator.js
CHANGED
|
@@ -31,16 +31,19 @@ export function createEnvelopOrchestrator({ plugins, }) {
|
|
|
31
31
|
};
|
|
32
32
|
const contextErrorHandlers = [];
|
|
33
33
|
// Iterate all plugins and trigger onPluginInit
|
|
34
|
-
for (
|
|
34
|
+
for (let i = 0; i < plugins.length; i++) {
|
|
35
|
+
const plugin = plugins[i];
|
|
36
|
+
const pluginsToAdd = [];
|
|
35
37
|
plugin.onPluginInit &&
|
|
36
38
|
plugin.onPluginInit({
|
|
37
39
|
plugins,
|
|
38
40
|
addPlugin: newPlugin => {
|
|
39
|
-
|
|
41
|
+
pluginsToAdd.push(newPlugin);
|
|
40
42
|
},
|
|
41
43
|
setSchema: modifiedSchema => replaceSchema(modifiedSchema, i),
|
|
42
44
|
registerContextErrorHandler: handler => contextErrorHandlers.push(handler),
|
|
43
45
|
});
|
|
46
|
+
pluginsToAdd.length && plugins.splice(i + 1, 0, ...pluginsToAdd);
|
|
44
47
|
}
|
|
45
48
|
// A set of before callbacks defined here in order to allow it to be used later
|
|
46
49
|
const beforeCallbacks = {
|