alp-node 3.2.2 → 4.0.3

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.
@@ -1,162 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const _config = require('alp-node-config');
8
- const findUp = require('findup-sync');
9
- const Logger = require('nightingale-logger');
10
- const util = require('util');
11
- const _listen = require('alp-listen');
12
- const errors = require('alp-node-errors');
13
- const language = require('alp-node-language');
14
- const params = require('alp-params');
15
- const translate = require('alp-translate');
16
- const Koa = require('koa');
17
- const compress = require('koa-compress');
18
- const serve = require('koa-static');
19
-
20
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
21
-
22
- const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
23
- const _config__default = /*#__PURE__*/_interopDefaultLegacy(_config);
24
- const findUp__default = /*#__PURE__*/_interopDefaultLegacy(findUp);
25
- const Logger__default = /*#__PURE__*/_interopDefaultLegacy(Logger);
26
- const _listen__default = /*#__PURE__*/_interopDefaultLegacy(_listen);
27
- const errors__default = /*#__PURE__*/_interopDefaultLegacy(errors);
28
- const language__default = /*#__PURE__*/_interopDefaultLegacy(language);
29
- const params__default = /*#__PURE__*/_interopDefaultLegacy(params);
30
- const translate__default = /*#__PURE__*/_interopDefaultLegacy(translate);
31
- const Koa__default = /*#__PURE__*/_interopDefaultLegacy(Koa);
32
- const compress__default = /*#__PURE__*/_interopDefaultLegacy(compress);
33
- const serve__default = /*#__PURE__*/_interopDefaultLegacy(serve);
34
-
35
- const logger$1 = new Logger__default('alp');
36
- class AlpNodeApp extends Koa__default {
37
- /**
38
- * @param {Object} [options]
39
- * @param {string} [options.certPath] directory of the ssl certificates
40
- * @param {string} [options.publicPath] directory of public files
41
- */
42
- constructor({
43
- appDirname,
44
- packageDirname,
45
- config,
46
- certPath,
47
- publicPath
48
- }) {
49
- super();
50
- this.dirname = path__default.normalize(appDirname);
51
- Object.defineProperty(this, 'packageDirname', {
52
- get: util.deprecate(() => packageDirname, 'packageDirname'),
53
- configurable: false,
54
- enumerable: false
55
- });
56
- this.certPath = certPath || `${packageDirname}/config/cert`;
57
- this.publicPath = publicPath || `${packageDirname}/public/`;
58
- this.config = _config__default(this, config);
59
- this.context.config = this.config;
60
- params__default(this);
61
- language__default(this);
62
- translate__default('locales')(this);
63
- this.use(compress__default());
64
- }
65
-
66
- existsConfigSync(name) {
67
- return this.config.existsConfigSync(name);
68
- }
69
-
70
- loadConfigSync(name) {
71
- return this.config.loadConfigSync(name);
72
- }
73
-
74
- createContext(req, res) {
75
- const ctx = super.createContext(req, res);
76
- ctx.sanitizedState = {};
77
- return ctx;
78
- }
79
-
80
- servePublic() {
81
- this.use(serve__default(this.publicPath)); // static files
82
- }
83
-
84
- catchErrors() {
85
- this.use(errors__default);
86
- }
87
-
88
- listen() {
89
- throw new Error('Use start instead');
90
- }
91
- /**
92
- * Close server and emit close event
93
- */
94
-
95
-
96
- close() {
97
- if (this._server) {
98
- this._server.close();
99
-
100
- this.emit('close');
101
- }
102
- }
103
-
104
- async start(fn) {
105
- await fn();
106
-
107
- try {
108
- const server = await _listen__default(this.config, this.callback(), this.certPath);
109
- this._server = server;
110
- logger$1.success('started');
111
- if (process.send) process.send('ready');
112
- return server;
113
- } catch (err) {
114
- logger$1.error('start fail', {
115
- err
116
- });
117
- throw err;
118
- }
119
- }
120
-
121
- }
122
-
123
- const logger = new Logger__default('alp'); // see alp-dev
124
-
125
- const appDirname = path__default.resolve('build');
126
- const packagePath = findUp__default('package.json', {
127
- cwd: appDirname
128
- });
129
-
130
- if (!packagePath) {
131
- throw new Error(`Could not find package.json: "${String(packagePath)}"`);
132
- }
133
-
134
- const packageDirname = path__default.dirname(packagePath);
135
- logger.debug('init', {
136
- appDirname,
137
- packageDirname
138
- });
139
- const packageConfig = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
140
- const buildedConfigPath = `${appDirname}/build/config/`;
141
- const configPath = fs.existsSync(buildedConfigPath) ? buildedConfigPath : `${appDirname}/config/`;
142
- const config = new _config.Config(configPath).loadSync({
143
- packageConfig
144
- });
145
- class App extends AlpNodeApp {
146
- constructor(options) {
147
- super({ ...options,
148
- appDirname,
149
- packageDirname,
150
- config
151
- });
152
- }
153
-
154
- }
155
-
156
- exports.Config = _config.Config;
157
- exports.appDirname = appDirname;
158
- exports.config = config;
159
- exports.default = App;
160
- exports.packageConfig = packageConfig;
161
- exports.packageDirname = packageDirname;
162
- //# sourceMappingURL=index-node12.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12.cjs.js","sources":["../src/AlpNodeApp.ts","../src/index.ts"],"sourcesContent":["import type { IncomingMessage, Server, ServerResponse } from 'http';\nimport path from 'path';\nimport { deprecate } from 'util';\nimport _listen from 'alp-listen';\nimport type { Config } from 'alp-node-config';\nimport _config from 'alp-node-config';\nimport errors from 'alp-node-errors';\nimport language from 'alp-node-language';\nimport params from 'alp-params';\nimport translate from 'alp-translate';\nimport type {\n NodeApplication,\n NodeConfig,\n Context as AlpContext,\n ContextState,\n ContextSanitizedState,\n} from 'alp-types';\nimport Koa from 'koa';\nimport type { ParameterizedContext, DefaultState, Context } from 'koa';\nimport compress from 'koa-compress';\nimport serve from 'koa-static';\nimport Logger from 'nightingale-logger';\n\nconst logger = new Logger('alp');\n\nexport interface AlpNodeAppOptions {\n appDirname: string;\n packageDirname: string;\n config: Config & NodeConfig;\n certPath?: string;\n publicPath?: string;\n}\n\ndeclare module 'koa' {\n interface DefaultState extends ContextState {}\n interface DefaultContext extends AlpContext {}\n interface BaseContext extends AlpContext {}\n}\n\nexport type { Context };\n\nexport class AlpNodeApp extends Koa<ContextState> implements NodeApplication {\n dirname: string;\n\n certPath: string;\n\n publicPath: string;\n\n config: NodeConfig & Config;\n\n _server?: Server;\n\n /**\n * @param {Object} [options]\n * @param {string} [options.certPath] directory of the ssl certificates\n * @param {string} [options.publicPath] directory of public files\n */\n constructor({\n appDirname,\n packageDirname,\n config,\n certPath,\n publicPath,\n }: AlpNodeAppOptions) {\n super();\n\n this.dirname = path.normalize(appDirname);\n\n Object.defineProperty(this, 'packageDirname', {\n get: deprecate(() => packageDirname, 'packageDirname'),\n configurable: false,\n enumerable: false,\n });\n\n this.certPath = certPath || `${packageDirname}/config/cert`;\n this.publicPath = publicPath || `${packageDirname}/public/`;\n\n this.config = _config(this, config);\n this.context.config = this.config;\n\n params(this);\n language(this);\n translate('locales')(this);\n\n this.use(compress());\n }\n\n existsConfigSync(name: string): ReturnType<Config['existsConfigSync']> {\n return this.config.existsConfigSync(name);\n }\n\n loadConfigSync(name: string): ReturnType<Config['loadConfigSync']> {\n return this.config.loadConfigSync(name);\n }\n\n createContext<StateT = DefaultState>(\n req: IncomingMessage,\n res: ServerResponse,\n ): ParameterizedContext<StateT> {\n const ctx = super.createContext<StateT>(req, res);\n ctx.sanitizedState = {} as ContextSanitizedState;\n return ctx;\n }\n\n servePublic(): void {\n this.use(serve(this.publicPath)); // static files\n }\n\n catchErrors(): void {\n this.use(errors);\n }\n\n listen(): Server {\n throw new Error('Use start instead');\n }\n\n /**\n * Close server and emit close event\n */\n close(): void {\n if (this._server) {\n this._server.close();\n this.emit('close');\n }\n }\n\n async start(fn: () => Promise<void> | void): Promise<Server> {\n await fn();\n try {\n const server = await _listen(this.config, this.callback(), this.certPath);\n this._server = server;\n logger.success('started');\n if (process.send) process.send('ready');\n return server;\n } catch (err: unknown) {\n logger.error('start fail', { err });\n throw err;\n }\n }\n}\n","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport { Config } from 'alp-node-config';\nimport findUp from 'findup-sync';\nimport Logger from 'nightingale-logger';\nimport type { AlpNodeAppOptions, Context } from './AlpNodeApp';\nimport { AlpNodeApp } from './AlpNodeApp';\n\nexport type { Context };\nexport { Config };\n\nconst logger = new Logger('alp');\n\n// see alp-dev\nexport const appDirname = path.resolve('build');\n\nconst packagePath = findUp('package.json', { cwd: appDirname });\nif (!packagePath) {\n throw new Error(`Could not find package.json: \"${String(packagePath)}\"`);\n}\nexport const packageDirname = path.dirname(packagePath);\n\nlogger.debug('init', { appDirname, packageDirname });\n\nexport const packageConfig: Record<string, unknown> = JSON.parse(\n readFileSync(packagePath, 'utf-8'),\n) as Record<string, unknown>;\n\nconst buildedConfigPath = `${appDirname}/build/config/`;\nconst configPath = existsSync(buildedConfigPath)\n ? buildedConfigPath\n : `${appDirname}/config/`;\n\nexport const config = new Config(configPath).loadSync({ packageConfig });\n\nexport type AppOptions = Omit<\n AlpNodeAppOptions,\n 'appDirname' | 'packageDirname' | 'config'\n>;\n\nexport default class App extends AlpNodeApp {\n constructor(options?: AppOptions) {\n super({\n ...options,\n appDirname,\n packageDirname,\n config,\n });\n }\n}\n"],"names":["logger","Logger","AlpNodeApp","Koa","constructor","appDirname","packageDirname","config","certPath","publicPath","dirname","path","normalize","Object","defineProperty","get","deprecate","configurable","enumerable","_config","context","params","language","translate","use","compress","existsConfigSync","name","loadConfigSync","createContext","req","res","ctx","sanitizedState","servePublic","serve","catchErrors","errors","listen","Error","close","_server","emit","start","fn","server","_listen","callback","success","process","send","err","error","resolve","packagePath","findUp","cwd","String","debug","packageConfig","JSON","parse","readFileSync","buildedConfigPath","configPath","existsSync","Config","loadSync","App","options"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAMA,QAAM,GAAG,IAAIC,eAAJ,CAAW,KAAX,CAAf;AAkBO,MAAMC,UAAN,SAAyBC,YAAzB,CAAsE;AAW3E;AACF;AACA;AACA;AACA;AACEC,EAAAA,WAAW,CAAC;AACVC,IAAAA,UADU;AAEVC,IAAAA,cAFU;AAGVC,IAAAA,MAHU;AAIVC,IAAAA,QAJU;AAKVC,IAAAA;AALU,GAAD,EAMW;AACpB;AAEA,SAAKC,OAAL,GAAeC,aAAI,CAACC,SAAL,CAAeP,UAAf,CAAf;AAEAQ,IAAAA,MAAM,CAACC,c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DC,eAAY,CAACR,WAAD,EAAc,OAAd,CADwC;AAItD,MAAMS,iBAAiB,GAAI,GAAE1D,UAAW,gBAAxC;AACA,MAAM2D,UAAU,GAAGC,aAAU,CAACF,iBAAD,CAAV,GACfA,iBADe,GAEd,GAAE1D,UAAW,UAFlB;MAIaE,MAAM,GAAG,IAAI2D,cAAJ,CAAWF,UAAX,EAAuBG,QAAvB,CAAgC;AAAER,EAAAA;AAAF,CAAhC;AAOP,MAAMS,GAAN,SAAkBlE,UAAlB,CAA6B;AAC1CE,EAAAA,WAAW,CAACiE,OAAD,EAAuB;AAChC,UAAM,EACJ,GAAGA,OADC;AAEJhE,MAAAA,UAFI;AAGJC,MAAAA,cAHI;AAIJC,MAAAA;AAJI,KAAN;AAMD;;AARyC;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node12.mjs","sources":["../src/AlpNodeApp.ts","../src/index.ts"],"sourcesContent":["import type { IncomingMessage, Server, ServerResponse } from 'http';\nimport path from 'path';\nimport { deprecate } from 'util';\nimport _listen from 'alp-listen';\nimport type { Config } from 'alp-node-config';\nimport _config from 'alp-node-config';\nimport errors from 'alp-node-errors';\nimport language from 'alp-node-language';\nimport params from 'alp-params';\nimport translate from 'alp-translate';\nimport type {\n NodeApplication,\n NodeConfig,\n Context as AlpContext,\n ContextState,\n ContextSanitizedState,\n} from 'alp-types';\nimport Koa from 'koa';\nimport type { ParameterizedContext, DefaultState, Context } from 'koa';\nimport compress from 'koa-compress';\nimport serve from 'koa-static';\nimport Logger from 'nightingale-logger';\n\nconst logger = new Logger('alp');\n\nexport interface AlpNodeAppOptions {\n appDirname: string;\n packageDirname: string;\n config: Config & NodeConfig;\n certPath?: string;\n publicPath?: string;\n}\n\ndeclare module 'koa' {\n interface DefaultState extends ContextState {}\n interface DefaultContext extends AlpContext {}\n interface BaseContext extends AlpContext {}\n}\n\nexport type { Context };\n\nexport class AlpNodeApp extends Koa<ContextState> implements NodeApplication {\n dirname: string;\n\n certPath: string;\n\n publicPath: string;\n\n config: NodeConfig & Config;\n\n _server?: Server;\n\n /**\n * @param {Object} [options]\n * @param {string} [options.certPath] directory of the ssl certificates\n * @param {string} [options.publicPath] directory of public files\n */\n constructor({\n appDirname,\n packageDirname,\n config,\n certPath,\n publicPath,\n }: AlpNodeAppOptions) {\n super();\n\n this.dirname = path.normalize(appDirname);\n\n Object.defineProperty(this, 'packageDirname', {\n get: deprecate(() => packageDirname, 'packageDirname'),\n configurable: false,\n enumerable: false,\n });\n\n this.certPath = certPath || `${packageDirname}/config/cert`;\n this.publicPath = publicPath || `${packageDirname}/public/`;\n\n this.config = _config(this, config);\n this.context.config = this.config;\n\n params(this);\n language(this);\n translate('locales')(this);\n\n this.use(compress());\n }\n\n existsConfigSync(name: string): ReturnType<Config['existsConfigSync']> {\n return this.config.existsConfigSync(name);\n }\n\n loadConfigSync(name: string): ReturnType<Config['loadConfigSync']> {\n return this.config.loadConfigSync(name);\n }\n\n createContext<StateT = DefaultState>(\n req: IncomingMessage,\n res: ServerResponse,\n ): ParameterizedContext<StateT> {\n const ctx = super.createContext<StateT>(req, res);\n ctx.sanitizedState = {} as ContextSanitizedState;\n return ctx;\n }\n\n servePublic(): void {\n this.use(serve(this.publicPath)); // static files\n }\n\n catchErrors(): void {\n this.use(errors);\n }\n\n listen(): Server {\n throw new Error('Use start instead');\n }\n\n /**\n * Close server and emit close event\n */\n close(): void {\n if (this._server) {\n this._server.close();\n this.emit('close');\n }\n }\n\n async start(fn: () => Promise<void> | void): Promise<Server> {\n await fn();\n try {\n const server = await _listen(this.config, this.callback(), this.certPath);\n this._server = server;\n logger.success('started');\n if (process.send) process.send('ready');\n return server;\n } catch (err: unknown) {\n logger.error('start fail', { err });\n throw err;\n }\n }\n}\n","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport { Config } from 'alp-node-config';\nimport findUp from 'findup-sync';\nimport Logger from 'nightingale-logger';\nimport type { AlpNodeAppOptions, Context } from './AlpNodeApp';\nimport { AlpNodeApp } from './AlpNodeApp';\n\nexport type { Context };\nexport { Config };\n\nconst logger = new Logger('alp');\n\n// see alp-dev\nexport const appDirname = path.resolve('build');\n\nconst packagePath = findUp('package.json', { cwd: appDirname });\nif (!packagePath) {\n throw new Error(`Could not find package.json: \"${String(packagePath)}\"`);\n}\nexport const packageDirname = path.dirname(packagePath);\n\nlogger.debug('init', { appDirname, packageDirname });\n\nexport const packageConfig: Record<string, unknown> = JSON.parse(\n readFileSync(packagePath, 'utf-8'),\n) as Record<string, unknown>;\n\nconst buildedConfigPath = `${appDirname}/build/config/`;\nconst configPath = existsSync(buildedConfigPath)\n ? buildedConfigPath\n : `${appDirname}/config/`;\n\nexport const config = new Config(configPath).loadSync({ packageConfig });\n\nexport type AppOptions = Omit<\n AlpNodeAppOptions,\n 'appDirname' | 'packageDirname' | 'config'\n>;\n\nexport default class App extends AlpNodeApp {\n constructor(options?: AppOptions) {\n super({\n ...options,\n appDirname,\n packageDirname,\n config,\n });\n }\n}\n"],"names":["logger","Logger","AlpNodeApp","Koa","constructor","appDirname","packageDirname","config","certPath","publicPath","dirname","path","normalize","Object","defineProperty","get","deprecate","configurable","enumerable","_config","context","params","language","translate","use","compress","existsConfigSync","name","loadConfigSync","createContext","req","res","ctx","sanitizedState","servePublic","serve","catchErrors","errors","listen","Error","close","_server","emit","start","fn","server","_listen","callback","success","process","send","err","error","resolve","packagePath","findUp","cwd","String","debug","packageConfig","JSON","parse","readFileSync","buildedConfigPath","configPath","existsSync","Config","loadSync","App","options"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAMA,QAAM,GAAG,IAAIC,MAAJ,CAAW,KAAX,CAAf;AAkBO,MAAMC,UAAN,SAAyBC,GAAzB,CAAsE;AAW3E;AACF;AACA;AACA;AACA;AACEC,EAAAA,WAAW,CAAC;AACVC,IAAAA,UADU;AAEVC,IAAAA,cAFU;AAGVC,IAAAA,MAHU;AAIVC,IAAAA,QAJU;AAKVC,IAAAA;AALU,GAAD,EAMW;AACpB;AAE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AAAA,UAAF;AAAcC,EAAAA;AAAd,CAArB;MAEaqD,aAAsC,GAAGC,IAAI,CAACC,KAAL,CACpDC,YAAY,CAACR,WAAD,EAAc,OAAd,CADwC;AAItD,MAAMS,iBAAiB,GAAI,GAAE1D,UAAW,gBAAxC;AACA,MAAM2D,UAAU,GAAGC,UAAU,CAACF,iBAAD,CAAV,GACfA,iBADe,GAEd,GAAE1D,UAAW,UAFlB;MAIaE,MAAM,GAAG,IAAI2D,MAAJ,CAAWF,UAAX,EAAuBG,QAAvB,CAAgC;AAAER,EAAAA;AAAF,CAAhC;AAOP,MAAMS,GAAN,SAAkBlE,UAAlB,CAA6B;AAC1CE,EAAAA,WAAW,CAACiE,OAAD,EAAuB;AAChC,UAAM,EACJ,GAAGA,OADC;AAEJhE,MAAAA,UAFI;AAGJC,MAAAA,cAHI;AAIJC,MAAAA;AAJI,KAAN;AAMD;;AARyC;;;;;"}
package/fetch.mjs DELETED
@@ -1,3 +0,0 @@
1
- import fetch from 'node-fetch';
2
-
3
- global.fetch = fetch;
package/index.js DELETED
@@ -1,6 +0,0 @@
1
- /* eslint-disable import/no-dynamic-require */
2
-
3
- 'use strict';
4
-
5
- const production = process.env.NODE_ENV === 'production';
6
- module.exports = require(`./dist/index-node12${production ? '' : '-dev'}.cjs`);