Socket
Socket
Sign inDemoInstall

@modern-js/types

Package Overview
Dependencies
Maintainers
12
Versions
3308
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@modern-js/types - npm Package Compare versions

Comparing version 0.0.0-alpha.202201181945 to 0.0.0-alpha.202205061200

.eslintrc.js

103

CHANGELOG.md
# @modern-js/types
## 1.5.1
### Patch Changes
- 3d1fac2a: chore: app-tools no longer depend on webpack
## 1.5.0
### Minor Changes
- 3bf4f8b0: feat: support start api server only
### Patch Changes
- 6cffe99d: chore:
remove react eslint rules for `modern-js` rule set.
add .eslintrc for each package to speed up linting
- 60f7d8bf: feat: add tests dir to npmignore
- Updated dependencies [6cffe99d]
- Updated dependencies [60f7d8bf]
- @modern-js/plugin@1.3.3
## 1.4.0
### Minor Changes
- d2d1d6b2: feat: support server config
## 1.3.6
### Patch Changes
- 132f7b53: feat: move config declarations to @modern-js/core
## 1.3.5
### Patch Changes
- d95f28c3: should enable babel register before server plugin require
- Updated dependencies [80d8ddfe]
- Updated dependencies [491145e3]
- @modern-js/plugin@1.3.0
## 1.3.4
### Patch Changes
- 4499a674: feat: support to pass options to plugins
- e37ea5b2: feat: add afterMonorepoDeploy hook
## 1.3.3
### Patch Changes
- deeaa602: support svg/proxy/multi-version in unbundled
## 1.3.2
### Patch Changes
- 6891e4c2: add addDefineTypes define
## 1.3.1
### Patch Changes
- 78279953: compiler entry bug fix and dev build console
- 4d72edea: support dev compiler by entry
## 1.3.0
### Minor Changes
- ec4dbffb: feat: support as a pure api service
### Patch Changes
- 816fd721: support more server context
- bfbea9a7: support multi base url and dynamic base url
- 24f616ca: feat: support custom meta info
- 272cab15: refactor server plugin manager
## 1.2.1
### Patch Changes
- 83166714: change .npmignore
- b7c48198: feat: add beforeGenerateRoutes hook
- Updated dependencies [83166714]
- @modern-js/plugin@1.2.1
## 1.2.0
### Minor Changes
- cfe11628: Make Modern.js self bootstraping
### Patch Changes
- e2464fe5: add more server types
- Updated dependencies [cfe11628]
- @modern-js/plugin@1.2.0
## 1.1.5

@@ -4,0 +107,0 @@

21

cli/index.d.ts

@@ -5,4 +5,2 @@ import { AsyncWaterfall, AsyncWorkflow } from '@modern-js/plugin';

