add support to node <18
This commit is contained in:
parent
1a7f49a784
commit
11c34ac72c
11
package-lock.json
generated
11
package-lock.json
generated
@ -1,16 +1,17 @@
|
||||
{
|
||||
"name": "@alekswilc/ray",
|
||||
"version": "1.0.28",
|
||||
"version": "1.1.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@alekswilc/ray",
|
||||
"version": "1.0.28",
|
||||
"version": "1.1.2",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@permafrost-dev/pretty-format": "^1.1.5",
|
||||
"stacktrace-js": "^2.0.2"
|
||||
"stacktrace-js": "^2.0.2",
|
||||
"uuid": "^10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.14.2",
|
||||
@ -18,8 +19,7 @@
|
||||
"dts-bundle-generator": "^9.5.1",
|
||||
"esbuild": "^0.21.5",
|
||||
"fast-glob": "^3.3.2",
|
||||
"typescript": "^5.4.5",
|
||||
"uuid": "^10.0.0"
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
@ -886,7 +886,6 @@
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
|
||||
"integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
|
@ -13,7 +13,7 @@
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"name": "@alekswilc/ray",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.3",
|
||||
"main": "./build/aleksray.cjs",
|
||||
"module": "./build/aleksray.mjs",
|
||||
"typings": "./build/aleksray.d.ts",
|
||||
|
@ -26,6 +26,7 @@ const _ = async () => {
|
||||
platform: "node",
|
||||
outExtension: { '.js': '.cjs', },
|
||||
bundle: true,
|
||||
target: [ 'node12', ],
|
||||
external: ['@permafrost-dev/pretty-format', 'uuid', 'stacktrace-js']
|
||||
});
|
||||
|
||||
@ -36,6 +37,7 @@ const _ = async () => {
|
||||
sourcemap: "external",
|
||||
platform: "node",
|
||||
outExtension: { '.js': '.cjs', },
|
||||
target: [ 'node12', ],
|
||||
bundle: true,
|
||||
// external: ['@permafrost-dev/pretty-format', 'p-queue', 'stacktrace-js']
|
||||
});
|
||||
@ -52,6 +54,7 @@ const _ = async () => {
|
||||
platform: "node",
|
||||
outExtension: { '.js': '.mjs', },
|
||||
bundle: true,
|
||||
target: [ 'node12', ],
|
||||
external: ['@permafrost-dev/pretty-format', 'uuid', 'stacktrace-js']
|
||||
});
|
||||
|
||||
@ -62,6 +65,7 @@ const _ = async () => {
|
||||
format: "esm",
|
||||
sourcemap: "external",
|
||||
platform: "node",
|
||||
target: [ 'node12', ],
|
||||
outExtension: { '.js': '.mjs', },
|
||||
bundle: true,
|
||||
// external: ['@permafrost-dev/pretty-format', 'p-queue', 'stacktrace-js']
|
||||
|
@ -13,7 +13,7 @@ export interface IPayload {
|
||||
}
|
||||
}
|
||||
|
||||
const LIB_STACK_SOURCES = () => [...(process.env.ALEKSRAY_LIB_STACK_SOURCES?.split(';') || []), '@alekswilc/ray', '@alekswilc\\ray', 'standalone-aleksray-bundle.js', 'standalone-aleksray-bundle.mjs', 'aleksray.js', 'aleksray.mjs']
|
||||
const LIB_STACK_SOURCES = () => [...(process.env.ALEKSRAY_LIB_STACK_SOURCES?.split(';') || []), '@alekswilc/ray', '@alekswilc\\ray', 'standalone-aleksray-bundle.cjs', 'standalone-aleksray-bundle.mjs', 'aleksray.cjs', 'aleksray.mjs']
|
||||
|
||||
export class Payload {
|
||||
public static create(data: Omit<IPayload, 'origin'> & Partial<IPayload>) {
|
||||
|
11
src/index.ts
11
src/index.ts
@ -1,2 +1,13 @@
|
||||
if (!global.fetch) {
|
||||
try {
|
||||
global.fetch = require('node-fetch');
|
||||
} catch (e) {
|
||||
if (e instanceof Error && e.message.includes('Cannot find module')) {
|
||||
throw new Error('@alekswilc/ray -> Please install node-fetch (npm i node-fetch@2) for compatibility')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export { ray, Ray, IOptions } from './Ray';
|
||||
export { Request, Payload, IRequest, IPayload } from './Payload';
|
Loading…
x
Reference in New Issue
Block a user