Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
1
node_modules/edge-runtime/dist/cli/eval.d.ts
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/eval.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const inlineEval: (script: string) => Promise<any>;
|
||||
11
node_modules/edge-runtime/dist/cli/eval.js
generated
vendored
Normal file
11
node_modules/edge-runtime/dist/cli/eval.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.inlineEval = void 0;
|
||||
const edge_runtime_1 = require("../edge-runtime");
|
||||
const inlineEval = async (script) => {
|
||||
const runtime = new edge_runtime_1.EdgeRuntime();
|
||||
const result = await runtime.evaluate(script);
|
||||
return result;
|
||||
};
|
||||
exports.inlineEval = inlineEval;
|
||||
//# sourceMappingURL=eval.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/eval.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/eval.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"eval.js","sourceRoot":"","sources":["../../src/cli/eval.ts"],"names":[],"mappings":";;;AAAA,kDAA6C;AAEtC,MAAM,UAAU,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE;IACjD,MAAM,OAAO,GAAG,IAAI,0BAAW,EAAE,CAAA;IACjC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC7C,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAJY,QAAA,UAAU,cAItB","sourcesContent":["import { EdgeRuntime } from '../edge-runtime'\n\nexport const inlineEval = async (script: string) => {\n const runtime = new EdgeRuntime()\n const result = await runtime.evaluate(script)\n return result\n}\n"]}
|
||||
1
node_modules/edge-runtime/dist/cli/help.d.ts
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/help.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const help: () => string;
|
||||
31
node_modules/edge-runtime/dist/cli/help.js
generated
vendored
Normal file
31
node_modules/edge-runtime/dist/cli/help.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.help = void 0;
|
||||
const picocolors_1 = require("picocolors");
|
||||
const flags = {
|
||||
eval: 'Evaluate an input script',
|
||||
help: 'Display this message.',
|
||||
listen: 'Run as HTTP server.',
|
||||
port: 'Specify a port to use.',
|
||||
repl: 'Start an interactive session.',
|
||||
};
|
||||
const help = () => `
|
||||
edge-runtime ${(0, picocolors_1.dim)('[<flags>] [input]')}
|
||||
|
||||
${(0, picocolors_1.dim)('Flags:')}
|
||||
|
||||
${getSectionSummary(flags)}
|
||||
`;
|
||||
exports.help = help;
|
||||
function getPadLength(options) {
|
||||
const lengths = Object.keys(options).map((key) => key.length);
|
||||
return Math.max.apply(null, lengths) + 1;
|
||||
}
|
||||
function getSectionSummary(options) {
|
||||
const summaryPadLength = getPadLength(options);
|
||||
const summary = Object.entries(options)
|
||||
.map(([key, description]) => ` --${key.padEnd(summaryPadLength)} ${(0, picocolors_1.dim)(description)}`)
|
||||
.join('\n');
|
||||
return `${summary}`;
|
||||
}
|
||||
//# sourceMappingURL=help.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/help.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/help.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAGvC,MAAM,KAAK,GAAgB;IACzB,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,uBAAuB;IAC7B,MAAM,EAAE,qBAAqB;IAC7B,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,+BAA+B;CACtC,CAAA;AAEM,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC;iBACT,IAAA,gBAAG,EAAC,mBAAmB,CAAC;;IAErC,IAAA,gBAAG,EAAC,QAAQ,CAAC;;EAEf,iBAAiB,CAAC,KAAK,CAAC;CACzB,CAAA;AANY,QAAA,IAAI,QAMhB;AAED,SAAS,YAAY,CAAC,OAAoB;IACxC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;AAC1C,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAoB;IAC7C,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAE9C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SACpC,GAAG,CACF,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE,CACrB,SAAS,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,IAAA,gBAAG,EAAC,WAAW,CAAC,EAAE,CAC9D;SACA,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,OAAO,GAAG,OAAO,EAAE,CAAA;AACrB,CAAC","sourcesContent":["import { dim, white } from 'picocolors'\ninterface HelpOptions extends Record<string, string> {}\n\nconst flags: HelpOptions = {\n eval: 'Evaluate an input script',\n help: 'Display this message.',\n listen: 'Run as HTTP server.',\n port: 'Specify a port to use.',\n repl: 'Start an interactive session.',\n}\n\nexport const help = () => `\n edge-runtime ${dim('[<flags>] [input]')}\n\n ${dim('Flags:')}\n\n${getSectionSummary(flags)}\n`\n\nfunction getPadLength(options: HelpOptions) {\n const lengths = Object.keys(options).map((key) => key.length)\n return Math.max.apply(null, lengths) + 1\n}\n\nfunction getSectionSummary(options: HelpOptions) {\n const summaryPadLength = getPadLength(options)\n\n const summary = Object.entries(options)\n .map(\n ([key, description]) =>\n ` --${key.padEnd(summaryPadLength)} ${dim(description)}`,\n )\n .join('\\n')\n\n return `${summary}`\n}\n"]}
|
||||
2
node_modules/edge-runtime/dist/cli/index.d.ts
generated
vendored
Normal file
2
node_modules/edge-runtime/dist/cli/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env node
|
||||
export {};
|
||||
113
node_modules/edge-runtime/dist/cli/index.js
generated
vendored
Executable file
113
node_modules/edge-runtime/dist/cli/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,113 @@
|
|||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const edge_runtime_1 = require("../edge-runtime");
|
||||
const util_1 = require("util");
|
||||
const fs_1 = require("fs");
|
||||
const server_1 = require("../server");
|
||||
const child_process_1 = __importDefault(require("child_process"));
|
||||
const signal_exit_1 = require("signal-exit");
|
||||
const mri_1 = __importDefault(require("mri"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const { _: input, ...flags } = (0, mri_1.default)(process.argv.slice(2), {
|
||||
alias: {
|
||||
e: 'eval',
|
||||
h: 'host',
|
||||
l: 'listen',
|
||||
p: 'port',
|
||||
},
|
||||
default: {
|
||||
cwd: process.cwd(),
|
||||
eval: false,
|
||||
help: false,
|
||||
host: '127.0.0.1',
|
||||
listen: false,
|
||||
port: 3000,
|
||||
repl: false,
|
||||
},
|
||||
});
|
||||
async function main() {
|
||||
if (flags.help) {
|
||||
const { help } = await Promise.resolve().then(() => __importStar(require('./help')));
|
||||
console.log(help());
|
||||
return;
|
||||
}
|
||||
if (flags.eval) {
|
||||
const { inlineEval } = await Promise.resolve().then(() => __importStar(require('./eval')));
|
||||
console.log(await inlineEval(input[0]));
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* If there is no script path to run a server, the CLI will start a REPL.
|
||||
*/
|
||||
const [scriptPath] = input;
|
||||
if (!scriptPath) {
|
||||
const replPath = path_1.default.resolve(__dirname, 'repl.js');
|
||||
return (0, util_1.promisify)(child_process_1.default.spawn).call(null, 'node', [replPath], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
}
|
||||
const initialCode = (0, fs_1.readFileSync)(path_1.default.resolve(process.cwd(), scriptPath), 'utf-8');
|
||||
const runtime = new edge_runtime_1.EdgeRuntime({ initialCode });
|
||||
if (!flags.listen)
|
||||
return runtime.evaluate('');
|
||||
const logger = await Promise.resolve().then(() => __importStar(require('./logger'))).then(({ createLogger }) => createLogger());
|
||||
logger.debug(`v${String(require('../../package.json').version)} at Node.js ${process.version}`);
|
||||
/**
|
||||
* Start a server with the script provided in the file path.
|
||||
*/
|
||||
let server;
|
||||
let port = flags.port;
|
||||
while (server === undefined) {
|
||||
try {
|
||||
server = await (0, server_1.runServer)({
|
||||
host: flags.host,
|
||||
logger: logger,
|
||||
port,
|
||||
runtime,
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
if ((error === null || error === void 0 ? void 0 : error.code) === 'EADDRINUSE') {
|
||||
logger.warn(`Port \`${port}\` already in use`);
|
||||
++port;
|
||||
}
|
||||
else
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
(0, signal_exit_1.onExit)(() => server === null || server === void 0 ? void 0 : server.close());
|
||||
logger(`Waiting incoming requests at ${logger.quotes(server.url)}`);
|
||||
}
|
||||
main().catch((error) => {
|
||||
if (!(error instanceof Error))
|
||||
error = new Error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/index.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/edge-runtime/dist/cli/logger.d.ts
generated
vendored
Normal file
7
node_modules/edge-runtime/dist/cli/logger.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import type { Logger } from '../types';
|
||||
export declare const format: (...args: unknown[]) => string;
|
||||
/**
|
||||
* Creates basic logger with colors that can be used from the CLI and the
|
||||
* server logs.
|
||||
*/
|
||||
export declare function createLogger(): Logger;
|
||||
37
node_modules/edge-runtime/dist/cli/logger.js
generated
vendored
Normal file
37
node_modules/edge-runtime/dist/cli/logger.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createLogger = exports.format = void 0;
|
||||
const format_1 = require("@edge-runtime/format");
|
||||
const picocolors_1 = __importDefault(require("picocolors"));
|
||||
const isEnabled = process.env.EDGE_RUNTIME_LOGGING !== undefined
|
||||
? Boolean(process.env.EDGE_RUNTIME_LOGGING)
|
||||
: true;
|
||||
exports.format = (0, format_1.createFormat)();
|
||||
/**
|
||||
* Creates basic logger with colors that can be used from the CLI and the
|
||||
* server logs.
|
||||
*/
|
||||
function createLogger() {
|
||||
const logger = function (message, opts) {
|
||||
print(message, opts);
|
||||
};
|
||||
logger.info = logger;
|
||||
logger.error = (message, opts) => print(message, { color: 'red', ...opts });
|
||||
logger.debug = (message, opts) => print(message, { color: 'dim', ...opts });
|
||||
logger.warn = (message, opts) => print(message, { color: 'yellow', ...opts });
|
||||
logger.quotes = (str) => `\`${str}\``;
|
||||
return logger;
|
||||
}
|
||||
exports.createLogger = createLogger;
|
||||
function print(message, { color = 'white', withHeader = true, withBreakline = false, } = {}) {
|
||||
if (!isEnabled)
|
||||
return;
|
||||
const colorize = picocolors_1.default[color];
|
||||
const header = withHeader ? `${colorize('ƒ')} ` : '';
|
||||
const separator = withBreakline ? '\n' : '';
|
||||
console.log(`${header}${separator}${colorize(message)}`);
|
||||
}
|
||||
//# sourceMappingURL=logger.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/logger.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/logger.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/cli/logger.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAmD;AAGnD,4DAA6B;AAE7B,MAAM,SAAS,GACb,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,SAAS;IAC5C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC3C,CAAC,CAAC,IAAI,CAAA;AAEG,QAAA,MAAM,GAAG,IAAA,qBAAY,GAAE,CAAA;AAEpC;;;GAGG;AACH,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,UAAU,OAAe,EAAE,IAAoB;QAC5D,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACtB,CAAW,CAAA;IAEX,MAAM,CAAC,IAAI,GAAG,MAAM,CAAA;IACpB,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;IAC3E,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;IAC3E,MAAM,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;IAC7E,MAAM,CAAC,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;IAC7C,OAAO,MAAM,CAAA;AACf,CAAC;AAXD,oCAWC;AAED,SAAS,KAAK,CACZ,OAAe,EACf,EACE,KAAK,GAAG,OAAO,EACf,UAAU,GAAG,IAAI,EACjB,aAAa,GAAG,KAAK,MACJ,EAAE;IAErB,IAAI,CAAC,SAAS;QAAE,OAAM;IACtB,MAAM,QAAQ,GAAG,oBAAI,CAAC,KAAK,CAAc,CAAA;IACzC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IACpD,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3C,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AAC1D,CAAC","sourcesContent":["import { createFormat } from '@edge-runtime/format'\nimport type { Logger, LoggerOptions } from '../types'\nimport type { Formatter } from 'picocolors/types'\nimport pico from 'picocolors'\n\nconst isEnabled =\n process.env.EDGE_RUNTIME_LOGGING !== undefined\n ? Boolean(process.env.EDGE_RUNTIME_LOGGING)\n : true\n\nexport const format = createFormat()\n\n/**\n * Creates basic logger with colors that can be used from the CLI and the\n * server logs.\n */\nexport function createLogger() {\n const logger = function (message: string, opts?: LoggerOptions) {\n print(message, opts)\n } as Logger\n\n logger.info = logger\n logger.error = (message, opts) => print(message, { color: 'red', ...opts })\n logger.debug = (message, opts) => print(message, { color: 'dim', ...opts })\n logger.warn = (message, opts) => print(message, { color: 'yellow', ...opts })\n logger.quotes = (str: string) => `\\`${str}\\``\n return logger\n}\n\nfunction print(\n message: string,\n {\n color = 'white',\n withHeader = true,\n withBreakline = false,\n }: LoggerOptions = {},\n) {\n if (!isEnabled) return\n const colorize = pico[color] as Formatter\n const header = withHeader ? `${colorize('ƒ')} ` : ''\n const separator = withBreakline ? '\\n' : ''\n console.log(`${header}${separator}${colorize(message)}`)\n}\n"]}
|
||||
4
node_modules/edge-runtime/dist/cli/repl.d.ts
generated
vendored
Normal file
4
node_modules/edge-runtime/dist/cli/repl.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="node" />
|
||||
import createRepl from 'repl';
|
||||
declare const repl: createRepl.REPLServer;
|
||||
export { repl };
|
||||
30
node_modules/edge-runtime/dist/cli/repl.js
generated
vendored
Normal file
30
node_modules/edge-runtime/dist/cli/repl.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.repl = void 0;
|
||||
const format_1 = require("@edge-runtime/format");
|
||||
const repl_1 = __importDefault(require("repl"));
|
||||
const os_1 = require("os");
|
||||
const path_1 = require("path");
|
||||
const edge_runtime_1 = require("../edge-runtime");
|
||||
const format = (0, format_1.createFormat)();
|
||||
const writer = (output) => {
|
||||
return typeof output === 'function' ? output.toString() : format(output);
|
||||
};
|
||||
const repl = repl_1.default.start({ prompt: 'ƒ => ', writer });
|
||||
exports.repl = repl;
|
||||
repl.setupHistory((0, path_1.join)((0, os_1.homedir)(), '.edge_runtime_repl_history'), () => { });
|
||||
Object.getOwnPropertyNames(repl.context).forEach((mod) => delete repl.context[mod]);
|
||||
const runtime = new edge_runtime_1.EdgeRuntime();
|
||||
Object.getOwnPropertyNames(runtime.context)
|
||||
.filter((key) => !key.startsWith('__'))
|
||||
.forEach((key) => Object.assign(repl.context, { [key]: runtime.context[key] }));
|
||||
Object.defineProperty(repl.context, 'EdgeRuntime', {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: runtime.context.EdgeRuntime,
|
||||
});
|
||||
//# sourceMappingURL=repl.js.map
|
||||
1
node_modules/edge-runtime/dist/cli/repl.js.map
generated
vendored
Normal file
1
node_modules/edge-runtime/dist/cli/repl.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"repl.js","sourceRoot":"","sources":["../../src/cli/repl.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAmD;AACnD,gDAA6B;AAC7B,2BAA4B;AAC5B,+BAA2B;AAE3B,kDAA6C;AAE7C,MAAM,MAAM,GAAG,IAAA,qBAAY,GAAE,CAAA;AAE7B,MAAM,MAAM,GAA0B,CAAC,MAAM,EAAE,EAAE;IAC/C,OAAO,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC1E,CAAC,CAAA;AAED,MAAM,IAAI,GAAG,cAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;AAsBjD,oBAAI;AArBb,IAAI,CAAC,YAAY,CAAC,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,4BAA4B,CAAC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AAE1E,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAC9C,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAClC,CAAA;AAED,MAAM,OAAO,GAAG,IAAI,0BAAW,EAAE,CAAA;AAEjC,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;KACxC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KACtC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAC7D,CAAA;AAEH,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE;IACjD,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW;CACnC,CAAC,CAAA","sourcesContent":["import { createFormat } from '@edge-runtime/format'\nimport createRepl from 'repl'\nimport { homedir } from 'os'\nimport { join } from 'path'\n\nimport { EdgeRuntime } from '../edge-runtime'\n\nconst format = createFormat()\n\nconst writer: createRepl.REPLWriter = (output) => {\n return typeof output === 'function' ? output.toString() : format(output)\n}\n\nconst repl = createRepl.start({ prompt: 'ƒ => ', writer })\nrepl.setupHistory(join(homedir(), '.edge_runtime_repl_history'), () => {})\n\nObject.getOwnPropertyNames(repl.context).forEach(\n (mod) => delete repl.context[mod],\n)\n\nconst runtime = new EdgeRuntime()\n\nObject.getOwnPropertyNames(runtime.context)\n .filter((key) => !key.startsWith('__'))\n .forEach((key) =>\n Object.assign(repl.context, { [key]: runtime.context[key] }),\n )\n\nObject.defineProperty(repl.context, 'EdgeRuntime', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: runtime.context.EdgeRuntime,\n})\n\nexport { repl }\n"]}
|
||||
Loading…
Add table
Add a link
Reference in a new issue