@squiz/render-runtime-lib 1.2.1-alpha.86 → 1.2.1-alpha.87
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.
|
@@ -8,7 +8,10 @@ export declare class ComponentFixture {
|
|
|
8
8
|
version: string;
|
|
9
9
|
componentName: string;
|
|
10
10
|
}>;
|
|
11
|
-
static new(returnObj: string | object
|
|
11
|
+
static new(returnObj: string | object, { raw, environment }?: {
|
|
12
|
+
raw?: boolean | undefined;
|
|
13
|
+
environment?: string[] | undefined;
|
|
14
|
+
}): Promise<ExecuteComponentTask>;
|
|
12
15
|
static updateComponent(component: ExecuteComponentTask, output: string | object): Promise<ExecuteComponentTask>;
|
|
13
16
|
private static createFixtureDirectory;
|
|
14
17
|
private static createVersionDirectory;
|
|
@@ -8107,6 +8107,12 @@ var require_v1 = __commonJS({
|
|
|
8107
8107
|
description: "Function name, this will be used as part of the url to access this function. It must be a valid url"
|
|
8108
8108
|
},
|
|
8109
8109
|
entry: { type: "string" },
|
|
8110
|
+
environment: {
|
|
8111
|
+
type: "array",
|
|
8112
|
+
items: {
|
|
8113
|
+
type: "string"
|
|
8114
|
+
}
|
|
8115
|
+
},
|
|
8110
8116
|
input: {
|
|
8111
8117
|
type: "object"
|
|
8112
8118
|
},
|
|
@@ -40792,7 +40798,7 @@ var vm = new import_vm2.NodeVM({
|
|
|
40792
40798
|
var script = new import_vm2.VMScript(` const events = require('events');
|
|
40793
40799
|
const asyncHooks = require('async_hooks');
|
|
40794
40800
|
|
|
40795
|
-
module.exports = function(id, entry, input, info){
|
|
40801
|
+
module.exports = function(id, entry, input, info, environment = {}){
|
|
40796
40802
|
const emitter = new events.EventEmitter();
|
|
40797
40803
|
|
|
40798
40804
|
setImmediate(()=>{
|
|
@@ -40820,6 +40826,9 @@ var script = new import_vm2.VMScript(` const events = require('events');
|
|
|
40820
40826
|
return (activeResources);
|
|
40821
40827
|
}
|
|
40822
40828
|
|
|
40829
|
+
|
|
40830
|
+
// Should we override this or merge then unmerge?
|
|
40831
|
+
process.env = environment;
|
|
40823
40832
|
let script = require(entry);
|
|
40824
40833
|
|
|
40825
40834
|
if(typeof script === 'object') {
|
|
@@ -40879,7 +40888,7 @@ if (import_worker_threads.parentPort) {
|
|
|
40879
40888
|
});
|
|
40880
40889
|
import_worker_threads.parentPort.on("message", async (task) => {
|
|
40881
40890
|
var _a;
|
|
40882
|
-
const data = await executeComponent(task
|
|
40891
|
+
const data = await executeComponent(task);
|
|
40883
40892
|
(_a = import_worker_threads.parentPort) == null ? void 0 : _a.postMessage(data);
|
|
40884
40893
|
});
|
|
40885
40894
|
} else {
|
|
@@ -40889,14 +40898,14 @@ var executeComponentFunc = vm.run(script, {
|
|
|
40889
40898
|
strict: false,
|
|
40890
40899
|
wrapper: "commonjs"
|
|
40891
40900
|
});
|
|
40892
|
-
async function executeComponent(entry, id, input, info) {
|
|
40901
|
+
async function executeComponent({ path: entry, id, input, info, environment }) {
|
|
40893
40902
|
return new Promise((resolve, reject) => {
|
|
40894
40903
|
const componentContext = {
|
|
40895
40904
|
manifest: info.manifest,
|
|
40896
40905
|
set: info.set,
|
|
40897
40906
|
ctx: (0, import_component_lib.createComponentContext)(info.manifest.name, info.manifest.version, info.componentRoot, info.set)
|
|
40898
40907
|
};
|
|
40899
|
-
const componentExecutionWatcher = executeComponentFunc(id, entry, input, componentContext);
|
|
40908
|
+
const componentExecutionWatcher = executeComponentFunc(id, entry, input, componentContext, environment || {});
|
|
40900
40909
|
componentExecutionWatcher.on("console", (args) => {
|
|
40901
40910
|
var _a;
|
|
40902
40911
|
const message = JSON.parse(JSON.stringify(args.message));
|