export type { Compiler, MultiCompiler, Configuration };
/**

@@ -48,4 +46,6 @@ * Bundle entrypoint

export interface IAppContext {
metaName: string; // name for generating conventional constants, such as .modern-js
appDirectory: string;
configFile: string | false;
serverConfigFile: string;
ip?: string;

@@ -61,9 +61,12 @@ port?: number;

cli?: any;
cliPath?: any;
server?: any;
serverPath?: any;
serverPkg?: any;
}[];
entrypoints: Entrypoint[];
checkedEntries: string[];
serverRoutes: ServerRoute[];
htmlTemplates: HtmlTemplates;
apiOnly: boolean;
internalDirAlias: string;
internalSrcAlias: string;
}

@@ -80,3 +83,2 @@

>;
afterCreateCompiler: AsyncWorkflow<

@@ -98,2 +100,6 @@ {

afterBuild: AsyncWorkflow<void, unknown>;
afterMonorepoDeploy: AsyncWorkflow<
{ operator: any; deployProjectNames: string[] },
void
>;
beforeDeploy: AsyncWorkflow<Record<string, any>, unknown>;

@@ -129,2 +135,7 @@ afterDeploy: AsyncWorkflow<Record<string, any>, unknown>;

addRuntimeExports: AsyncWaterfall<void>;
beforeGenerateRoutes: AsyncWaterfall<{
entrypoint: Entrypoint;
code: string;
}>;
addDefineTypes: AsyncWaterfall<void>;
}

@@ -5,5 +5,4 @@ const sharedConfig = require('@scripts/jest-config');

module.exports = {
// eslint-disable-next-line node/no-unsupported-features/es-syntax
...sharedConfig,
rootDir: __dirname,
};

@@ -14,6 +14,7 @@ {

],
"version": "0.0.0-alpha.202201181945",
"version": "0.0.0-alpha.202205061200",
"types": "./index.d.ts",
"dependencies": {
"@modern-js/plugin": "^1.1.2",
"@modern-js/plugin": "^1.3.3",
"http-proxy-middleware": "^2.0.4",
"webpack": "^5.54.0"

@@ -29,2 +30,4 @@ },

"devDependencies": {
"@scripts/build": "*",
"@scripts/jest-config": "*",
"@types/jest": "^26",

@@ -34,5 +37,3 @@ "@types/node": "^14",

"@types/react-dom": "^17",
"@scripts/build": "*",
"jest": "^27",
"@scripts/jest-config": "*"
"jest": "^27"
},

@@ -39,0 +40,0 @@ "sideEffects": false,

@@ -54,3 +54,5 @@ import { IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';

headers: IncomingHttpHeaders;
host: string;
cookie?: string;
[propsName: string]: any;
};

@@ -61,5 +63,27 @@ redirection: { url?: string; status?: number };

entryName: string;
logger: Logger;
metrics?: Metrics;
logger: {
error: (message: string, e: Error | string) => void;
debug: (message: string, ...args: any[]) => void;
info: (message: string, ...args: any[]) => void;
};
metrics: {
emitTimer: (
name: string,
cost: number,
tags: Record<string, unknown> = {},
) => void;
emitCounter: (name: string, tags: Record<string, unknown> = {}) => void;
};
loadableManifest?: string;
};
cacheConfig?: any;
};
export interface ISAppContext {
appDirectory: string;
distDirectory: string;
sharedDirectory: string;
plugins: {
server?: any;
serverPkg?: any;
}[];
}
import { IncomingMessage, ServerResponse } from 'http';
import { ServerRoute as Route } from './route'
import { NextFunction } from './utils'
import { ModernServerContext } from './context'
import { ServerRoute as Route } from './route';
import { NextFunction } from './utils';
import { ModernServerContext } from './context';

@@ -28,4 +28,4 @@ type Middleware = (

type HookHandler<Context> = (ctx: Context, next: NextFunction) => Promise<void>
type Hook<Context> = (fn: HookHandler<Context>) => void
type HookHandler<Context> = (ctx: Context, next: NextFunction) => Promise<void>;
type Hook<Context> = (fn: HookHandler<Context>) => void;
export type ModernServerHook = {

@@ -36,2 +36,2 @@ beforeMatch: Hook<ModernServerContext>;

afterRender: Hook<ModernServerContext & { template: TemplateAPI }>;
}
};

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

import { IncomingMessage, ServerResponse } from 'http';
export type Metrics = {
counter: () => void;
timer: () => void;
emitCounter: (name: string, value: number, tags: Record<string, any>) => void;
emitTimer: (name: string, value: number, tags: Record<string, any>) => void;
gauges: () => void;

@@ -20,1 +22,21 @@ };

export type NextFunction = () => void;
export type ProxyDetail = {
target: string;
pathRewrite?: Record<string, string>;
secure?: boolean;
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
bypass?: (
req: IncomingMessage,
res: ServerResponse,
proxyOptions: BffProxyOptions,
) => string | undefined | null | false;
context?: string | string[];
changeOrigin?: boolean;
};
export type BffProxyOptions =
| Record<string, string>
| Record<string, ProxyDetail>
| ProxyDetail[]
| ProxyDetail;

@@ -9,3 +9,3 @@ {

},
"include": ["src"]
"include": ["cli", "server"]
}
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