edge.libx.js 0.1.4 → 0.1.6

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.
package/README.md CHANGED
@@ -21,8 +21,8 @@ Useful package.json scripts:
21
21
  ...
22
22
  "scripts": {
23
23
  "build": "tsc",
24
- "debug": "tsx --inspect -r dotenv/config node_modules/edge.libx.js/src/helpers/localServer.ts src/index.ts",
25
- "debug:watch": "nodemon --watch 'src/**/*.ts' --exec tsx --inspect -r dotenv/config node_modules/edge.libx.js/src/helpers/localServer.ts src/index.ts",
24
+ "debug": "tsx --inspect node_modules/edge.libx.js/src/helpers/localServer.ts src/index.ts",
25
+ "debug:watch": "nodemon --watch 'src/**/*.ts' --exec tsx --inspect node_modules/edge.libx.js/src/helpers/localServer.ts src/index.ts",
26
26
 
27
27
  "set-secrets": "set-secrets .env.preview preview \"vercel env add\" remove",
28
28
 
@@ -4,7 +4,7 @@ export declare class Helpers {
4
4
  options?: Partial<ModuleOptions>;
5
5
  constructor(options?: Partial<ModuleOptions>);
6
6
  verifyRequestToken(request: IRequest, expectedAud: string): Promise<IFirebaseTokenPayload>;
7
- gatherResponse(response: Response): Promise<string | Uint8Array>;
7
+ gatherResponse(response: Response): Promise<string | Uint8Array<ArrayBufferLike>>;
8
8
  readStream(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
9
9
  }
10
10
  export declare class ModuleOptions {
@@ -13,7 +13,7 @@ const node_essentials_1 = require("libx.js/build/bundles/node.essentials");
13
13
  const path_1 = __importDefault(require("path"));
14
14
  const https_1 = require("https");
15
15
  const selfsigned_1 = __importDefault(require("selfsigned"));
16
- require('dotenv').config({ path: `.env.${process.env.NODE_ENV}` });
16
+ node_essentials_1.libx.node.loadEnv({ path: `.env.${process.env.NODE_ENV}` });
17
17
  log_1.log.isDebug = true;
18
18
  log_1.log.filterLevel = log_1.LogLevel.All;
19
19
  const envFile = '.env';
@@ -37,7 +37,7 @@ function getEnvVars() {
37
37
  node_essentials_1.libx.node.catchErrors((err) => {
38
38
  console.error('!!!!!! ERROR: ', err);
39
39
  }, false);
40
- if (['debug', 'debug:watch', 'api:debug'].indexOf(process.env.npm_lifecycle_event) !== -1) {
40
+ if (true || ['debug', 'debug:watch', 'api:debug', ''].indexOf(process.env.npm_lifecycle_event) !== -1) {
41
41
  const env = (_a = getEnvVars()) !== null && _a !== void 0 ? _a : { a: 1 };
42
42
  for (let entryPoint of entryPoints) {
43
43
  const dir = process.cwd();
@@ -1 +1 @@
1
- {"version":3,"file":"localServer.js","sourceRoot":"","sources":["../../src/helpers/localServer.ts"],"names":[],"mappings":";;;;;;AACA,gDAA0D;AAC1D,4BAA0B;AAG1B,6CAA0C;AAE1C,4CAAoB;AACpB,mDAA0D;AAC1D,2EAA6D;AAC7D,gDAAwB;AACxB,iCAA4C;AAC5C,4DAAoC;AAEpC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAEnE,SAAG,CAAC,OAAO,GAAG,IAAI,CAAC;AACnB,SAAG,CAAC,WAAW,GAAG,cAAQ,CAAC,GAAG,CAAC;AAE/B,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,WAAW,GAAG,sBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAErC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,uBAAU,GAAE,CAAC;AAM7B,SAAS,UAAU;;IAClB,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;IACtD,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAA,YAAE,CAAC,YAAY,CAAC,WAAW,CAAC,0CAAE,QAAQ,EAAE,CAAC;IACzD,MAAM,G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'@whatwg-node/server';\nimport 'isomorphic-fetch';\nimport { IRequest, Router, error, json } from 'itty-router';\nimport express, { Express, Request, Response } from \"express\";\nimport { getExpress } from './getExpress';\n// import { router, server } from '../v5';\nimport fs from 'fs';\nimport { log, LogLevel } from 'libx.js/build/modules/log';\nimport { libx } from 'libx.js/build/bundles/node.essentials';\nimport path from 'path';\nimport https, { createServer } from 'https';\nimport selfsigned from 'selfsigned';\n\nrequire('dotenv').config({ path: `.env.${process.env.NODE_ENV}` });\n\nlog.isDebug = true;\nlog.filterLevel = LogLevel.All;\n\nconst envFile = '.env'; //'.dev.vars'\nconst entryPoints = libx.node.args._;\n\nconst { app } = getExpress();\n\n// node-wrangler bridge:\n// global.crypto = require('crypto');\n// global.TransformStream = require('web-streams-polyfill').TransformStream;\n\nfunction getEnvVars() {\n\tconst envFilePath = path.join(process.cwd(), envFile);\n\tif (!fs.existsSync(envFilePath)) return null;\n\tconst content = fs.readFileSync(envFilePath)?.toString();\n\tconst ret = {};\n\tfor (let line of content.split('\\n')) {\n\t\tconst parts = line.split('=');\n\t\tif (parts[0].trim().startsWith('#') || parts[1] == null) continue;\n\t\tret[parts[0].trim()] = parts[1].replace(/\\s*[\\\"\\'](.+)[\\\"\\']\\s*/gi, '$1');\n\t}\n\treturn ret;\n}\n\nlibx.node.catchErrors((err) => {\n\tconsole.error('!!!!!! ERROR: ', err);\n}, false);\n\n\n// only lunch manual local server if using 'dev' command\nif (['debug', 'debug:watch', 'api:debug'].indexOf(process.env.npm_lifecycle_event) !== -1) {\n\tconst env = getEnvVars() ?? { a: 1 };\n\n\tfor (let entryPoint of entryPoints) {\n\t\tconst dir = process.cwd(); // process.argv[1]\n\t\tconst { handler, prefix } = require(`${dir}/${entryPoint}`);\n\t\tapp.use(\n\t\t\tprefix ?? '/api',\n\t\t\tcreateServerAdapter((request, env) =>\n\t\t\t\thandler(<IRequest>request, env))\n\t\t);\n\t}\n\n\t// app.use(\n\t// \t'/v5-n',\n\t// \tcreateServerAdapter((request, env) =>\n\t// \t\thandler_node(<IRequest>request, env))\n\t// \t\t// handlerRedirect(<IRequest>request, env))\n\t// );\n\n\tconst port = process.env.PORT || 8080;\n\ttry {\n\t\tlet server: https.Server | Express = app;\n\n\t\tconst isHttps = process.env.useHttps ?? (libx.node.args.https != null) ?? false;\n\t\tif (isHttps) {\n\t\t\tlibx.log.v('localServer: using https');\n\t\t\tconst attrs = [{ name: 'commonName', value: 'localhost' }];\n\t\t\tconst pems = selfsigned.generate(attrs, { days: 365 });\n\n\t\t\tserver = createServer({\n\t\t\t\tkey: pems.private,\n\t\t\t\tcert: pems.cert,\n\t\t\t}, app);\n\t\t}\n\n\t\tserver.listen(port, () => {\n\t\t\tconsole.log(`Server listening on http${isHttps ? 's' : ''}://0.0.0.0:${port}`);\n\t\t});\n\t} catch (err) {\n\t\tconsole.error(`LOCAL: Failed to start local server on port: ${port}`, err);\n\t}\n}\n\n// export default server; //routes.fetch;"]}
1
+ {"version":3,"file":"localServer.js","sourceRoot":"","sources":["../../src/helpers/localServer.ts"],"names":[],"mappings":";;;;;;AACA,gDAA0D;AAC1D,4BAA0B;AAG1B,6CAA0C;AAE1C,4CAAoB;AACpB,mDAA0D;AAC1D,2EAA6D;AAC7D,gDAAwB;AACxB,iCAA4C;AAC5C,4DAAoC;AAIpC,sBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE5D,SAAG,CAAC,OAAO,GAAG,IAAI,CAAC;AACnB,SAAG,CAAC,WAAW,GAAG,cAAQ,CAAC,GAAG,CAAC;AAE/B,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,WAAW,GAAG,sBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAErC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,uBAAU,GAAE,CAAC;AAM7B,SAAS,UAAU;;IAClB,MAAM,WAAW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AAC,EAAE,cAAc,IAAI,EAAE,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,KAAK,CAAC,gDAAgD,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5E,CAAC;AACF,CAAC","sourcesContent":["// $ npm_lifecycle_event=debug tsx --inspect ./src/helpers/localServer.ts --https\nimport { createServerAdapter } from '@whatwg-node/server';\nimport 'isomorphic-fetch';\nimport { IRequest, Router, error, json } from 'itty-router';\nimport express, { Express, Request, Response } from \"express\";\nimport { getExpress } from './getExpress';\n// import { router, server } from '../v5';\nimport fs from 'fs';\nimport { log, LogLevel } from 'libx.js/build/modules/log';\nimport { libx } from 'libx.js/build/bundles/node.essentials';\nimport path from 'path';\nimport https, { createServer } from 'https';\nimport selfsigned from 'selfsigned';\n\ndeclare const process: NodeJS.Process;\n\nlibx.node.loadEnv({ path: `.env.${process.env.NODE_ENV}` });\n\nlog.isDebug = true;\nlog.filterLevel = LogLevel.All;\n\nconst envFile = '.env'; //'.dev.vars'\nconst entryPoints = libx.node.args._;\n\nconst { app } = getExpress();\n\n// node-wrangler bridge:\n// global.crypto = require('crypto');\n// global.TransformStream = require('web-streams-polyfill').TransformStream;\n\nfunction getEnvVars() {\n\tconst envFilePath = path.join(process.cwd(), envFile);\n\tif (!fs.existsSync(envFilePath)) return null;\n\tconst content = fs.readFileSync(envFilePath)?.toString();\n\tconst ret = {};\n\tfor (let line of content.split('\\n')) {\n\t\tconst parts = line.split('=');\n\t\tif (parts[0].trim().startsWith('#') || parts[1] == null) continue;\n\t\tret[parts[0].trim()] = parts[1].replace(/\\s*[\\\"\\'](.+)[\\\"\\']\\s*/gi, '$1');\n\t}\n\treturn ret;\n}\n\nlibx.node.catchErrors((err) => {\n\tconsole.error('!!!!!! ERROR: ', err);\n}, false);\n\n\n// only lunch manual local server if using 'dev' command\nif (true || ['debug', 'debug:watch', 'api:debug', ''].indexOf(process.env.npm_lifecycle_event) !== -1) {\n\tconst env = getEnvVars() ?? { a: 1 };\n\n\tfor (let entryPoint of entryPoints) {\n\t\tconst dir = process.cwd(); // process.argv[1]\n\t\tconst { handler, prefix } = require(`${dir}/${entryPoint}`);\n\t\tapp.use(\n\t\t\tprefix ?? '/api',\n\t\t\tcreateServerAdapter((request, env) =>\n\t\t\t\thandler(<IRequest>request, env))\n\t\t);\n\t}\n\n\t// app.use(\n\t// \t'/v5-n',\n\t// \tcreateServerAdapter((request, env) =>\n\t// \t\thandler_node(<IRequest>request, env))\n\t// \t\t// handlerRedirect(<IRequest>request, env))\n\t// );\n\n\tconst port = process.env.PORT || 8080;\n\ttry {\n\t\tlet server: https.Server | Express = app;\n\n\t\tconst isHttps = process.env.useHttps ?? (libx.node.args.https != null) ?? false;\n\t\tif (isHttps) {\n\t\t\tlibx.log.v('localServer: using https');\n\t\t\tconst attrs = [{ name: 'commonName', value: 'localhost' }];\n\t\t\tconst pems = selfsigned.generate(attrs, { days: 365 });\n\n\t\t\tserver = createServer({\n\t\t\t\tkey: pems.private,\n\t\t\t\tcert: pems.cert,\n\t\t\t}, app);\n\t\t}\n\n\t\tserver.listen(port, () => {\n\t\t\tconsole.log(`Server listening on http${isHttps ? 's' : ''}://0.0.0.0:${port}`);\n\t\t});\n\t} catch (err) {\n\t\tconsole.error(`LOCAL: Failed to start local server on port: ${port}`, err);\n\t}\n}\n\n// export default server; //routes.fetch;"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge.libx.js",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "main": "build/main.js",
5
5
  "license": "MIT",
6
6
  "author": "Elya Livshitz",
@@ -34,7 +34,7 @@
34
34
  "isomorphic-fetch": "^3.0.0",
35
35
  "itty-router": "^5.0.18",
36
36
  "js-base64": "^3.7.7",
37
- "libx.js": "^4.4.0",
37
+ "libx.js": "^5.1.0",
38
38
  "selfsigned": "^2.4.1",
39
39
  "ua-parser-js": "^1.0.39"
40
40
  },
@@ -42,7 +42,6 @@
42
42
  "@types/express": "^5.0.1",
43
43
  "@types/jest": "^29.5.5",
44
44
  "@types/node": "^22.13.12",
45
- "dotenv": "^16.4.5",
46
45
  "https": "^1.0.0",
47
46
  "jest": "^29.7.0",
48
47
  "jest-junit": "^16.0.0",
@@ -1,4 +1,4 @@
1
- // $ npm_lifecycle_event=debug tsx --inspect -r dotenv/config ./src/helpers/localServer.ts --https
1
+ // $ npm_lifecycle_event=debug tsx --inspect ./src/helpers/localServer.ts --https
2
2
  import { createServerAdapter } from '@whatwg-node/server';
3
3
  import 'isomorphic-fetch';
4
4
  import { IRequest, Router, error, json } from 'itty-router';
@@ -12,7 +12,9 @@ import path from 'path';
12
12
  import https, { createServer } from 'https';
13
13
  import selfsigned from 'selfsigned';
14
14
 
15
- require('dotenv').config({ path: `.env.${process.env.NODE_ENV}` });
15
+ declare const process: NodeJS.Process;
16
+
17
+ libx.node.loadEnv({ path: `.env.${process.env.NODE_ENV}` });
16
18
 
17
19
  log.isDebug = true;
18
20
  log.filterLevel = LogLevel.All;
@@ -45,7 +47,7 @@ libx.node.catchErrors((err) => {
45
47
 
46
48
 
47
49
  // only lunch manual local server if using 'dev' command
48
- if (['debug', 'debug:watch', 'api:debug'].indexOf(process.env.npm_lifecycle_event) !== -1) {
50
+ if (true || ['debug', 'debug:watch', 'api:debug', ''].indexOf(process.env.npm_lifecycle_event) !== -1) {
49
51
  const env = getEnvVars() ?? { a: 1 };
50
52
 
51
53
  for (let entryPoint of entryPoints) {