@gravity-ui/app-builder 0.8.4 → 0.8.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/dist/common/models/index.d.ts +3 -1
- package/dist/common/s3-upload/s3-client.d.ts +1 -0
- package/dist/common/s3-upload/s3-client.js +3 -0
- package/dist/common/s3-upload/upload.d.ts +1 -0
- package/dist/common/s3-upload/upload.js +6 -1
- package/dist/common/s3-upload/webpack-plugin.d.ts +1 -1
- package/dist/common/webpack/config.js +2 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ import type { ForkTsCheckerWebpackPluginOptions } from 'fork-ts-checker-webpack-
|
|
|
12
12
|
import type { Options as StatoscopeOptions } from '@statoscope/webpack-plugin';
|
|
13
13
|
import type { SentryWebpackPluginOptions } from '@sentry/webpack-plugin';
|
|
14
14
|
import type { WebpackMode } from '../webpack/config';
|
|
15
|
+
import type { UploadOptions } from '../s3-upload/upload';
|
|
15
16
|
export interface Entities<T> {
|
|
16
17
|
data: Record<string, T>;
|
|
17
18
|
keys: string[];
|
|
@@ -187,12 +188,13 @@ export interface ClientConfig {
|
|
|
187
188
|
configType: `${WebpackMode}`;
|
|
188
189
|
}) => Babel.TransformOptions | Promise<Babel.TransformOptions>;
|
|
189
190
|
}
|
|
190
|
-
interface CdnUploadConfig {
|
|
191
|
+
export interface CdnUploadConfig {
|
|
191
192
|
bucket: string;
|
|
192
193
|
prefix?: string;
|
|
193
194
|
region?: string;
|
|
194
195
|
endpoint?: string;
|
|
195
196
|
compress?: boolean;
|
|
197
|
+
cacheControl?: UploadOptions['cacheControl'];
|
|
196
198
|
/**
|
|
197
199
|
* pattern for additional files in build that need to be loaded to CDN
|
|
198
200
|
*/
|
|
@@ -10,6 +10,7 @@ export declare function getS3Client(options: S3ClientOptions): {
|
|
|
10
10
|
interface UploadOptionsCommon {
|
|
11
11
|
expires?: PutObjectCommandInput['Expires'];
|
|
12
12
|
meta?: PutObjectCommandInput['Metadata'];
|
|
13
|
+
cacheControl?: PutObjectCommandInput['CacheControl'];
|
|
13
14
|
}
|
|
14
15
|
export interface S3UploadDirOptions extends UploadOptionsCommon {
|
|
15
16
|
concurrency?: number;
|
|
@@ -64,6 +64,9 @@ function getS3Client(options) {
|
|
|
64
64
|
if (expires) {
|
|
65
65
|
params.Metadata = { ...params.Metadata, Expires: expires.toString() };
|
|
66
66
|
}
|
|
67
|
+
if (opts.cacheControl) {
|
|
68
|
+
params.CacheControl = opts.cacheControl;
|
|
69
|
+
}
|
|
67
70
|
return s3Client.send(new client_s3_1.PutObjectCommand(params));
|
|
68
71
|
},
|
|
69
72
|
uploadDir(bucket, dirPath, keyPrefix = '', { concurrency = 512, ...opts } = {}) {
|
|
@@ -75,7 +75,12 @@ function uploadFiles(files, config) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
const cacheControl = typeof options.cacheControl === 'function'
|
|
79
|
+
? options.cacheControl(targetFilePath)
|
|
80
|
+
: options.cacheControl;
|
|
81
|
+
return uploadFile(options.bucket, sourceFilePath, targetFilePath, {
|
|
82
|
+
cacheControl,
|
|
83
|
+
})
|
|
79
84
|
.then(() => {
|
|
80
85
|
log.message(`Uploaded ${relativeFilePath} => ${targetFilePath}`);
|
|
81
86
|
return relativeFilePath;
|
|
@@ -7,7 +7,7 @@ interface S3UploadPluginOptions {
|
|
|
7
7
|
exclude?: Rule | Rule[];
|
|
8
8
|
compress?: boolean;
|
|
9
9
|
s3ClientOptions: S3ClientOptions;
|
|
10
|
-
s3UploadOptions: Pick<UploadOptions, 'bucket' | 'targetPath' | 'existsBehavior'>;
|
|
10
|
+
s3UploadOptions: Pick<UploadOptions, 'bucket' | 'targetPath' | 'existsBehavior' | 'cacheControl'>;
|
|
11
11
|
additionalPattern?: string | string[];
|
|
12
12
|
logger?: Logger;
|
|
13
13
|
}
|
|
@@ -709,6 +709,7 @@ function configurePlugins(options) {
|
|
|
709
709
|
s3UploadOptions: {
|
|
710
710
|
bucket: cdn.bucket,
|
|
711
711
|
targetPath: cdn.prefix,
|
|
712
|
+
cacheControl: cdn.cacheControl,
|
|
712
713
|
},
|
|
713
714
|
additionalPattern: cdn.additionalPattern,
|
|
714
715
|
logger: options.logger,
|
|
@@ -754,7 +755,7 @@ function configureOptimization({ config }) {
|
|
|
754
755
|
}
|
|
755
756
|
: undefined),
|
|
756
757
|
css: {
|
|
757
|
-
|
|
758
|
+
type: 'css/mini-extract',
|
|
758
759
|
enforce: true,
|
|
759
760
|
minChunks: 2,
|
|
760
761
|
reuseExistingChunk: true,
|