node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
Copyright (c) 2015-present Strapi Solutions SAS
Portions of the Strapi software are licensed as follows:
* All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined below.
Enterprise License
If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
* All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
MIT Expat License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,51 @@
# @strapi/provider-upload-local
## Resources
- [LICENSE](LICENSE)
## Links
- [Strapi website](https://strapi.io/)
- [Strapi documentation](https://docs.strapi.io)
- [Strapi community on Discord](https://discord.strapi.io)
- [Strapi news on Twitter](https://twitter.com/strapijs)
## Installation
```bash
# using yarn
yarn add @strapi/provider-upload-local
# using npm
npm install @strapi/provider-upload-local --save
```
## Configurations
This provider has only one parameter: `sizeLimit`.
### Provider Configuration
`./config/plugins.js`
```js
module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: 'local',
providerOptions: {
sizeLimit: 100000,
},
},
},
// ...
});
```
The `sizeLimit` parameter must be a number. Be aware that the unit is in bytes, and the default is 1000000. When setting this value high, you should make sure to also configure the body parser middleware `maxFileSize` so the file can be sent and processed. Read more [here](https://docs.strapi.io/developer-docs/latest/plugins/upload.html#configuration)
### Security Middleware Configuration
Special configuration of the Strapi Security Middleware is not required on this provider since the default configuration allows loading images and media from `"'self'"`.

View File

@@ -0,0 +1,39 @@
/// <reference types="node" />
/// <reference types="node" />
import { ReadStream } from 'fs';
interface File {
name: string;
alternativeText?: string;
caption?: string;
width?: number;
height?: number;
formats?: Record<string, unknown>;
hash: string;
ext?: string;
mime: string;
size: number;
sizeInBytes: number;
url: string;
previewUrl?: string;
path?: string;
provider?: string;
provider_metadata?: Record<string, unknown>;
stream?: ReadStream;
buffer?: Buffer;
}
interface InitOptions {
sizeLimit?: number;
}
interface CheckFileSizeOptions {
sizeLimit?: number;
}
declare const _default: {
init({ sizeLimit: providerOptionsSizeLimit }?: InitOptions): {
checkFileSize(file: File, options: CheckFileSizeOptions): void;
uploadStream(file: File): Promise<void>;
upload(file: File): Promise<void>;
delete(file: File): Promise<string | void>;
};
};
export default _default;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,OAAW,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAQpC,UAAU,IAAI;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAOD,UAAU,WAAW;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;mDAG+C,WAAW;4BAiBjC,IAAI,WAAW,oBAAoB;2BAkBpC,IAAI,GAAG,QAAQ,IAAI,CAAC;qBAuB1B,IAAI,GAAG,QAAQ,IAAI,CAAC;qBAoBpB,IAAI,GAAG,QAAQ,MAAM,GAAG,IAAI,CAAC;;;AA/EhD,wBAoGE"}

View File

@@ -0,0 +1,104 @@
'use strict';
var stream = require('stream');
var fs = require('fs');
var path = require('path');
var fse = require('fs-extra');
var utils = require('@strapi/utils');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var utils__namespace = /*#__PURE__*/_interopNamespaceDefault(utils);
const { PayloadTooLargeError } = utils__namespace.errors;
const { kbytesToBytes, bytesToHumanReadable } = utils__namespace.file;
const UPLOADS_FOLDER_NAME = 'uploads';
var index = {
init ({ sizeLimit: providerOptionsSizeLimit } = {}) {
// TODO V5: remove providerOptions sizeLimit
if (providerOptionsSizeLimit) {
process.emitWarning('[deprecated] In future versions, "sizeLimit" argument will be ignored from upload.config.providerOptions. Move it to upload.config');
}
// Ensure uploads folder exists
const uploadPath = path.resolve(strapi.dirs.static.public, UPLOADS_FOLDER_NAME);
if (!fse.pathExistsSync(uploadPath)) {
throw new Error(`The upload folder (${uploadPath}) doesn't exist or is not accessible. Please make sure it exists.`);
}
return {
checkFileSize (file, options) {
const { sizeLimit } = options ?? {};
// TODO V5: remove providerOptions sizeLimit
if (providerOptionsSizeLimit) {
if (kbytesToBytes(file.size) > providerOptionsSizeLimit) throw new PayloadTooLargeError(`${file.name} exceeds size limit of ${bytesToHumanReadable(providerOptionsSizeLimit)}.`);
} else if (sizeLimit) {
if (kbytesToBytes(file.size) > sizeLimit) throw new PayloadTooLargeError(`${file.name} exceeds size limit of ${bytesToHumanReadable(sizeLimit)}.`);
}
},
uploadStream (file) {
if (!file.stream) {
return Promise.reject(new Error('Missing file stream'));
}
const { stream: stream$1 } = file;
return new Promise((resolve, reject)=>{
stream.pipeline(stream$1, fs.createWriteStream(path.join(uploadPath, `${file.hash}${file.ext}`)), (err)=>{
if (err) {
return reject(err);
}
file.url = `/${UPLOADS_FOLDER_NAME}/${file.hash}${file.ext}`;
resolve();
});
});
},
upload (file) {
if (!file.buffer) {
return Promise.reject(new Error('Missing file buffer'));
}
const { buffer } = file;
return new Promise((resolve, reject)=>{
// write file in public/assets folder
fs.writeFile(path.join(uploadPath, `${file.hash}${file.ext}`), buffer, (err)=>{
if (err) {
return reject(err);
}
file.url = `/${UPLOADS_FOLDER_NAME}/${file.hash}${file.ext}`;
resolve();
});
});
},
delete (file) {
return new Promise((resolve, reject)=>{
const filePath = path.join(uploadPath, `${file.hash}${file.ext}`);
if (!fs.existsSync(filePath)) {
resolve("File doesn't exist");
return;
}
// remove file from public/assets folder
fs.unlink(filePath, (err)=>{
if (err) {
return reject(err);
}
resolve();
});
});
}
};
}
};
module.exports = index;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,83 @@
import { pipeline } from 'stream';
import fs from 'fs';
import path from 'path';
import fse from 'fs-extra';
import * as utils from '@strapi/utils';
const { PayloadTooLargeError } = utils.errors;
const { kbytesToBytes, bytesToHumanReadable } = utils.file;
const UPLOADS_FOLDER_NAME = 'uploads';
var index = {
init ({ sizeLimit: providerOptionsSizeLimit } = {}) {
// TODO V5: remove providerOptions sizeLimit
if (providerOptionsSizeLimit) {
process.emitWarning('[deprecated] In future versions, "sizeLimit" argument will be ignored from upload.config.providerOptions. Move it to upload.config');
}
// Ensure uploads folder exists
const uploadPath = path.resolve(strapi.dirs.static.public, UPLOADS_FOLDER_NAME);
if (!fse.pathExistsSync(uploadPath)) {
throw new Error(`The upload folder (${uploadPath}) doesn't exist or is not accessible. Please make sure it exists.`);
}
return {
checkFileSize (file, options) {
const { sizeLimit } = options ?? {};
// TODO V5: remove providerOptions sizeLimit
if (providerOptionsSizeLimit) {
if (kbytesToBytes(file.size) > providerOptionsSizeLimit) throw new PayloadTooLargeError(`${file.name} exceeds size limit of ${bytesToHumanReadable(providerOptionsSizeLimit)}.`);
} else if (sizeLimit) {
if (kbytesToBytes(file.size) > sizeLimit) throw new PayloadTooLargeError(`${file.name} exceeds size limit of ${bytesToHumanReadable(sizeLimit)}.`);
}
},
uploadStream (file) {
if (!file.stream) {
return Promise.reject(new Error('Missing file stream'));
}
const { stream } = file;
return new Promise((resolve, reject)=>{
pipeline(stream, fs.createWriteStream(path.join(uploadPath, `${file.hash}${file.ext}`)), (err)=>{
if (err) {
return reject(err);
}
file.url = `/${UPLOADS_FOLDER_NAME}/${file.hash}${file.ext}`;
resolve();
});
});
},
upload (file) {
if (!file.buffer) {
return Promise.reject(new Error('Missing file buffer'));
}
const { buffer } = file;
return new Promise((resolve, reject)=>{
// write file in public/assets folder
fs.writeFile(path.join(uploadPath, `${file.hash}${file.ext}`), buffer, (err)=>{
if (err) {
return reject(err);
}
file.url = `/${UPLOADS_FOLDER_NAME}/${file.hash}${file.ext}`;
resolve();
});
});
},
delete (file) {
return new Promise((resolve, reject)=>{
const filePath = path.join(uploadPath, `${file.hash}${file.ext}`);
if (!fs.existsSync(filePath)) {
resolve("File doesn't exist");
return;
}
// remove file from public/assets folder
fs.unlink(filePath, (err)=>{
if (err) {
return reject(err);
}
resolve();
});
});
}
};
}
};
export { index as default };
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,63 @@
{
"name": "@strapi/provider-upload-local",
"version": "5.13.0",
"description": "Local provider for strapi upload",
"keywords": [
"upload",
"strapi"
],
"homepage": "https://strapi.io",
"bugs": {
"url": "https://github.com/strapi/strapi/issues"
},
"repository": {
"type": "git",
"url": "git://github.com/strapi/strapi.git"
},
"license": "SEE LICENSE IN LICENSE",
"author": {
"name": "Strapi Solutions SAS",
"email": "hi@strapi.io",
"url": "https://strapi.io"
},
"maintainers": [
{
"name": "Strapi Solutions SAS",
"email": "hi@strapi.io",
"url": "https://strapi.io"
}
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"dist/"
],
"scripts": {
"build": "run -T npm-run-all clean --parallel build:code build:types",
"build:code": "run -T rollup -c",
"build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"test:unit": "run -T jest",
"test:unit:watch": "run -T jest --watch",
"watch": "run -T rollup -c -w"
},
"dependencies": {
"@strapi/utils": "5.13.0",
"fs-extra": "11.2.0"
},
"devDependencies": {
"@strapi/types": "5.13.0",
"@types/fs-extra": "11.0.4",
"@types/jest": "29.5.2",
"eslint-config-custom": "5.13.0",
"memfs": "4.6.0",
"tsconfig": "5.13.0"
},
"engines": {
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
}
}