@mediar-ai/terminator 0.23.1 → 0.23.2
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/package.json
CHANGED
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"@mediar-ai/terminator-darwin-arm64": "0.23.
|
|
44
|
-
"@mediar-ai/terminator-darwin-x64": "0.23.
|
|
45
|
-
"@mediar-ai/terminator-linux-x64-gnu": "0.23.
|
|
46
|
-
"@mediar-ai/terminator-win32-arm64-msvc": "0.23.
|
|
47
|
-
"@mediar-ai/terminator-win32-x64-msvc": "0.23.
|
|
43
|
+
"@mediar-ai/terminator-darwin-arm64": "0.23.2",
|
|
44
|
+
"@mediar-ai/terminator-darwin-x64": "0.23.2",
|
|
45
|
+
"@mediar-ai/terminator-linux-x64-gnu": "0.23.2",
|
|
46
|
+
"@mediar-ai/terminator-win32-arm64-msvc": "0.23.2",
|
|
47
|
+
"@mediar-ai/terminator-win32-x64-msvc": "0.23.2"
|
|
48
48
|
},
|
|
49
49
|
"repository": {
|
|
50
50
|
"type": "git",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"test-hook": "powershell.exe -ExecutionPolicy Bypass -File \"../../.git/hooks/pre-push.ps1\""
|
|
63
63
|
},
|
|
64
64
|
"types": "wrapper.d.ts",
|
|
65
|
-
"version": "0.23.
|
|
65
|
+
"version": "0.23.2"
|
|
66
66
|
}
|
|
@@ -94,10 +94,14 @@ async function testFileInputWithEnvInjection() {
|
|
|
94
94
|
count: 3,
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
// Verify the env was injected into the script
|
|
97
|
+
// Verify the env was injected into the script as an env object
|
|
98
98
|
assert.ok(
|
|
99
|
-
receivedScript.includes("const
|
|
100
|
-
"
|
|
99
|
+
receivedScript.includes("const env = "),
|
|
100
|
+
"env object should be injected into script",
|
|
101
|
+
);
|
|
102
|
+
assert.ok(
|
|
103
|
+
receivedScript.includes('"column_positions"'),
|
|
104
|
+
"column_positions key should be in env object",
|
|
101
105
|
);
|
|
102
106
|
assert.ok(
|
|
103
107
|
receivedScript.includes(JSON.stringify(columnPositions)),
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
// Browser script that uses injected env
|
|
1
|
+
// Browser script that uses injected env object
|
|
2
2
|
(() => {
|
|
3
|
-
//
|
|
4
|
-
if (typeof
|
|
5
|
-
throw new Error(
|
|
3
|
+
// env object should be auto-injected by wrapper
|
|
4
|
+
if (typeof env === "undefined") {
|
|
5
|
+
throw new Error("env not injected");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (!env.column_positions) {
|
|
9
|
+
throw new Error("column_positions not in env");
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
return {
|
|
9
|
-
positions: column_positions,
|
|
10
|
-
count: column_positions.length
|
|
13
|
+
positions: env.column_positions,
|
|
14
|
+
count: env.column_positions.length,
|
|
11
15
|
};
|
|
12
|
-
})()
|
|
16
|
+
})();
|
package/wrapper.js
CHANGED
|
@@ -270,8 +270,8 @@ async function enhancedExecuteBrowserScript(scriptOrFunction, envOrOptions) {
|
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
272
|
if (shouldInjectEnv && env && Object.keys(env).length > 0) {
|
|
273
|
-
const
|
|
274
|
-
script = `${
|
|
273
|
+
const envObject = `const env = ${JSON.stringify(env)};`;
|
|
274
|
+
script = `${envObject}
|
|
275
275
|
${script}`;
|
|
276
276
|
}
|
|
277
277
|
const resultStr = await this._originalExecuteBrowserScript(script);
|
package/wrapper.ts
CHANGED
|
@@ -292,10 +292,9 @@ async function enhancedExecuteBrowserScript(
|
|
|
292
292
|
|
|
293
293
|
// If env variables are provided and we should inject them (file-based scripts only)
|
|
294
294
|
if (shouldInjectEnv && env && Object.keys(env).length > 0) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
script = `${envDeclarations}\n${script}`;
|
|
295
|
+
// Inject as an env object that scripts can access
|
|
296
|
+
const envObject = `const env = ${JSON.stringify(env)};`;
|
|
297
|
+
script = `${envObject}\n${script}`;
|
|
299
298
|
}
|
|
300
299
|
|
|
301
300
|
// Call the original native method
|