- 修复Dockerfile构建问题,暂时禁用ideal-image插件 - 更新所有配置文件中的registry端口为5003 - 添加.dockerignore文件优化构建性能 - 创建docker-compose.yml文件支持本地部署 - 添加部署脚本scripts/deploy-docker.sh - 更新Gitea Actions工作流,添加Docker部署步骤 - 创建DOCKER_DEPLOYMENT.md部署文档 - 支持通过3001端口提供lingjingwanxiang web portal服务
44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.default = lqipLoader;
|
|
const tslib_1 = require("tslib");
|
|
const lqip = tslib_1.__importStar(require("./lqip"));
|
|
async function lqipLoader(contentBuffer) {
|
|
this.cacheable();
|
|
const callback = this.async();
|
|
const imgPath = this.resourcePath;
|
|
let content = contentBuffer.toString('utf8');
|
|
const contentIsUrlExport = /^(?:export default|module.exports =) "data:.*base64,.*/.test(content);
|
|
const contentIsFileExport = /^(?:export default|module.exports =) .*/.test(content);
|
|
let source = '';
|
|
if (contentIsUrlExport) {
|
|
source = content.match(/^(?:export default|module.exports =) (?<source>.*)/).groups.source;
|
|
}
|
|
else {
|
|
if (!contentIsFileExport) {
|
|
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
const fileLoader = require('file-loader');
|
|
// @ts-expect-error: type is a bit unwieldy...
|
|
content = fileLoader.call(this, contentBuffer);
|
|
}
|
|
source = content.match(/^(?:export default|module.exports =) (?<source>.*);/).groups.source;
|
|
}
|
|
try {
|
|
const preSrc = await lqip.base64(imgPath);
|
|
const finalObject = JSON.stringify({ src: 'STUB', preSrc });
|
|
const result = `module.exports = ${finalObject.replace('"STUB"', source)};`;
|
|
callback(null, result);
|
|
}
|
|
catch (err) {
|
|
console.error(err);
|
|
callback(new Error('ERROR'), undefined);
|
|
}
|
|
}
|
|
lqipLoader.raw = true;
|