Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wixc3/engine-runtime-node

Package Overview
Dependencies
Maintainers
75
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/engine-runtime-node - npm Package Compare versions

Comparing version 23.0.0-alpha.0 to 23.0.0

dist/extrenal-request-mapper.d.ts

4

dist/environments.d.ts
import { EnvironmentTypes } from '@wixc3/engine-core';
import type { IEnvironmentDescriptor, IStaticFeatureDefinition } from './types';
export declare function resolveEnvironments(featureName: string, features: Map<string, Required<IStaticFeatureDefinition>>, envTypes?: EnvironmentTypes[] | EnvironmentTypes, filterByContext?: boolean): Set<IEnvironmentDescriptor<import("@wixc3/engine-core").AnyEnvironment>>;
import type { IEnvironment, IStaticFeatureDefinition } from './types';
export declare function resolveEnvironments(featureName: string, features: Map<string, Required<IStaticFeatureDefinition>>, envTypes?: EnvironmentTypes[] | EnvironmentTypes, filterByContext?: boolean): Set<IEnvironment>;
//# sourceMappingURL=environments.d.ts.map

@@ -1,8 +0,8 @@

import { IFeatureLoader, RuntimeEngine, AnyEnvironment } from '@wixc3/engine-core';
import type { IEnvironmentDescriptor, StartEnvironmentOptions, IStaticFeatureDefinition } from './types';
export declare function runNodeEnvironment<ENV extends AnyEnvironment>({ featureName, childEnvName, features, config, name, type, options, host, externalFeatures, context, env, }: StartEnvironmentOptions<ENV>): Promise<{
import { IFeatureLoader, RuntimeEngine } from '@wixc3/engine-core';
import type { IEnvironment, StartEnvironmentOptions, IStaticFeatureDefinition } from './types';
export declare function runNodeEnvironment({ featureName, childEnvName, features, bundlePath, config, name, type, options, host, externalFeatures, context, }: StartEnvironmentOptions): Promise<{
dispose: () => Promise<void>;
engine: RuntimeEngine<ENV>;
engine: RuntimeEngine;
}>;
export declare function createFeatureLoaders(features: Map<string, Required<IStaticFeatureDefinition>>, { childEnvName, name: envName, env }: IEnvironmentDescriptor): Record<string, IFeatureLoader>;
export declare function createFeatureLoaders(features: Map<string, Required<IStaticFeatureDefinition>>, { name: envName, childEnvName }: IEnvironment): Record<string, IFeatureLoader>;
//# sourceMappingURL=node-environment.d.ts.map

@@ -24,4 +24,4 @@ "use strict";

const engine_core_1 = require("@wixc3/engine-core");
const external_request_mapper_1 = require("./external-request-mapper");
async function runNodeEnvironment({ featureName, childEnvName, features, config = [], name, type, options, host, externalFeatures = [], context, env, }) {
const extrenal_request_mapper_1 = require("./extrenal-request-mapper");
async function runNodeEnvironment({ featureName, childEnvName, features, bundlePath, config = [], name, type, options, host, externalFeatures = [], context, }) {
if (host) {

@@ -35,2 +35,7 @@ config.push(engine_core_1.COM.use({

}
config.push(engine_core_1.RuntimeMetadata.use({
engineerMetadataConfig: {
applicationPath: bundlePath,
},
}));
const featureLoaders = createFeatureLoaders(new Map(features), {

@@ -40,3 +45,2 @@ name,

type,
env,
});

@@ -58,3 +62,3 @@ const rootFeatureLoader = featureLoaders[featureName];

// mapping all found feature file requests to the current running context, so that external features, when importing feature files, will evaluate the files under the current context
[...features.values()].map(([, { packageName }]) => (0, external_request_mapper_1.remapToUserLibrary)({
[...features.values()].map(([, { packageName }]) => (0, extrenal_request_mapper_1.remapToUserLibrary)({
test: (request) => request.includes(packageName),

@@ -64,3 +68,3 @@ context,

// mapping all features to be evaluated from the context of their package location
externalFeatures.map(({ packageName, packageBasePath }) => (0, external_request_mapper_1.remapToUserLibrary)({
externalFeatures.map(({ packageName, packageBasePath }) => (0, extrenal_request_mapper_1.remapToUserLibrary)({
test: (request) => request.includes(packageName),

@@ -70,3 +74,3 @@ context: packageBasePath,

// initializing our module system tricks to be able to load all features from their proper context, so that features will not be loaded twice
(0, external_request_mapper_1.init)();
(0, extrenal_request_mapper_1.init)();
}

@@ -85,3 +89,3 @@ for (const { scopedName: externalFeatureName, envEntries } of externalFeatures) {

if (context) {
(0, external_request_mapper_1.clear)();
(0, extrenal_request_mapper_1.clear)();
}

@@ -91,5 +95,5 @@ const runtimeEngine = (0, engine_core_1.runEngineApp)({

options: new Map(options),
envName: name,
features: runningFeatures,
resolvedContexts,
env,
});

@@ -99,3 +103,3 @@ return runtimeEngine;

exports.runNodeEnvironment = runNodeEnvironment;
function createFeatureLoaders(features, { childEnvName, name: envName, env }) {
function createFeatureLoaders(features, { name: envName, childEnvName }) {
const featureLoaders = {};

@@ -131,7 +135,5 @@ for (const { scopedName, filePath, dependencies, envFilePaths, contextFilePaths, resolvedContexts, preloadFilePaths, } of features.values()) {

}
for (const { env: envName } of new Set([env, ...env.dependencies])) {
const envFilePath = envFilePaths[envName];
if (envFilePath) {
await Promise.resolve().then(() => __importStar(require(envFilePath)));
}
const envFilePath = envFilePaths[envName];
if (envFilePath) {
await Promise.resolve().then(() => __importStar(require(envFilePath)));
}

@@ -138,0 +140,0 @@ return (await Promise.resolve().then(() => __importStar(require(filePath)))).default;

import io from 'socket.io';
import { TopLevelConfig, SetMultiMap, Communication, BaseHost, Message } from '@wixc3/engine-core';
import { IConfigDefinition, IEnvironmentDescriptor, TopLevelConfigProvider, IExternalFeatureNodeDescriptor, IStaticFeatureDefinition } from './types';
import { IConfigDefinition, IEnvironment, TopLevelConfigProvider, IExternalFeatureNodeDescriptor, IStaticFeatureDefinition } from './types';
export interface OverrideConfig {

@@ -31,2 +31,3 @@ configName?: string;

features: Map<string, IStaticFeatureDefinition>;
bundlePath?: string;
configurations?: SetMultiMap<string, IConfigDefinition | TopLevelConfig>;

@@ -46,4 +47,5 @@ defaultRuntimeOptions?: Record<string, string | boolean>;

export interface ILaunchEnvironmentOptions {
nodeEnv: IEnvironmentDescriptor;
nodeEnv: IEnvironment;
featureName: string;
bundlePath?: string;
config: TopLevelConfig;

@@ -50,0 +52,0 @@ options: Record<string, string | boolean>;

@@ -141,2 +141,3 @@ "use strict";

featureName,
bundlePath: this.options.bundlePath,
config,

@@ -239,6 +240,7 @@ options: {

}
async prepareEnvironment({ nodeEnv, featureName, config, options, mode, externalFeatures = [], com, features, }) {
async prepareEnvironment({ nodeEnv, featureName, bundlePath: outputPath, config, options, mode, externalFeatures = [], com, features, }) {
const { port, inspect } = this.options;
const nodeEnvironmentOptions = {
...nodeEnv,
bundlePath: outputPath,
config,

@@ -254,3 +256,3 @@ featureName,

if (inspect && mode !== 'forked') {
console.warn(`Cannot inspect env without forking new process.
console.warn(`Cannot inspect env without forking new process.
Launchihg environment ${nodeEnv.name} on remote process.`);

@@ -257,0 +259,0 @@ }

@@ -27,3 +27,2 @@ "use strict";

const connectedEnvironments = {};
//TODO: check
for (const [envName, config] of (_a = message.data.config) !== null && _a !== void 0 ? _a : []) {

@@ -30,0 +29,0 @@ if (envName === engine_core_1.COM.id) {

@@ -1,4 +0,4 @@

import type { EnvironmentTypes, TopLevelConfig, BaseHost, Environment, AnyEnvironment, MultiEnvironment } from '@wixc3/engine-core';
import type { EnvironmentTypes, TopLevelConfig, BaseHost } from '@wixc3/engine-core';
export declare type TopLevelConfigProvider = (envName: string) => TopLevelConfig;
export interface IExternalFeatureDescriptor {
export interface IExtenalFeatureDescriptor {
envEntries: Record<string, Record<string, string>>;

@@ -25,9 +25,10 @@ packageBasePath: string;

filePath: string;
exportedEnvs?: IEnvironmentDescriptor<AnyEnvironment>[];
exportedEnvs?: IEnvironment[];
}
export interface IExternalFeatureNodeDescriptor extends IExternalFeatureDescriptor, IStaticFeatureDefinition {
export interface IExternalFeatureNodeDescriptor extends IExtenalFeatureDescriptor, IStaticFeatureDefinition {
}
export declare const isProcessMessage: (value: unknown) => value is IProcessMessage<unknown>;
export interface StartEnvironmentOptions<ENV extends AnyEnvironment = AnyEnvironment> extends IEnvironmentDescriptor<ENV> {
export interface StartEnvironmentOptions extends IEnvironment {
featureName: string;
bundlePath?: string;
config?: TopLevelConfig;

@@ -72,3 +73,3 @@ features: Array<[string, Required<IStaticFeatureDefinition>]>;

id: 'start';
data: StartEnvironmentOptions<Environment>;
data: StartEnvironmentOptions;
}

@@ -81,8 +82,6 @@ export interface RemoteProcess {

}
export interface IEnvironmentDescriptor<ENV extends AnyEnvironment = AnyEnvironment> {
export interface IEnvironment {
type: EnvironmentTypes;
name: string;
childEnvName?: string;
flatDependencies?: IEnvironmentDescriptor<MultiEnvironment<ENV['envType']>>[];
env: ENV;
}

@@ -89,0 +88,0 @@ export declare const isEnvironmentStartMessage: (message: ICommunicationMessage) => message is IEnvironmentStartMessage;

@@ -6,3 +6,3 @@ import type io from 'socket.io';

start: () => Promise<{
runtimeEngine: import("@wixc3/engine-core").RuntimeEngine<import("@wixc3/engine-core").AnyEnvironment>;
runtimeEngine: import("@wixc3/engine-core").RuntimeEngine;
close: () => Promise<void>;

@@ -9,0 +9,0 @@ host: WsServerHost;

{
"name": "@wixc3/engine-runtime-node",
"version": "23.0.0-alpha.0",
"version": "23.0.0",
"main": "dist/index.js",

@@ -10,5 +10,5 @@ "types": "dist/index.d.ts",

"dependencies": {
"@wixc3/cross-performance": "^23.0.0-alpha.0",
"@wixc3/engine-core": "^23.0.0-alpha.0",
"@wixc3/engine-core-node": "^23.0.0-alpha.0",
"@wixc3/cross-performance": "^23.0.0",
"@wixc3/engine-core": "^23.0.0",
"@wixc3/engine-core-node": "^23.0.0",
"create-listening-server": "^1.0.0",

@@ -15,0 +15,0 @@ "minimist": "^1.2.5",

import { flattenTree, EnvironmentTypes } from '@wixc3/engine-core';
import type { IEnvironmentDescriptor, IStaticFeatureDefinition } from './types';
import type { IEnvironment, IStaticFeatureDefinition } from './types';

@@ -11,3 +11,3 @@ export function resolveEnvironments(

const environmentTypesToFilterBy = Array.isArray(envTypes) ? envTypes : [envTypes];
const filteredEnvironments = new Set<IEnvironmentDescriptor>();
const filteredEnvironments = new Set<IEnvironment>();

@@ -14,0 +14,0 @@ const featureDefinition = features.get(featureName);

@@ -7,14 +7,15 @@ import {

RuntimeEngine,
RuntimeMetadata,
FeatureLoadersRegistry,
IPreloadModule,
AnyEnvironment,
} from '@wixc3/engine-core';
import { init, remapToUserLibrary, clear } from './external-request-mapper';
import { init, remapToUserLibrary, clear } from './extrenal-request-mapper';
import type { IEnvironmentDescriptor, StartEnvironmentOptions, IStaticFeatureDefinition } from './types';
import type { IEnvironment, StartEnvironmentOptions, IStaticFeatureDefinition } from './types';
export async function runNodeEnvironment<ENV extends AnyEnvironment>({
export async function runNodeEnvironment({
featureName,
childEnvName,
features,
bundlePath,
config = [],

@@ -27,6 +28,5 @@ name,

context,
env,
}: StartEnvironmentOptions<ENV>): Promise<{
}: StartEnvironmentOptions): Promise<{
dispose: () => Promise<void>;
engine: RuntimeEngine<ENV>;
engine: RuntimeEngine;
}> {

@@ -44,2 +44,10 @@ if (host) {

config.push(
RuntimeMetadata.use({
engineerMetadataConfig: {
applicationPath: bundlePath,
},
})
);
const featureLoaders = createFeatureLoaders(new Map(features), {

@@ -49,3 +57,2 @@ name,

type,
env,
});

@@ -110,5 +117,5 @@ const rootFeatureLoader = featureLoaders[featureName];

options: new Map(options),
envName: name,
features: runningFeatures,
resolvedContexts,
env,
});

@@ -121,3 +128,3 @@

features: Map<string, Required<IStaticFeatureDefinition>>,
{ childEnvName, name: envName, env }: IEnvironmentDescriptor
{ name: envName, childEnvName }: IEnvironment
) {

@@ -163,7 +170,6 @@ const featureLoaders: Record<string, IFeatureLoader> = {};

}
for (const { env: envName } of new Set([env, ...env.dependencies])) {
const envFilePath = envFilePaths[envName];
if (envFilePath) {
await import(envFilePath);
}
const envFilePath = envFilePaths[envName];
if (envFilePath) {
await import(envFilePath);
}

@@ -170,0 +176,0 @@ return ((await import(filePath)) as { default: Feature }).default;

@@ -21,3 +21,3 @@ import type { Socket } from 'net';

IConfigDefinition,
IEnvironmentDescriptor,
IEnvironment,
IEnvironmentMessage,

@@ -94,2 +94,3 @@ IEnvironmentStartMessage,

features: Map<string, IStaticFeatureDefinition>;
bundlePath?: string;
configurations?: SetMultiMap<string, IConfigDefinition | TopLevelConfig>;

@@ -111,4 +112,5 @@ defaultRuntimeOptions?: Record<string, string | boolean>;

export interface ILaunchEnvironmentOptions {
nodeEnv: IEnvironmentDescriptor;
nodeEnv: IEnvironment;
featureName: string;
bundlePath?: string;
config: TopLevelConfig;

@@ -191,3 +193,3 @@ options: Record<string, string | boolean>;

const envHostMapping = new Map<IEnvironmentDescriptor, ChildBaseHost>();
const envHostMapping = new Map<IEnvironment, ChildBaseHost>();
for (const nodeEnv of nodeEnvironments) {

@@ -224,2 +226,3 @@ const host = new ChildBaseHost(baseHost);

featureName,
bundlePath: this.options.bundlePath,
config,

@@ -339,2 +342,3 @@ options: {

featureName,
bundlePath: outputPath,
config,

@@ -351,2 +355,3 @@ options,

...nodeEnv,
bundlePath: outputPath,
config,

@@ -364,3 +369,3 @@ featureName,

console.warn(
`Cannot inspect env without forking new process.
`Cannot inspect env without forking new process.
Launchihg environment ${nodeEnv.name} on remote process.`

@@ -367,0 +372,0 @@ );

@@ -40,3 +40,2 @@ import type io from 'socket.io';

const connectedEnvironments: Record<string, ConfigEnvironmentRecord> = {};
//TODO: check
for (const [envName, config] of message.data.config ?? []) {

@@ -43,0 +42,0 @@ if (envName === COM.id) {

@@ -1,13 +0,6 @@

import type {
EnvironmentTypes,
TopLevelConfig,
BaseHost,
Environment,
AnyEnvironment,
MultiEnvironment,
} from '@wixc3/engine-core';
import type { EnvironmentTypes, TopLevelConfig, BaseHost } from '@wixc3/engine-core';
export type TopLevelConfigProvider = (envName: string) => TopLevelConfig;
export interface IExternalFeatureDescriptor {
export interface IExtenalFeatureDescriptor {
envEntries: Record<string, Record<string, string>>;

@@ -35,6 +28,6 @@ packageBasePath: string;

filePath: string;
exportedEnvs?: IEnvironmentDescriptor<AnyEnvironment>[];
exportedEnvs?: IEnvironment[];
}
export interface IExternalFeatureNodeDescriptor extends IExternalFeatureDescriptor, IStaticFeatureDefinition {}
export interface IExternalFeatureNodeDescriptor extends IExtenalFeatureDescriptor, IStaticFeatureDefinition {}

@@ -44,5 +37,5 @@ export const isProcessMessage = (value: unknown): value is IProcessMessage<unknown> =>

export interface StartEnvironmentOptions<ENV extends AnyEnvironment = AnyEnvironment>
extends IEnvironmentDescriptor<ENV> {
export interface StartEnvironmentOptions extends IEnvironment {
featureName: string;
bundlePath?: string;
config?: TopLevelConfig;

@@ -104,3 +97,3 @@ features: Array<[string, Required<IStaticFeatureDefinition>]>;

id: 'start';
data: StartEnvironmentOptions<Environment>;
data: StartEnvironmentOptions;
}

@@ -115,8 +108,6 @@

export interface IEnvironmentDescriptor<ENV extends AnyEnvironment = AnyEnvironment> {
export interface IEnvironment {
type: EnvironmentTypes;
name: string;
childEnvName?: string;
flatDependencies?: IEnvironmentDescriptor<MultiEnvironment<ENV['envType']>>[];
env: ENV;
}

@@ -123,0 +114,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc