mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Split runtime info
This commit is contained in:
parent
ad05621ee9
commit
00189a11b7
@ -1,12 +1,8 @@
|
||||
const commonMeta = require('../../src/client/common.meta.json')
|
||||
const { altCdn } = require('../cdn')
|
||||
const runtimeInfo = require('./runtime')
|
||||
|
||||
const compilationInfo = {
|
||||
year: new Date().getFullYear(),
|
||||
version: commonMeta.version,
|
||||
altCdn,
|
||||
...(typeof webpackGitInfo === 'object' ? webpackGitInfo : {}),
|
||||
// buildTime: Number(new Date()),
|
||||
...runtimeInfo,
|
||||
...webpackGitInfo,
|
||||
}
|
||||
module.exports = {
|
||||
compilationInfo,
|
||||
|
||||
8
webpack/compilation-info/runtime.js
Normal file
8
webpack/compilation-info/runtime.js
Normal file
@ -0,0 +1,8 @@
|
||||
const commonMeta = require('../../src/client/common.meta.json')
|
||||
const { altCdn } = require('../cdn')
|
||||
|
||||
module.exports = {
|
||||
year: new Date().getFullYear(),
|
||||
version: commonMeta.version,
|
||||
altCdn,
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
const { compilationInfo } = require('../compilation-info')
|
||||
const runtimeInfo = require('../compilation-info/runtime')
|
||||
const gitInfo = require('../compilation-info/git')
|
||||
const nodePath = require('path')
|
||||
|
||||
module.exports = function (babel) {
|
||||
@ -22,8 +23,8 @@ module.exports = function (babel) {
|
||||
return
|
||||
}
|
||||
targetExpression.properties.push(...[
|
||||
types.objectProperty(types.identifier('commitHash'), types.stringLiteral(compilationInfo.commitHash)),
|
||||
types.objectProperty(types.identifier('coreVersion'), types.stringLiteral(compilationInfo.version)),
|
||||
types.objectProperty(types.identifier('commitHash'), types.stringLiteral(gitInfo.commitHash)),
|
||||
types.objectProperty(types.identifier('coreVersion'), types.stringLiteral(runtimeInfo.version)),
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ const {
|
||||
cssStyleLoaders, sassStyleLoaders
|
||||
} = require('./loaders/style-loaders')
|
||||
const tsLoader = require('./loaders/ts-loader')
|
||||
const { compilationInfo } = require('./compilation-info')
|
||||
const runtimeInfo = require('./compilation-info/runtime')
|
||||
|
||||
const relativePath = p => path.join(process.cwd(), p)
|
||||
const getDefaultConfig = (srcFolder) => {
|
||||
@ -156,7 +156,7 @@ const commonMeta = require('../src/client/common.meta.json')
|
||||
|
||||
const replaceVariables = text => {
|
||||
return text.replace(/\[([^\[\]]+)\]/g, match => {
|
||||
const value = get(compilationInfo, match)
|
||||
const value = get(runtimeInfo, match)
|
||||
if (value !== undefined) {
|
||||
return value
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user