mirror of
https://github.com/knex/knex.git
synced 2025-06-26 22:00:25 +00:00
Do not bundle polyfills with knex (#3024)
This commit is contained in:
parent
e7c674e4dd
commit
15ac75cda0
@ -4,7 +4,8 @@
|
||||
|
||||
* MSSQL: DB versions older than 2008 are no longer supported, make sure to update your DB;
|
||||
* PostgreSQL|MySQL: it is recommended to use options object for `table.datetime` and `table.timestamp` methods instead of argument options. See documentation for these methods for more details;
|
||||
* Node 6: There are known issues with duplicate event listeners when using knex.js with Node 6 (resulting in MaxListenersExceededWarning under certain use-cases (such as reusing single knex instance to run migrations or seeds multiple times)). Please upgrade to Node 8+ as soon as possible (knex 0.17.0 will be dropping Node 6 support altogether).
|
||||
* Node 6: There are known issues with duplicate event listeners when using knex.js with Node.js 6 (resulting in MaxListenersExceededWarning under certain use-cases (such as reusing single knex instance to run migrations or seeds multiple times)). Please upgrade to Node.js 8+ as soon as possible (knex 0.17.0 will be dropping Node.js 6 support altogether);
|
||||
* Node 6: Please add '@babel/polyfill' production dependency to the project when using Node.js 6 (it will be loaded by knex automatically).
|
||||
|
||||
### Upgrading to version 0.15.0+
|
||||
|
||||
|
16
knex.js
16
knex.js
@ -9,13 +9,19 @@ const { isNode6 } = require('./lib/util/version-helper');
|
||||
|
||||
// Should be safe to remove after support for Node.js 6 is dropped
|
||||
if (isNode6()) {
|
||||
const oldPromise = global.Promise;
|
||||
try {
|
||||
const oldPromise = global.Promise;
|
||||
|
||||
require('@babel/polyfill');
|
||||
require('@babel/polyfill');
|
||||
|
||||
// Preserve any Promise overrides set globally prior to importing knex
|
||||
if (oldPromise) {
|
||||
global.Promise = oldPromise;
|
||||
// Preserve any Promise overrides set globally prior to importing knex
|
||||
if (oldPromise) {
|
||||
global.Promise = oldPromise;
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`You are using Node.js 6. Please consider upgrading to Node.js 8+ or add '@babel/polyfill' dependency to the project (knex will automatically load it).`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
"node": ">=6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.2.5",
|
||||
"@types/bluebird": "^3.5.25",
|
||||
"bluebird": "^3.5.3",
|
||||
"colorette": "1.0.7",
|
||||
@ -35,6 +34,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "^7.2.2",
|
||||
"@babel/polyfill": "^7.2.5",
|
||||
"@babel/preset-env": "^7.3.1",
|
||||
"@types/node": "*",
|
||||
"JSONStream": "^1.3.5",
|
||||
|
@ -3,7 +3,8 @@ import path from 'path';
|
||||
import Promise from 'bluebird';
|
||||
import { sortBy, filter } from 'lodash';
|
||||
|
||||
const readDirAsync = (path) => Promise.promisify(fs.readdir, { context: fs })(path);
|
||||
const readDirAsync = (path) =>
|
||||
Promise.promisify(fs.readdir, { context: fs })(path);
|
||||
|
||||
export const DEFAULT_LOAD_EXTENSIONS = Object.freeze([
|
||||
'.co',
|
||||
|
Loading…
x
Reference in New Issue
Block a user