@crowdin/app-project-module 0.98.0-cf-2 → 0.98.0-cf-3
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/out/types.d.ts +8 -2
- package/out/util/static-files.js +6 -4
- package/package.json +1 -1
package/out/types.d.ts
CHANGED
|
@@ -107,9 +107,9 @@ export interface ClientConfig extends ImagePath {
|
|
|
107
107
|
*/
|
|
108
108
|
d1Config?: D1StorageConfig;
|
|
109
109
|
/**
|
|
110
|
-
* Cloudflare Workers Assets
|
|
110
|
+
* Cloudflare Workers Assets configuration
|
|
111
111
|
*/
|
|
112
|
-
|
|
112
|
+
assetsConfig?: AssetsConfig;
|
|
113
113
|
/**
|
|
114
114
|
* integration module logic
|
|
115
115
|
*/
|
|
@@ -273,6 +273,12 @@ export interface ClientConfig extends ImagePath {
|
|
|
273
273
|
*/
|
|
274
274
|
restrictAiToSameApp?: boolean;
|
|
275
275
|
}
|
|
276
|
+
export interface AssetsConfig {
|
|
277
|
+
/**
|
|
278
|
+
* Cloudflare Workers Assets Fetcher
|
|
279
|
+
*/
|
|
280
|
+
fetcher: Fetcher;
|
|
281
|
+
}
|
|
276
282
|
export interface Environments {
|
|
277
283
|
environments?: Environment | Environment[];
|
|
278
284
|
}
|
package/out/util/static-files.js
CHANGED
|
@@ -48,8 +48,9 @@ function proxyAssetsResponse(fetcher, assetPath, baseUrl, req, res, next) {
|
|
|
48
48
|
* @param staticPath - Path to static directory
|
|
49
49
|
*/
|
|
50
50
|
function serveStatic(config, staticPath) {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
var _a;
|
|
52
|
+
if ((_a = config.assetsConfig) === null || _a === void 0 ? void 0 : _a.fetcher) {
|
|
53
|
+
const assetsFetcher = config.assetsConfig.fetcher;
|
|
53
54
|
return (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
54
55
|
const assetPath = staticPath.startsWith('/') ? `${staticPath}${req.path}` : `/${staticPath}${req.path}`;
|
|
55
56
|
yield proxyAssetsResponse(assetsFetcher, assetPath, config.baseUrl, req, res, next);
|
|
@@ -66,8 +67,9 @@ exports.serveStatic = serveStatic;
|
|
|
66
67
|
*/
|
|
67
68
|
function serveFile(config, filePath) {
|
|
68
69
|
return (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
var _a;
|
|
71
|
+
if ((_a = config.assetsConfig) === null || _a === void 0 ? void 0 : _a.fetcher) {
|
|
72
|
+
const assetsFetcher = config.assetsConfig.fetcher;
|
|
71
73
|
const assetPath = filePath.startsWith('/') ? filePath : `/${filePath}`;
|
|
72
74
|
yield proxyAssetsResponse(assetsFetcher, assetPath, config.baseUrl, req, res, next);
|
|
73
75
|
}
|
package/package.json
CHANGED