Skip to content

Commit

Permalink
Merge pull request #264 from vitalygashkov/next
Browse files Browse the repository at this point in the history
Added `eval` & `navigator.userAgentData` API for extensions
  • Loading branch information
vitalygashkov authored Dec 6, 2024
2 parents aed0ab4 + f469170 commit 42cdc84
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 28 deletions.
2 changes: 1 addition & 1 deletion apps/cli
Submodule cli updated from 014af1 to a0cd50
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamyx/api",
"version": "0.1.0",
"version": "0.1.1",
"description": "Type definitions for the latest Streamyx API",
"main": "streamyx.js",
"types": "streamyx.d.ts",
Expand Down
27 changes: 24 additions & 3 deletions packages/api/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ import { Logger } from './logger';
import { Question } from './question';
import { Common } from './common';

type NavigatorUABrandVersion = {
brand: string;
version: string;
};

type UADataValues = {
architecture: string;
fullVersionList: NavigatorUABrandVersion[];
mobile: boolean;
platform: string;
platformVersion: string;
};

declare global {
const app: App;
const storage: AppStorage;
Expand All @@ -17,13 +30,21 @@ declare global {
appName: string;
appVersion: string;
platform: string;
userAgentData: {
mobile: boolean;
platform: string;
getHighEntropyValues(hints: string[]): Promise<UADataValues>;
};
};
const document: { cookie: string };
const console: Console;
const localStorage: Storage;
const fetch: (

function eval(x: string): any;
function fetch(
input: RequestInfo | URL,
init?: RequestInit,
) => Promise<Response>;
const prompt: (message: string) => Promise<string>;
): Promise<Response>;

function prompt(message: string): Promise<string>;
}
2 changes: 1 addition & 1 deletion packages/dasha
2 changes: 2 additions & 0 deletions packages/loader/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ export function load(
scriptPath: string,
options?: LoadOptions,
): Promise<metavm.MetaScript>;

export function create(src: string): metavm.MetaScript;
7 changes: 6 additions & 1 deletion packages/loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ const load = async (scriptPath, options = {}) => {
return script;
};

module.exports = { load };
const create = (src, name = 'Eval') => {
const script = metavm.createScript(name, src);
return script;
};

module.exports = { load, create };
3 changes: 2 additions & 1 deletion packages/logger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ const createLogger = (options = {}) => {
pino.multistream(streams),
);

logger.log = logger.info;
logger.log = console.log;
logger.dir = console.dir;

return logger;
};
Expand Down

0 comments on commit 42cdc84

Please sign in to comment.