mirror of
https://github.com/strapi/strapi.git
synced 2025-08-27 02:05:56 +00:00
fix(file-utils): rewrite requires
This commit is contained in:
parent
5316123801
commit
57009a0f30
@ -4,7 +4,9 @@ const path = require('path');
|
|||||||
const os = require('os');
|
const os = require('os');
|
||||||
const mime = require('mime-types');
|
const mime = require('mime-types');
|
||||||
const fse = require('fs-extra');
|
const fse = require('fs-extra');
|
||||||
const { getStreamSize } = require('@strapi/utils/lib/file');
|
const {
|
||||||
|
file: { getStreamSize },
|
||||||
|
} = require('@strapi/utils');
|
||||||
const { FILE_MODEL_UID } = require('./constants');
|
const { FILE_MODEL_UID } = require('./constants');
|
||||||
|
|
||||||
const UPLOAD_MUTATION_NAME = 'upload';
|
const UPLOAD_MUTATION_NAME = 'upload';
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { PayloadTooLargeError } = require('@strapi/utils/lib/errors');
|
const {
|
||||||
const { kbytesToBytes, bytesToHumanReadable } = require('@strapi/utils/lib/file');
|
errors: { PayloadTooLargeError },
|
||||||
|
file: { kbytesToBytes, bytesToHumanReadable },
|
||||||
|
} = require('@strapi/utils');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const registerUploadMiddleware = require('./middlewares/upload');
|
const registerUploadMiddleware = require('./middlewares/upload');
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { isFunction } = require('lodash/fp');
|
const { isFunction } = require('lodash/fp');
|
||||||
const { streamToBuffer } = require('@strapi/utils/lib/file');
|
const {
|
||||||
|
file: { streamToBuffer },
|
||||||
|
} = require('@strapi/utils');
|
||||||
|
|
||||||
module.exports = ({ strapi }) => ({
|
module.exports = ({ strapi }) => ({
|
||||||
async checkFileSize(file) {
|
async checkFileSize(file) {
|
||||||
|
@ -18,13 +18,12 @@ const {
|
|||||||
nameToSlug,
|
nameToSlug,
|
||||||
contentTypes: contentTypesUtils,
|
contentTypes: contentTypesUtils,
|
||||||
webhook: webhookUtils,
|
webhook: webhookUtils,
|
||||||
|
errors: { ApplicationError, NotFoundError },
|
||||||
|
file: { bytesToKbytes },
|
||||||
} = require('@strapi/utils');
|
} = require('@strapi/utils');
|
||||||
const { NotFoundError } = require('@strapi/utils').errors;
|
|
||||||
|
|
||||||
const { MEDIA_UPDATE, MEDIA_CREATE, MEDIA_DELETE } = webhookUtils.webhookEvents;
|
const { MEDIA_UPDATE, MEDIA_CREATE, MEDIA_DELETE } = webhookUtils.webhookEvents;
|
||||||
|
|
||||||
const { ApplicationError } = require('@strapi/utils/lib/errors');
|
|
||||||
const { bytesToKbytes } = require('@strapi/utils/lib/file');
|
|
||||||
const { FILE_MODEL_UID } = require('../constants');
|
const { FILE_MODEL_UID } = require('../constants');
|
||||||
const { getService } = require('../utils');
|
const { getService } = require('../utils');
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ const { pipeAsync, mapAsync, forEachAsync } = require('./async');
|
|||||||
const convertQueryParams = require('./convert-query-params');
|
const convertQueryParams = require('./convert-query-params');
|
||||||
const importDefault = require('./import-default');
|
const importDefault = require('./import-default');
|
||||||
const template = require('./template');
|
const template = require('./template');
|
||||||
|
const file = require('./file');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
yup,
|
yup,
|
||||||
@ -88,4 +89,5 @@ module.exports = {
|
|||||||
validateYupSchemaSync,
|
validateYupSchemaSync,
|
||||||
convertQueryParams,
|
convertQueryParams,
|
||||||
importDefault,
|
importDefault,
|
||||||
|
file,
|
||||||
};
|
};
|
||||||
|
@ -9,8 +9,10 @@ const { pipeline } = require('stream');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fse = require('fs-extra');
|
const fse = require('fs-extra');
|
||||||
const { PayloadTooLargeError } = require('@strapi/utils/lib/errors');
|
const {
|
||||||
const { kbytesToBytes, bytesToHumanReadable } = require('@strapi/utils/lib/file');
|
errors: { PayloadTooLargeError },
|
||||||
|
file: { kbytesToBytes, bytesToHumanReadable },
|
||||||
|
} = require('@strapi/utils');
|
||||||
|
|
||||||
const UPLOADS_FOLDER_NAME = 'uploads';
|
const UPLOADS_FOLDER_NAME = 'uploads';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user